Repository navigation
fix(session): guide unsupported provider recovery - #8567
Conversation
[Medium impact] The PR appears safe to merge, with no outstanding numbered finding or new actionable issue. SummaryAdds recovery advice when the selected provider does not declare an operation.
No new actionable issues or security concerns were identified. This review did not run tests or real providers. Whether another PR supersedes this one could not be confirmed because GitHub access was unavailable. Reviews (11) · Last reviewed commit: "test: avoid freezing retry remediation w..." · Reviewed by Greptile |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
An operation the provider does not declare still explains the entry-comment handoff. A declared but unavailable operation keeps that capability's own message and remediation.
The merged unknown-provider checks stay in the same scenario and pass the workspace path explicitly.
Merge main and keep comment-facet recovery distinct from generic provider guidance.
Summary
When the selected binary provider does not declare an operation, guide the caller to an available function-entry comment workflow where applicable, or to inspect candidate capabilities and explicitly choose a provider. Previously the error only suggested choosing another analysis or target. Related: #8565 and #6404.
Problem and expected behavior
A Kuna
read_bytesorsearch_bytesrequest can be unavailable even when a configured Ghidra candidate supports it. The error now names the undeclared operation and gives MCP and CLI discovery paths, while stating that availability does not guarantee target support and that switching may discard provider session edits which retained Evidence does not restore.Change and scope
Set the user message at the binary session's undeclared-operation boundary. For regular or inline comment writes, offer
annotate_native_functiononly if the bound provider declares it available, and only as a conditional function-entry option; give its MCP and CLI forms. Declared but unavailable capabilities, provider-selection failures, provider-owned error guidance, error codes and explicit selection behavior are unchanged. No automatic provider fallback or address conversion occurs.Contract and boundary impact
binary_sessioncomplete detail and explicitopen_binaryselection, or CLIrea providersand--provider, noting that target support is unknown until a target is selected.Expected effects:
Evidence and regression coverage
The provider-selection MCP boundary regression failed on the base because the error did not mention
binary_session; it passes with the new guidance and verifies the selected provider was not switched automatically.Real compact stdio MCP with Kuna 1.988 and Ghidra 12.1.4 on macOS arm64: Kuna
read_bytesandsearch_bytesreturn the new remediation;binary_sessioncomplete lists Ghidra's candidate capabilities; explicit reopening with Ghidra succeeds and returns the expecteddeadbeefbytes. The owned Mach-O target was unchanged and never executed.In a real Ghidra-to-Kuna-to-Ghidra session, a session-only Ghidra name was absent after reopening, while its mutation Evidence remained retained. A separate Kuna-to-Ghidra switch retained the exact original Kuna inventory Evidence ID and provider attribution. Both tests used the same owned target without changing executable bytes. The final recovery text explicitly warns about possible session-edit loss.
A real CLI Kuna
read-bytesrefusal displayed the same discovery guidance. The earlier wording was exercised through MCP; the CLI check preceded the final wording adjustment.After an actual Ghidra metadata edit,
close_binarywithsnapshot_pathrefused snapshot creation withevidence_integrity_mismatchand left the edited session active. Switching away and reopening then discarded the edit while retaining its Evidence. This verifies why the warning must not imply that an analysis snapshot or Evidence export restores the live annotation.In a detached combination with fix: guide address-context comment recovery #8414 and real Ghidra MCP, an initial version of this change hid the more specific address-context comment recovery. Generic guidance now stays in the user-facing error message rather than claiming provider-authored remediation; the combined real control returned the function-comments-view guidance for both comment facets. This preserves provider-authored remediation precedence.
Review follow-up: the binary session now owns the undeclared-operation formatter; the MCP boundary checks delivery against that owner and separately checks the recovery API names and unchanged provider selection. A harmless warning rewrite passed the focused suite; replacing
binary_sessionwith a nonexistent name failed at the intended assertion.No autonomous-agent trial or real-provider check on other platforms was performed. Candidate readiness and target compatibility remain separate facts.
On prior head
8d1118a49, real Kuna 1.988 stdio MCP controls in full and compact profiles configured a nonexistent Ghidra installation.read_bytesadvised checking candidate availability, target support and capabilities, and choosing a provider only if suitable and available.binary_sessionreported Ghidra unavailable withexecutable_missing; an explicit Ghidra open failed readiness without replacing the Kuna session, and its inventory Evidence ID remained unchanged. The owned target digest was unchanged. This tests one unavailable configuration on macOS arm64, not every no-alternative or unsupported-target case.A second prior-head real MCP control also set Hopper's launcher to a nonexistent path. In both profiles, Ghidra, Hopper and IDA were unavailable and the selected Kuna did not declare
read_bytes;binary_sessiontherefore contained no candidate simultaneously ready, target-supported and declaring that operation. Explicitly attempting unavailable Ghidra left Kuna's existing inventory Evidence ID intact. The target digest was unchanged. The complete structured status response was 70,006 UTF-8 bytes in this configuration; the 24,089-byte default summary omitted per-candidate capability details. These sizes are not token counts or latency measurements. See [Design] Guide recovery from unsupported provider operations #8565 for a possible bounded discovery follow-up.On prior head
da62c6aa3, the 13 focused MCP tests passed, as did touched-fileoxfmtandgit diff --check. A real Kuna CLIread-bytesrefusal showed the revised guidance. In the same no-candidate environment, bothrea providers --format jsonandrea capabilities --format jsonreturned target-free status withtarget_support: unknown; source inspection shows they invoke the same status workflow. The guidance now recommends one command and does not imply it has assessed a specific target.Current-head (
b282fece7) real Kuna 1.989 and Ghidra 12.1.4 stdio MCP on macOS arm64: after a Kuna exact-address xref and an unsupported 256-byte signature search, the error directed candidate discovery. Complete session status showed Ghidra available, target-supported, and declaringsearch_bytes; an explicit switch found the table. An exported bundle retained the original Kuna xref Evidence ID and provider in both schema profiles. The complete status was 69,914 JSON bytes in this configuration, not a token or latency measurement. The fixture contained an AES S-box and two lookup functions, not an AES implementation; SHA-256db652d426f596d311d91d5e20f1e3d714784f0512faa70dca8a2a788d99b15a7was unchanged and the target was not executed. This is one caller-driven workflow, not an agent trial.Review and integration follow-up
The general selected-provider guidance was stored as a specific remediation, so
inspect_address_contextskipped its more useful same-document comment-facet recovery. Capability failures now retain generic fallback recovery separately from provider-specific remediation; the error projection, re-attribution and explicit-secret redaction preserve that distinction. Non-comment facets and direct CLI/MCP errors still get the fallback. The top-level message now identifies the unavailable operation without duplicating the full action. Entry-comment guidance no longer promises CLI edits always disappear: persistence depends on the provider and selected checkpoint mode.A public MCP regression against an actually bound provider with undeclared comment operations failed on the previous implementation and passes with both facet-specific recovery and the unrelated generic fallback retained. On macOS arm64, Node 24.22.1, five focused domain, adapter and MCP suites passed 137 tests;
npm run check:fastpassed typecheck and lint, both uncached;npm run format:checkandgit diff --checkpassed. The focused checks ran on a branch includingmainthroughf8bb792; the subsequent conflict-free merge includedmainthrough2e2f981, including #9231. Both include #9276's correction to the old Ghidra evidence assertion. No real Ghidra or Kuna workflow was rerun for this follow-up; the earlier real-provider observations below are attributed to their stated heads.The MCP fixture helper already owns temporary directory cleanup. The review follow-up removes the duplicate file-level deletion while retaining client and server cleanup in
afterEach; the focused provider-selection MCP suite passed all 15 tests on Node 24.22.1, and touched-file formatting andgit diff --checkpassed.Validation performed
npm run test:focused -- tests/boundary/mcp/providerSelectionMcp.test.ts— 13 passed on current headb282fece7, including available and unavailable entry-annotation cases; the original undeclared-operation assertion failed on the base revision.npm run check:fastandgit diff --check— passed on current headb282fece7;npm run docs:checkpassed on the prior head.oxfmt --checkon touched files — passed on the current head.CI status
The prior
b282fece7shard failure concerned #8685. The latest pre-follow-up shard 5 failed a stale Ghidra checkpoint limitation assertion; #9276 updates that test on main and is included in this branch. Hosted CI on the updated head is pending.morlutois exempt from the author-readiness declaration under CONTRIBUTING.md.Compatibility, safety, and release
The error message and remediation for undeclared operations change; code, category and details remain intact. No automatic provider switch, target execution or installation change.
On the prior head, real Ghidra 12.1.4 fresh-import MCP controls in both profiles returned the conditional function-entry guidance for regular and inline comment requests;
annotate_native_functionthen wrote and read back both comments at the known entry. Existing-project read-only controls did not suggest this unavailable mutation. The target remained unchanged. #6404 tracks arbitrary-address comment support; no autonomous-agent behavior is established.A temporary conflict-resolved combination of #8567
757f2646and #8581d1f5b3eapassed 23 MCP boundary tests and real Ghidra 12.1.4 controls in both schema profiles. Fresh sessions offered and successfully followed the regular/inline function-entry handoff; existing-project sessions did not suggest that unavailable edit and retained their specific read-only recovery. The target and original project hashes were unchanged. This validates the stated local resolution, not an automatic merge.A real Ghidra control used an interior instruction address as the
annotate_native_functionprocedure selector; Ghidra resolved it to its containing function and wrote at the entry, with the entry returned in Evidence. The conditional handoff here says to use it only for an intended exact entry; #8583 tracks the separate pre-mutation selector-contract concern. This PR does not change annotation selector semantics.b282fece7with a local unrelated catalog-description edit, real Kuna 1.990 and Ghidra 12.1.4: in compact and full stdio MCP, theread_bytesrefusal directed candidate discovery and warned about discarded session edits; complete status identified Ghidra as available, target-supported, and declaring the operation. Explicitly switching to Ghidra read loader-adjusted bytes, and the exported bundle retained the earlier Kuna xrefs Evidence exactly. Successful outputs validated against the advertised schemas; the owned target hash remained unchanged. This is a scripted positive handoff, not an agent-selection trial or a guarantee for other configurations.Latest main integration
Head
2b9a5b1c8emerges maina67525cdf1, including the documentation reorganization. The merge completed without textual conflicts; the affected shared contracts and documentation were inspected. On Node 24.22.1, four focused provider-selection MCP, error projection, sensitive-failure and attribution suites passed 129 tests;git diff --checkpassed. Hosted checks for this head are pending.Retry guidance review follow-up
Two retry assertions froze presentation wording instead of checking the behavior they protect. The retry projection now checks the owning formatter, while the fallback-precedence check compares the same retryable error with and without generic fallback and checks its retryable flag. The focused projection suite passed 85 tests; a control that incorrectly prioritizes generic fallback failed at the intended assertion. Touched-file formatting and
git diff --checkpassed. Hosted checks on the new head are pending.Author readiness
Human owner: