Skip to content

fix: name host and tool requirements in optional adapter refusals - #1224

Merged
kaoru0822-kitauji merged 2 commits into
mainfrom
fix/adapter-host-refusal-messages
Oct 9, 2026
Merged

kaoru0822-kitauji merged 2 commits into
mainfrom
fix/adapter-host-refusal-messages

Conversation

@kaoru0822-kitauji

@kaoru0822-kitauji kaoru0822-kitauji commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

When an optional external-tool adapter refuses because of the host or its tool configuration, CLI and MCP callers are told to pick a different target:

$ rea inspect-binary-layout ./a.elf --format json        # on macOS
{ "code": "capability_unavailable",
  "message": "This analysis is unavailable for the current target. Choose another analysis or target.",
  "remediation": { "action": "This analysis is unavailable for the current target. Choose another analysis or target." },
  "details": { "provider_id": "pwntools-elf",
               "reason": "The initial real-verified pwntools artifact profile supports Linux x64 only." } }

Choosing another target cannot satisfy a Linux-only profile or an unset REA_*_COMMAND. The actual requirement appears only in details.reason. Reproduced on macOS with inspect-binary-layout, inspect-evm-interface, recover-javascript-sources, inspect-firmware-regions and extract-firmware.

The cause is that these AnalysisCapabilityUnavailableErrors carry no userMessage, so the projection falls back to the generic text for the whole tag. Other configuration refusals in the same adapters already pass their reason as userMessage: EVMole's prlimit and limit checks, JADX, pwndbg, and the Ghidra NativeAOT host refusal. This PR makes the remaining host and tool refusals consistent with them. It follows the same approach as 6c13fc8 for Android.

Change

Each refusal below now passes its reason as userMessage, so message and remediation.action name the requirement. code, category, retryable and details are unchanged.

Adapter Refusals
pwntools ELF layout Linux x64 host profile
EVMole Linux x64 host profile
firmware (binwalk/unblob) Linux host + absolute REA_BINWALK_COMMAND/REA_UNBLOB_COMMAND; unusable command; REA_FIRMWARE_PRLIMIT_COMMAND; resource limiter; tool version banner/admission
mitmproxy native captures Linux host + absolute REA_MITMDUMP_COMMAND; configured mitmdump unavailable
Wakaru Linux x64 host + absolute REA_WAKARU_COMMAND; configured Wakaru/prlimit unavailable; version mismatch (the message names the expected/reported version and exit code; details.reason also keeps the tool's stderr)
LLDB call observation LLDB from Xcode/CLT unavailable
native macOS tools <tool> unavailable through xcrun

After the change, on macOS:

inspect-binary-layout      → "The initial real-verified pwntools artifact profile supports Linux x64 only."
inspect-evm-interface      → "Initial real-verified offline EVM interface profile supports Linux x64 only."
recover-javascript-sources → "Provide an absolute REA_WAKARU_COMMAND pointing to Wakaru 1.13.0 on Linux x64; no tool is installed by REA"
extract-firmware           → "This integration requires Linux and an absolute REA_UNBLOB_COMMAND path to the caller-supplied tool"

Refusals that really are about the target (for example "Active artifact is not Mach-O", "requires a PE target") keep the generic target-oriented message.

Verification

  • New or extended assertions in 7 test files. All 7 fail on main and pass here:
    • src/firmware/FirmwareCommand.test.ts, src/javascript/recovery/WakaruCommand.test.ts: unconfigured refusal (runs on every host)
    • tests/boundary/browser/historicalWebCapture.test.ts: CLI mitmproxy refusal names REA_MITMDUMP_COMMAND (every host)
    • tests/boundary/providers/native/nativeProvider.test.ts, tests/boundary/providers/native/lldbCallTracerFailures.test.ts: xcrun and LLDB unavailable
    • tests/boundary/binaryDiagnostics/pwntoolsLayoutProvider.test.ts, tests/boundary/evm/evmoleInterfaceProvider.test.ts: host refusal (non-Linux-x64 hosts, e.g. the macOS job)
  • Related MCP, boundary and acceptance suites for these tools: 15 files, 82 passed, 26 skipped (host-gated).
  • npm run check:fast and npm run check:changed passed.
  • Real CLI output on macOS shown above.

No Hopper or Ghidra verification was needed; neither provider is involved. The Linux-only adapters were not exercised with real tools here. Their refusal paths are covered by the tests above.

🤖 Generated with Claude Code

Host and tool-configuration refusals from the pwntools, EVMole, firmware,
mitmproxy, Wakaru, LLDB and xcrun adapters carried no userMessage, so CLI
and MCP callers saw the generic "This analysis is unavailable for the
current target. Choose another analysis or target." as both message and
remediation. Choosing another target cannot satisfy a Linux-only profile
or an unset REA_*_COMMAND. The actual requirement appeared only in
details.reason.

Pass each refusal's reason as its userMessage, as the adapters' other
configuration refusals (EVMole limits, JADX, pwndbg) already do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

The version-mismatch reason ends with the tool's complete stderr, which
is too long for a caller-facing message. The message now names the
expected and reported version and exit code; details.reason keeps the
stderr.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kaoru0822-kitauji
kaoru0822-kitauji merged commit 68cb02f into main Oct 9, 2026
28 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/adapter-host-refusal-messages branch October 9, 2026 08:33
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
…-messages

fix: name host and tool requirements in optional adapter refusals
morluto pushed a commit that referenced this pull request Oct 11, 2026
A missing apktool launcher projected the generic "unavailable for the
current target" message and remediation, leaving the actual reason only
in details.reason. A relative REA_APKTOOL_COMMAND escaped as UNKNOWN
because command selection ran before the try that maps configuration
failures.

Resolve the selection inside that try for both execution and
availability, and pass the refusal reason as userMessage, as JADX and
the adapters fixed in #1224 do.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@morluto morluto added the bug Something isn't working label Oct 14, 2026
Iyanuoluwa007 pushed a commit to Iyanuoluwa007/rea that referenced this pull request Oct 21, 2026
A missing apktool launcher projected the generic "unavailable for the
current target" message and remediation, leaving the actual reason only
in details.reason. A relative REA_APKTOOL_COMMAND escaped as UNKNOWN
because command selection ran before the try that maps configuration
failures.

Resolve the selection inside that try for both execution and
availability, and pass the refusal reason as userMessage, as JADX and
the adapters fixed in morluto#1224 do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants