#13432

[Feature] Audit recovery messages across all REA providers

Openmorlutoopened 3d ago

Before submitting

  • I searched issues and pull requests for related reports.
  • I understand the contribution scope must be reviewed before integration.
  • This discussion contains no private target data or credentials.

Area

MCP or agent integration, CLI, and provider workflows.

Current limitation

Recovery can send callers to a schema for a valid lookup, suggest a retry that still fails, or leave them to infer the next action from diagnostics. Audit the recovery messages emitted by every REA provider and by shared CLI/MCP workflows. Track each path by its owning failure and the interface that presents it.

Context and evidence

The review of #12966 found several ways valid procedure lookups could send an analyst down the wrong path. Ghidra 12.2 accepted the normal stripped Mach-O retry in both adapters, but two fixtures produced unusable address suggestions. On the normal fixture, Hopper reported a generic invalid request, then inventory search found a procedure that decompiled successfully. A simulated IDA upstream returned an expected lookup miss and REA projected input-schema guidance. Frequency across REA and across real IDA installations is unknown.

The broader lifecycle audit and timeout and limit recovery audit already cover those failure families. Link their findings and track coverage here without opening duplicate work. This proposal adds a pass across the messages and caller actions that REA actually emits, starting with lookup and validation failures. Related work covers missing functions in selected Ghidra projects, analyst-selected entries outside provider inventories, and specific recovery defects such as native export byte limits and firmware staging budgets.

Expected interaction with targets

Read existing files or captured data. Use source-owned fixtures and existing supported workflows for verification. The audit itself proposes no new target authority.

Desired outcome and success criteria

  • Resume the task. When REA knows a supported repair, give the exact command, tool argument, or setting to change. Say when a retry will be useful and which target, provider, project, or session the caller should reuse.
  • Narrow down the blocker. When the repair depends on a missing fact, suggest the smallest check that resolves it. Say what result to look for and how it determines the next step. Offer choices when the caller needs to select among observed candidates.
  • Help the caller stop safely. When the operation is blocked, name the unmet prerequisite, fixed limit, or pending cleanup. Include any supported way to narrow the task, retrieve partial Evidence, or resume after the blocker clears.

How it should read

Use plain, specific language. Name what happened to the requested operation and lead with the most useful supported action. Keep the common case short. Put details about lost session state, cleanup, or uncertainty next to the action they affect. Back tool and command names with existing structured fields where available, so callers can use them without parsing the prose.

  • Verified retry. “Ghidra couldn’t resolve main. Retry with --procedure 0x100000328.” On MCP, give the equivalent argument, {"procedure":"0x100000328"}. Use this wording when the selected session confirms a procedure at that address.
  • Lookup needs another observation. “Ghidra couldn’t resolve main in this project. Search the procedure inventory for entry. If you find a matching entry procedure, retry with its address.” Use search_procedures with {"pattern":"entry"} on MCP or rea search <path> entry --kind procedures --provider ghidra on the CLI. An empty search leaves the entry unresolved.

Verification available so far

Observed results on real Ghidra and Hopper and a simulated IDA upstream. Broader provider coverage and failure frequency are unknown.

Verification details

  • Start with the provider catalog and generated error inventory. Trace each recovery to its owning failure and public adapters. Record a disposition for every provider and message path, including verified behavior, defects, and coverage limited to source inspection or simulation.
  • Start runtime verification with valid lookup misses and malformed-input controls, then cover prerequisites, project selection, and partial Evidence. Reuse the linked audits for limits, timeouts, and cleanup.
  • For each confirmed defect, capture the failure and follow the suggested step through the public interface. Record whether it completes the task, establishes the promised fact, or accurately identifies why the caller is blocked. Check both CLI and MCP where available, including the effect on the selected session and any retained Evidence.
  • Group fixes by root cause. Track unverified cases and any avoidable calls or retries the message causes.
  • Use the existing recovery design and verification guidance as the audit standard.

Activity

1
Abhaii113d ago

I'd like to take the first slice of this, focusing on procedure lookup and resolution recovery across the native decompiler providers (Ghidra, Hopper, and IDA) following docs/development/tool-design.md#design-recovery-around-the-failure.

Specifically:

  • Separate syntactically invalid input schemas from valid lookup misses in procedure resolution so callers are not directed to input-schema inspection on a valid symbol/address request.
  • Emit structured next-action recommendations:
    • When candidates exist or a canonical address is known, provide the exact argument shape ({"procedure": "<address>"} on MCP, --procedure <address> on CLI).
    • When an entry is unresolved in the current project, suggest the minimal discovery query (search_procedures pattern on MCP / rea search <path> <pattern> --kind procedures on CLI) instead of generic retry or schema text.
  • Add boundary tests covering both MCP and CLI recovery outputs on unresolved/stripped fixtures.

I'll leave the subsequent provider families (firmware/staging and format parsers) for follow-ups. I can open a PR for this first slice in the next day or two unless you'd prefer to handle it differently.