[PR #1224] [MERGED] fix: name host and tool requirements in optional adapter refusals #2737

Closed
opened 2026-10-17 21:09:40 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1224
Author: @kaoru0822-kitauji
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/adapter-host-refusal-messages


📝 Commits (2)

  • 170d0bf fix: name host and tool requirements in optional adapter refusals
  • 6489d58 fix(javascript): keep Wakaru version stderr out of the refusal message

📊 Changes

16 files changed (+146 additions, -31 deletions)

View changed files

📝 src/browser/history/MitmproxyCaptureAdapter.ts (+7 -3)
📝 src/evm/EvmoleInterfaceProvider.ts (+4 -1)
📝 src/firmware/FirmwareCommand.test.ts (+22 -0)
📝 src/firmware/FirmwareCommand.ts (+15 -5)
📝 src/firmware/FirmwareProvider.ts (+3 -3)
📝 src/javascript/recovery/WakaruCommand.test.ts (+22 -1)
📝 src/javascript/recovery/WakaruCommand.ts (+9 -7)
📝 src/javascript/recovery/WakaruExecution.ts (+6 -2)
📝 src/native/LldbCallTracer.ts (+4 -1)
📝 src/native/NativeMacOSProvider.ts (+5 -3)
📝 src/native/pwntools/PwntoolsDecoder.ts (+5 -1)
📝 tests/boundary/binaryDiagnostics/pwntoolsLayoutProvider.test.ts (+9 -3)
📝 tests/boundary/browser/historicalWebCapture.test.ts (+1 -0)
📝 tests/boundary/evm/evmoleInterfaceProvider.test.ts (+15 -0)
📝 tests/boundary/providers/native/lldbCallTracerFailures.test.ts (+15 -1)
📝 tests/boundary/providers/native/nativeProvider.test.ts (+4 -0)

📄 Description

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 6c13fc8e 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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1224 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/adapter-host-refusal-messages` --- ### 📝 Commits (2) - [`170d0bf`](https://github.com/morluto/rea/commit/170d0bf9e2d45b2512ad556c02f31bdc81ea03ca) fix: name host and tool requirements in optional adapter refusals - [`6489d58`](https://github.com/morluto/rea/commit/6489d58851d055fd7ce621000d960bb42a0e4ce0) fix(javascript): keep Wakaru version stderr out of the refusal message ### 📊 Changes **16 files changed** (+146 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `src/browser/history/MitmproxyCaptureAdapter.ts` (+7 -3) 📝 `src/evm/EvmoleInterfaceProvider.ts` (+4 -1) 📝 `src/firmware/FirmwareCommand.test.ts` (+22 -0) 📝 `src/firmware/FirmwareCommand.ts` (+15 -5) 📝 `src/firmware/FirmwareProvider.ts` (+3 -3) 📝 `src/javascript/recovery/WakaruCommand.test.ts` (+22 -1) 📝 `src/javascript/recovery/WakaruCommand.ts` (+9 -7) 📝 `src/javascript/recovery/WakaruExecution.ts` (+6 -2) 📝 `src/native/LldbCallTracer.ts` (+4 -1) 📝 `src/native/NativeMacOSProvider.ts` (+5 -3) 📝 `src/native/pwntools/PwntoolsDecoder.ts` (+5 -1) 📝 `tests/boundary/binaryDiagnostics/pwntoolsLayoutProvider.test.ts` (+9 -3) 📝 `tests/boundary/browser/historicalWebCapture.test.ts` (+1 -0) 📝 `tests/boundary/evm/evmoleInterfaceProvider.test.ts` (+15 -0) 📝 `tests/boundary/providers/native/lldbCallTracerFailures.test.ts` (+15 -1) 📝 `tests/boundary/providers/native/nativeProvider.test.ts` (+4 -0) </details> ### 📄 Description ## 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 `AnalysisCapabilityUnavailableError`s 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 6c13fc8e 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](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:40 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2737
No description provided.