Repository navigation
fix(ghidra): report byte-search cursor mismatches without schema repair - #8420
blake-andrews1 wants to merge 1 commit into
Conversation
A cursor for another target, profile, pattern, mask, bounds, or document was reported as invalid input and pointed at schema repair. Name the binding, attribute the issue to the cursor, and leave the differing component unknown.
Codex Review SummaryThis 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. |
[Medium impact] This PR appears safe to merge; no actionable defect was found in the changed refusal path. SummaryThis PR gives byte-search cursor mismatches a distinct bridge code while keeping the public error code as
Reviews (1) · Last reviewed commit: "fix(ghidra): report byte-search cursor m..." · Reviewed by Greptile |
|
Hey @blake-andrews1, thanks for this! The fix looks good. What's left: it has merge conflicts with main in |
A cursor for another target, profile, pattern, mask, bounds, or document was reported as invalid input and pointed at schema repair. Name the binding, attribute the issue to the cursor, and leave the differing component unknown. Fixes #8366 Supersedes #8420 Co-Authored-By: gensokyo-dev <[email protected]>
A cursor for another target, profile, pattern, mask, bounds, or document was reported as invalid input and pointed at schema repair. Name the binding, attribute the issue to the cursor, and leave the differing component unknown. Fixes #8366 Supersedes #8420 Co-Authored-By: gensokyo-dev <[email protected]>
A cursor for another target, profile, pattern, mask, bounds, or document was reported as invalid input and pointed at schema repair. Name the binding, attribute the issue to the cursor, and leave the differing component unknown. Fixes #8366 Supersedes #8420 Co-Authored-By: gensokyo-dev <[email protected]>
|
Thank you for this fix. It landed in #10499 with your authorship kept on the commit (adapted where noted in the PR), so I'm closing this PR as superseded. |
Summary
A byte-search continuation whose cursor does not match the current binding was rejected as generic invalid input and told the caller to repair the schema. The request already matches the schema. The cursor is a one-way digest, so the refusal now names every bound value, including the analysis profile and selected Ghidra project, and says which value differs is unknown.
Closes #8366.
Problem and expected behavior
Reusing a
search_bytescursor after the target, analysis profile or project, pattern, mask, bounds, or document changed returned:{ "code": "invalid_request", "message": "Analysis input is invalid. Check the arguments and try again.", "recovery": { "kind": "inspect_input_contract", "operation": "search_bytes" }, "details": { "issues": [ { "path": [], "reason": "invalid_value", "message": "Byte search cursor does not match the target and query" } ] } }The same refusal is still returned. The headline now states that the cursor is bound to the target, analysis profile (including a selected Ghidra project), pattern, mask, bounds, and document, and that it does not identify which of those differs.
details.issues[0].pathiscursor,observed.differing_componentisunknown, and there is noinspect_input_contractrecovery. Remediation says to select the original context, includingREA_GHIDRA_PROJECT_PATHandREA_GHIDRA_PROGRAM_NAMEwhen a saved project was used, or to start a new search without the cursor.Change and scope
The Ghidra bridge reports this mismatch as
byte_search_cursor_mismatchinstead of a genericinvalid_request. The provider projection treats that code like the existing file-offset outcomes: the bridge reason is the headline, the request is marked as conforming to the input contract, and schema-repair recovery is omitted. Ordinarysearch_bytesinput failures still use schema recovery. Session diagnostics for this code stay request-scoped.Not included: live metadata freshness across accepted pages (#8365), and any claim that a hash mismatch proves the project or target changed.
Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
GhidraProviderClientprojects that code for CLI and MCP. No superseded path was removed.invalid_request. The headline, issue path, observed facts, remediation, and absence ofinspect_input_contractrecovery change for this mismatch only. The input schema is unchanged.byte_search_cursor_mismatchis new. An older bridge that still emitsinvalid_requestwith the previous message keeps the old projection.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): none. Tool schemas are unchanged.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Tests added or updated:
src/ghidra/GhidraProvider.behavior.test.tsprojects the mismatch and keeps schema recovery for an ordinarysearch_bytesinvalid_request.src/ghidra/GhidraSessionError.test.tschecks request-scoped diagnostics. The projection test also readsbridge/ghidra/ReaGhidraBridge.javaand requires the new code and message.Base reproduction or other evidence: Executed. Before the projection change,
npm run test:local -- src/ghidra/GhidraProvider.behavior.test.tson Node 24.22.1 failed the new test: the injectedbyte_search_cursor_mismatchwasexecution_failureand told the caller to runrea doctor. The issue's previous public shape, quoted above, is source-derived from the oldinvalid_requestmessage andAnalysisInputErrorschema recovery.User-visible CLI/MCP output (if applicable): The shared projection, not a live CLI or MCP process. Headline:
Byte search cursor does not match this search. It is bound to the target, analysis profile (including a selected Ghidra project), pattern, mask, bounds, and document, and does not identify which of those differs.Remediation: select the original target, analysis profile or Ghidra project, pattern, mask, bounds, and document; when a saved project was used, start REA with the same
REA_GHIDRA_PROJECT_PATHandREA_GHIDRA_PROGRAM_NAME; or start a new search without the cursor.Remaining proof gaps: The real Ghidra CLI and MCP controls below cover a changed pattern on one fixture and host; project, target, mask, bounds, and document mismatches were not separately re-executed. A cursor that lies outside initialized memory is unchanged.
For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
Public error delivery is covered at the provider projection that CLI and MCP share. Lifecycle regressions are not applicable: no resource ownership or finalization changes.
For evidence-bearing changes:
Validation performed
npm ci— completed with Node 24.22.1 (.nvmrc); 739 packages installed.npm run test:local -- src/ghidra/GhidraProvider.behavior.test.ts— before the fix: 1 failed, 184 passed. The new test expectedinvalid_requestwith the binding message and norecovery; it receivedexecution_failureandrea doctorremediation.npm run test:local -- src/ghidra/GhidraProvider.behavior.test.ts src/ghidra/GhidraSessionError.test.ts— after the fix: 197 passed (186 + 11).npm run test:local -- src/main/messages.test.ts— 1 passed. The error catalog still contains the published recovery strings.npm run check:fast—deps:check, typecheck, and lint succeeded (Node 24.22.1).limit: 1and returned both matches in order, with the first page incomplete and the second complete. Reusing the first cursor with a different pattern returned the new binding-specific message,cursorissue path, unknown differing component and restart guidance without schema-repair recovery. The self-built Mach-O hash stayed unchanged. In separate CLI invocations, the cursor continued the original query, the changed pattern exited 1 with the same binding-specific recovery, and restarting the changed query without a cursor succeeded.Compatibility, safety, and release
inspect_input_contractfor this mismatch need to follow the new remediation. The public error code remainsinvalid_request. No migration of saved data.Author readiness
Human owner: @blake-andrews1
Before merge
type(scope): outcome.