Skip to content

fix(ghidra): guide recovery from unresolved procedure selectors - #8470

Merged
morluto merged 6 commits into
mainfrom
codex/ghidra-procedure-lookup-recovery
Nov 4, 2026
Merged

morluto merged 6 commits into
mainfrom
codex/ghidra-procedure-lookup-recovery

Conversation

@morluto

@morluto morluto commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Problem and outcome

When Ghidra cannot uniquely resolve a valid procedure selector or source-file offset, REA gives generic schema-repair advice. Report the actual lookup or mapping outcome and direct the caller to the procedure inventory, an explicit candidate address, or the load-image mapping as appropriate. Addresses #8208; related: #8178.

For an existing selected project, recovery explains that its analysis history is unknown and that a separate fresh import excludes its annotations and other edits. REA does not switch projects automatically. Ambiguous results retain candidate addresses; file-offset fallback and ordinary malformed-input handling remain intact. The public error code remains invalid_request.

The Ghidra bridge owns the lookup outcomes and the provider projects their CLI/MCP recovery. This changes read-only analysis guidance and adds no target authority or compatibility shim.

Validation

Windows, Linux, other Ghidra versions and broader project histories remain unverified. The Linux verifier additions were not run locally. Hosted CI is running on the current head.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

The PR gives unresolved procedure selectors and file offsets specific Ghidra errors and useful recovery guidance.

  • Ghidra lookup errors now explain what happened to each selector.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Procedure selector] --> B[Ghidra lookup]
  B --> C[Procedure missing]
  B --> D[Procedure name ambiguous]
  B --> E[File offset unmapped]
  B --> F[File offset ambiguous]
  C --> G[Inventory guidance]
  D --> H[Choose a reported address]
  E --> I[Inspect loaded mappings]
  F --> H
  G --> J[Shared CLI and MCP invalid_request]
  H --> J
  I --> J
Loading

Reviews (6) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

@morluto morluto changed the title fix(ghidra): guide recovery from missing procedures fix(ghidra): guide recovery from unresolved procedure selectors Nov 1, 2026
@morluto
morluto marked this pull request as ready for review November 1, 2026 09:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T18:24:36.405502Z 842cf7c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@morluto

morluto commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Current-main integration control: an isolated, uncommitted merge of PR head c9039515e with main 75c3cab54 merged cleanly and built. With real Ghidra 12.1.4/JDK 21 on macOS arm64, compact and full stdio MCP selected the owned deliberately unanalysed project: its inventory contained one function, _evaluate was not found, and recovery preserved unknown project analysis history and described a separate fresh import without the project's edits. In a fresh-import control on the same target, the inventory contained three functions and _evaluate decompiled successfully. An invented missing name in both modes retained the selector and inventory advice without schema-repair advice; the selected-project warning appeared only in project mode. Repeating list_procedures after the refusals returned the same inventory in each session. The target SHA-256 ffad1b70c6a5a7ef3f7c3f59126be516520210777d949b35e97c9067f272aa2d and all 10 regular source-project file hashes remained unchanged; the executable was not run.

This is a temporary integration, not a new PR head or a clean full verifier run; it covers one host and fixture and does not establish autonomous-agent selection.

@morluto

morluto commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner Author

Combined current-head real-Ghidra lane

On PR #8470 head 842cf7cd1, the unmodified host-native verifier failed at #8172 as recorded above. In an isolated checkout of that same head, I substituted the verifier files from #8672 aa06707b4 (retained comparison), #8381 64e42396 (snapshot lifecycle), #8536 78b6c662 (legacy snapshot refusal), and #8578 dd281594 (regex recovery). node scripts/verify-real-ghidra.mjs then passed on macOS arm64 with Ghidra 12.1.4, JDK 21 and Node 24.22.1. Its report recorded four fixture variants, 439 successful and 52 rejected boundary calls, cleanup complete, verified process lineage and no remaining descendants.

This is a combined verification of four unmerged verifier changes with #8470, not a pass of the unmodified #8470 head or proof of other platforms. The full analyze_function result remains checked; the substituted comparison request uses retained IDs rather than two inline records. Earlier in this investigation, applying only #8672 and #8381 got past the input limit but stopped at the separate legacy snapshot assertion addressed by #8536.

@morluto
morluto merged commit 103684b into main Nov 4, 2026
54 of 57 checks passed
@morluto
morluto deleted the codex/ghidra-procedure-lookup-recovery branch November 4, 2026 11:51
@morluto morluto added bug Something isn't working provider: ghidra Analysis provider / engine: ghidra labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working provider: ghidra Analysis provider / engine: ghidra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant