fix(session): declare, admit and advertise the open-target prerequisite through one owner (#15356)

* fix(contracts): declare the open-target prerequisite once in availability

Replace the requiresActiveTarget boolean with an "active-target" value of the
availability declaration. 18 contracts that read a required caller path, all
declared standalone or host-restricted or named inventory rules, no longer
claim to need an open target.

* fix(session): admit tools through one session evaluator shared with binary_session

binary_session availability and call-time dispatch now read one admission
evaluator for active-target tools and external mutations. Resource-only
lane refusals and Ghidra or resource-only external-mutation refusals carry
the open_binary or close_binary recovery that binary_session reports,
instead of a generic capability or unreadable-output error. Packet
capture, Wakaru, firmware and mitmproxy refuse an unsupported host before
reading tool configuration.

* fix(mcp): advertise the open-target prerequisite and name open_binary on first contact

Each active-target tool's advertised description ends with one sentence
derived from its availability declaration. When the SDK refuses such a
tool's arguments while the session would also refuse it, the
invalid_request remediation names the session recovery first, read from
the same admission evaluator as binary_session and dispatch.

* fix(mcp): refuse composed workflows as a whole and keep scoped recovery and catalog identity in step

A composed workflow such as batch_decompile now refuses with the
advertised open_binary or close_binary recovery before it runs, instead of
reporting a batch of failed children. Malformed arguments on a connection
that does not advertise session tools lead with the scoped restart
recovery, and catalog digests cover the advertised prerequisite sentence.
The prerequisite test reads union alternatives.
This commit is contained in:
morluto authored and GitHub committed 2026-12-01 03:55:48 +00:00
1 parent 9258370c14
commit 402ce20b80
61 files changed
+861 -168

No files matched your search

@@ -47,6 +47,26 @@ it("names the Wakaru configuration requirement when it is not configured", async
});
});
it("refuses an unsupported host before reading the Wakaru configuration", async () => {
const refusal: unknown = await resolveWakaruCommand(
{ REA_WAKARU_COMMAND: "/opt/wakaru" },
{ platform: "darwin", architecture: "arm64" },
).catch((cause: unknown) => cause);
if (!(refusal instanceof AnalysisCapabilityUnavailableError))
throw new Error("Expected a capability refusal");
// Setting REA_WAKARU_COMMAND cannot help on this host.
expect(projectAnalysisError(refusal)).toMatchObject({
code: "capability_unavailable",
message:
"Wakaru recovery runs only on Linux x64; this host is darwin arm64.",
remediation: {
action:
"Run recover_javascript_sources on a Linux x64 host with REA_WAKARU_COMMAND set; no setting enables it on this host.",
},
});
});
it("projects the fixed Wakaru deadline without an editable setting", async () => {
const refusal: unknown = await runWakaruCommand({
resources: createTestArtifactResourceScope(),
+10 -5
View File
@@ -95,12 +95,17 @@ export const resolveWakaruCommand = async (
resources?: ArtifactResourceScope,
signal?: AbortSignal,
) => {
// No setting makes another host supported, so the host is refused before
// the configuration is read.
if (!wakaruHostSupported(host.platform, host.architecture)) {
const reason = `Wakaru recovery runs only on Linux x64; this host is ${host.platform} ${host.architecture}`;
throw new AnalysisCapabilityUnavailableError("wakaru", OPERATION, reason, {
userMessage: `${reason}.`,
remediationAction: `Run ${OPERATION} on a Linux x64 host with REA_WAKARU_COMMAND set; no setting enables it on this host.`,
});
}
const configured = environment.REA_WAKARU_COMMAND;
if (
!wakaruHostSupported(host.platform, host.architecture) ||
configured === undefined ||
!isAbsolute(configured)
)
if (configured === undefined || !isAbsolute(configured))
throw new AnalysisCapabilityUnavailableError(
"wakaru",
OPERATION,