Skip to content

fix(discovery): carry provider repair instructions into capability discovery - #8532

Merged
kaoru0822-kitauji merged 2 commits into
mainfrom
fix/8506-capability-remediation
Nov 1, 2026
Merged

kaoru0822-kitauji merged 2 commits into
mainfrom
fix/8506-capability-remediation

Conversation

@kaoru0822-kitauji

@kaoru0822-kitauji kaoru0822-kitauji commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

What broke: Capability discovery (binary_session.tool_availability) put each provider's failure description in remediation and dropped the repair the owner already had (JEB discovery deadline setting, ADB/Apktool execute-permission repair, IDA and Kuna configuration recovery).
Fix: Unavailable ProviderAvailability now requires the owner's remediation next to reason. Readiness-derived unavailable capability descriptors and provider-selection rejections carry it too. The inventory uses it verbatim, and an explicit selection of an unready provider returns it as remediation.action.
Risk: Additive output change: complete candidate availability and unavailable capability groups gain remediation, summary lists it in omitted_fields, and the superseded IDA configuration_remediation and windows_native_failure.remediation diagnostics are removed. Reason texts are unchanged except JEB's connection reason, which no longer embeds the repair.

Summary

Fixes #8506. Also covers the Kuna configuration case confirmed in the issue comment.

Before this change, the shared availability contract (ProviderAvailability) had only status/code/reason/diagnostics, so the capability inventory used reason (what failed) as remediation (what to do). Owners that had a repair either dropped it (JEB, Kuna) or kept it in free-form diagnostics that the inventory ignored (ADB, Apktool, IDA). Now the repair has one first-class slot that every readiness producer fills, and discovery, doctor and CLI/MCP output read that slot.

Problem and expected behavior

  • JEB: a real REA_JEB_MCP_TIMEOUT_MS discovery deadline gave remediation: "This request reached REA's configured JEB catalog discovery deadline of 100 ms (deadlineExpired).". It now gives the deadline owner's action, Increase REA_JEB_MCP_TIMEOUT_MS in REA's launch environment … restart and reconnect REA to apply it. …. Caller cancellation still throws instead of reporting unavailability (unchanged).
  • ADB/Apktool: a mode-0600 selection gave "Execution of the selected … was denied". It now gives Check file type and execute permission for REA_ADB_PATH or select an executable adb binary. (and the Apktool equivalent). A missing selection gets the different "existing binary" repair.
  • IDA: an unreadable REA_IDA_MCP_CONFIG now carries Correct REA_IDA_MCP_CONFIG in the environment that starts REA (your shell or the MCP client's registration), then rerun. to the availability and to every operation it makes unavailable.
  • Kuna: invalid REA_KUNA_JOBS / REA_KUNA_TIMEOUT_MS / REA_KUNA_CACHE_DIR now reaches discovery with the configuration owner's Correct … or unset it to use its default. Restart REA after changing the environment., the same text the doctor already reported.

Change and scope

  • Contract (src/application/AnalysisProvider.ts): unavailable ProviderAvailability requires remediation; unavailable CapabilityDescriptor has optional remediation for readiness-derived refusals (static capability facts declare none).
  • Producers: ADB/Apktool failures own remediation as a constructor field (exported owner constants) instead of diagnostics.remediation. Their execution refusal keeps its previous message-plus-repair recovery. The pcap limiter refusal now carries a typed remediationAction, which readiness keeps ahead of the Wireshark fallback. JADX derives remediation from its tagged failure kind; JEB uses the failure's projected action (deadline owner) or the connection remediation; IDA, Kuna, Ghidra, Hopper, pcap, owned-process prerequisites, profile rejection and the missing-Android fallback each supply theirs. IDA, Kuna and Ghidra (Windows readiness and Windows existing-project maps) mark readiness-gated operations with the same reason, code and remediation.
  • Selection: ProviderSelectionRejection carries the availability owner's remediation, and CLI/MCP error details project it. A provider_unavailable selection of a concrete provider uses that repair as remediation.action; refusal-supplied recovery still wins, and auto keeps the generic advice.
  • Consumers: CapabilityInventory reads remediation from owner probes (ADB, Apktool, JEB, Android, EVM) and from descriptors, falling back to reason only when a static descriptor has no repair. JADX doctor reads the availability's remediation instead of re-deriving it (an untagged owned-process failure now gets the procps repair instead of JAR guidance). BinarySessionStatus groups descriptors by remediation too, and a runtime unavailability replaces an earlier repair rather than keeping it.
  • Not included: [Bug] EVM limiter configuration failures expose internal codes as recovery guidance #8508 (EVM limiter readable recovery) already has an open PR, fix(evm): explain limiter configuration and access failures #8521, so the EVM owner only passes its current reason through as remediation here (marked with a comment). [Bug] Firmware capability recovery recommends the wrong alternative engine #8507 (firmware engine selection) has a different cause and its own PR, fix(firmware): recommend the operation-specific engine #8513. Some deep-provider reasons still embed their repair (Ghidra installation reason equals its remediation, Kuna not_configured, owned-process), so complete detail repeats that text. Splitting them would change summary output, so it is left as follow-up.
  • Contribution scope: ordinary recovery/discovery fix within existing provider boundaries. A maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: each provider's readiness owner (configuration/deadline/installation) produces remediation. The shared ProviderAvailability / CapabilityDescriptor / ProviderSelectionRejection contracts carry it. CapabilityInventory, BinarySessionStatus, ProviderSelectionError, the error projection, JadxDoctor and providerConfigurationRefusal consume it. The superseded diagnostics copies are removed: ADB/Apktool diagnostics.remediation, IDA configuration_remediation, and IDA/Ghidra windows_native_failure.remediation.
  • Contribution scope fit and linked maintainer decision: not applicable (fix within existing boundaries).
  • CLI and MCP/tool-catalog contract: binary_session output schema adds remediation to complete unavailable candidate availability and an optional remediation to unavailable capability groups. omitted_fields adds analysis_provider_candidates.availability.remediation, and the detail input description is updated. CLI capabilities/providers share the same status projection. Tool-availability semantics are unchanged except that remediation text is now the owner's repair.
  • Provider, bridge, target-format, or platform compatibility: no change to admission, selection or execution. Windows readiness diagnostics keep windows_native_failure.stage.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: none. No new probes, launches or retries.
  • Generated metadata: tool catalog digest changes (CI regenerates ignored catalogs). Authored skill text in .agents/skills/reverse-engineer-anything/ mentions the complete-detail remediation.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

(Existing readiness probes are unchanged; this changes only what they report.)

Evidence and regression coverage

  • Tests added or updated:
    • tests/boundary/mcp/capabilityRemediationMcp.test.ts (new, production MCP composition): real JEB discovery deadline against the HTTP JEB fixture (REA_JEB_MCP_TIMEOUT_MS=100, hanging catalog), plus real ADB/Apktool readiness probes against mode-0600 and missing selections, checked through final tool_availability.
    • tests/boundary/providers/readinessRemediationInventory.test.ts (new): an unreadable IDA registration through inspectReadinessSnapshot → providerCapabilitySets → inventory for analyze_function/procedure_pseudo_code. Kuna REA_KUNA_JOBS=33, REA_KUNA_TIMEOUT_MS=0 and REA_KUNA_CACHE_DIR=relative go through the same projection, with the doctor (inspectKunaProvider) as the matching control. A controlled open-target status exercises only the final projection, as in the issue.
    • Explicit selection: the MCP open_binary (provider_id: "ida") and compiled-CLI decompile … --provider ida --json tests (tests/boundary/cli/providerSelectionRemediationCli.test.ts) compare remediation.action and the rejection's remediation with IDA's readiness output. The Windows Ghidra readiness repair is checked through registry.select plus complete session.status capability groups. The pcap limiter repair is checked at its owner (PcapNativeBound.test.ts) and at Linux-only readiness.
    • src/application/binary/BinarySessionStatus.test.ts: groups split by remediation, runtime unavailability drops a superseded repair, scoped registrations keep it, complete detail keeps candidate remediation and summary omits it.
    • Updated assertions that encoded the old behavior (jebMcp, sessionMcp procps case, JEB/ADB/Apktool/IDA/Ghidra/Hopper provider tests, providerConfigurationRefusal), plus fixture remediation fields.
  • Base reproduction: with only the production src/ files restored to aa48d494e (tests kept), both new boundary files failed all 7 tests: JEB, both ADB/Apktool cases, IDA and all three Kuna settings got the old description-as-remediation. The fix was then restored and git status was clean against the commit.
  • User-visible output (executed, createDirectAnalysis(env).runSessionStatus(), the CLI capabilities implementation, with a missing REA_IDA_MCP_CONFIG and REA_KUNA_JOBS=33):
    ida  | open_options_invalid | REA configuration is invalid: REA_IDA_MCP_CONFIG: Cannot read IDA MCP registration …
       remediation: Correct REA_IDA_MCP_CONFIG in the environment that starts REA (your shell or the MCP client's registration), then rerun.
       procedure_pseudo_code group remediation: (same)
    kuna | open_options_invalid | REA_KUNA_JOBS must be an integer from 1 to 32; received 33.
       remediation: Correct REA_KUNA_JOBS to meet the reported constraint, or unset it to use its default. Restart REA after changing the environment.
       procedure_pseudo_code group remediation: (same)
    
  • Remaining proof gaps: no real JEB/IDA/Kuna/Ghidra/Hopper/ADB/Apktool installation. Windows-only producers (Ghidra/IDA Windows native readiness, Windows PATH lookups) are covered only by existing unit tests. The Linux-only EVM execution tests are skipped on this host. The suggested repairs were not followed and rerun.

Boundary regressions: final discovery output for distinct producer outcomes (timeout, permission denied, missing selection, unreadable registration, invalid settings) with a working doctor comparison, and cancellation still distinct (JEB rethrows on caller abort, unchanged). No lifecycle stages changed.

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Local Node 26.5.0 (CI uses the pinned 24.22.1), Darwin arm64.

  • Follow-up 6413304 (review findings and the CI adbCli failures):
    • The new selection, Ghidra and pcap-owner regressions fail on 146213c and pass now.
    • npm run compile succeeded locally. Against that dist/, the CLI files adbCli, apktoolCli, pcapCli, jebCli, directAnalysisStatus, projectedErrorStatus and providerSelectionRemediationCli pass.
    • doctorHopperDiscovery, idaDoctorRegistration, kunaDoctorIdentity and setupProviderReadiness, plus the doctor step of idaWorkspaceDiscovery, fail only because local Node 26.5.0 is below doctor's supported 26.12.1+. Their discovery steps pass.
    • nativeMachoSummaryMcp passes locally in 5.8 s. Its CI 30 s timeout in the optional Apple lane looks unrelated: this PR only adds optional string fields to the binary_session schema.
  • npm run check:fast — passed (typecheck + lint; no new lint errors; the ADB/Apktool failure constructors add 2 max-params warnings, matching the existing JadxConfigurationFailure shape).
  • npm run format:check — passed.
  • vitest run --maxWorkers=3 over 158 related files (ADB, Apktool, JADX, JEB, IDA, Kuna, pcap, Ghidra, EVM, Hopper, registry/status/inventory, doctor, server, composition, related MCP/provider boundaries, README consistency) on the final commit — 2845 passed, 82 skipped (platform-gated).
  • An earlier run that also included dist-dependent files failed only on tests that need a built dist/ (EVM worker, IDA verifier, ADB CLI). That run also had one load-related failure, pcapProviderCancellation; on rerun it passed 8/8 with this change and on base.
  • tests/conformance/readmeConsistency.test.ts — 9 passed.
  • Not run locally: npm run docs:check and npm run metadata:check. Under Node 26 they crash in stripTypeScriptTypes (mode transform). CI runs them on Node 24.

Compatibility, safety, and release

  • Breaking changes or migration steps: none for inputs. Output is additive except the removed diagnostics copies. Read availability.remediation instead of diagnostics.configuration_remediation (IDA) or diagnostics.windows_native_failure.remediation (IDA/Ghidra on Windows).
  • Real Hopper/Ghidra, browser, or OS coverage: none. All coverage used fixtures, the HTTP JEB fixture, and temporary files.
  • Package or release metadata impact: tool catalog digest changes with the binary_session schema.
  • Security, privacy, process, or containment review: no new process, network or filesystem effects. Remediation texts name settings and caller-selected paths that already appear in reasons.

Author readiness

Human owner: @kaoru0822-kitauji

  • 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.

🤖 Generated with Claude Code

…scovery

Provider readiness reported only a failure description, so capability
discovery copied that description into tool_availability remediation and
dropped repairs the owners already had: the JEB discovery-deadline setting,
the ADB/Apktool execute-permission repair kept in diagnostics, and the IDA
and Kuna configuration recovery.

Unavailable ProviderAvailability now requires the owner's remediation
next to its reason, and readiness-derived unavailable capability
descriptors carry it too. Every producer supplies it (ADB, Apktool, JADX,
JEB, Ghidra, Hopper, IDA, Kuna, pcap, owned-process prerequisites, profile
rejection); the inventory uses it verbatim, falling back to the reason
only for static capability facts that declare no repair. ADB/Apktool
configuration failures own remediation as a field instead of diagnostics,
and execution refusals project it as remediation.action. JADX doctor reads
the availability's remediation instead of re-deriving it.

binary_session complete candidate availability and unavailable capability
groups expose remediation (CLI capabilities/providers too); summary omits
it and lists it in omitted_fields. The superseded IDA
configuration_remediation and windows_native_failure.remediation
diagnostics are removed.

Fixes #8506

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kaoru0822-kitauji kaoru0822-kitauji added bug Something isn't working track:bugs Small-bug loop track PRs labels Nov 1, 2026
@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-01T15:32:34.157120Z 6413304 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 146213c91f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ida/IdaProvider.ts Resolved
@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The reporting changes appear safe to merge; all three earlier findings are fixed.

Summary

Adds owner-authored remediation to provider readiness and carries it through capability discovery and provider-selection errors.

  • Capability discovery carries provider repairs to unavailable tools and operations.
  • Provider readiness checks supply their own repair instructions.
  • Provider-selection errors and the JADX doctor use owner-supplied repairs.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Owner["Provider readiness owner"] --> Availability["Unavailable provider + repair"]
  Owner --> Operations["Unavailable operations + repair"]
  Availability --> Candidates["Complete provider candidates"]
  Availability --> Selection["Explicit selection errors"]
  Availability --> Inventory["Tool availability"]
  Operations --> Groups["Session capability groups"]
  Groups --> Inventory
Loading

Reviews (2) · Last reviewed commit: "fix(discovery): keep owner repairs throu..." · Reviewed by Greptile

Comment thread src/ghidra/GhidraProvider.ts Resolved
Comment thread src/pcap/PcapProvider.ts Resolved
…ability maps

Address review findings on the readiness-remediation contract:

- Provider selection rejections carry the availability owner's
  remediation, CLI/MCP error details project it, and an explicit
  selection refused by readiness uses it as remediation.action. IDA's
  unreadable registration and Ghidra's Windows readiness repair no
  longer degrade to generic selection advice now that the diagnostics
  copies are gone.
- Ghidra's Windows readiness and existing-project capability maps carry
  the same repair as the availability.
- pcap readiness keeps the limiter owner's repair (now a typed
  remediationAction) and falls back to Wireshark guidance only when the
  failure has none.
- ADB/Apktool repairs are owner constants that are complete sentences.
  The execution refusal keeps its previous message-plus-repair recovery,
  which the compiled CLI contract asserts.
- Regression tests compare with the owning formatter or constant and
  add public MCP and CLI coverage for an explicit IDA selection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kaoru0822-kitauji
kaoru0822-kitauji merged commit cbc6953 into main Nov 1, 2026
55 of 57 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/8506-capability-remediation branch November 1, 2026 16:57
coyoteXujie pushed a commit to coyoteXujie/rea that referenced this pull request Nov 2, 2026
…scovery (morluto#8532)

* fix(discovery): carry provider repair instructions into capability discovery

Provider readiness reported only a failure description, so capability
discovery copied that description into tool_availability remediation and
dropped repairs the owners already had: the JEB discovery-deadline setting,
the ADB/Apktool execute-permission repair kept in diagnostics, and the IDA
and Kuna configuration recovery.

Unavailable ProviderAvailability now requires the owner's remediation
next to its reason, and readiness-derived unavailable capability
descriptors carry it too. Every producer supplies it (ADB, Apktool, JADX,
JEB, Ghidra, Hopper, IDA, Kuna, pcap, owned-process prerequisites, profile
rejection); the inventory uses it verbatim, falling back to the reason
only for static capability facts that declare no repair. ADB/Apktool
configuration failures own remediation as a field instead of diagnostics,
and execution refusals project it as remediation.action. JADX doctor reads
the availability's remediation instead of re-deriving it.

binary_session complete candidate availability and unavailable capability
groups expose remediation (CLI capabilities/providers too); summary omits
it and lists it in omitted_fields. The superseded IDA
configuration_remediation and windows_native_failure.remediation
diagnostics are removed.

Fixes morluto#8506

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(discovery): keep owner repairs through provider selection and capability maps

Address review findings on the readiness-remediation contract:

- Provider selection rejections carry the availability owner's
  remediation, CLI/MCP error details project it, and an explicit
  selection refused by readiness uses it as remediation.action. IDA's
  unreadable registration and Ghidra's Windows readiness repair no
  longer degrade to generic selection advice now that the diagnostics
  copies are gone.
- Ghidra's Windows readiness and existing-project capability maps carry
  the same repair as the availability.
- pcap readiness keeps the limiter owner's repair (now a typed
  remediationAction) and falls back to Wireshark guidance only when the
  failure has none.
- ADB/Apktool repairs are owner constants that are complete sentences.
  The execution refusal keeps its previous message-plus-repair recovery,
  which the compiled CLI contract asserts.
- Regression tests compare with the owning formatter or constant and
  add public MCP and CLI coverage for an explicit IDA selection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
moah0911 added a commit to moah0911/rea that referenced this pull request Nov 6, 2026
…uidance

Resolve conflicts in CapabilityInventory.ts, createServer.ts, and
registerSessionTools.ts.

Main's morluto#8532 made unavailable ProviderAvailability carry the owner's
remediation next to its reason, which is the same provider-ownership rule this
change threads through AndroidAnalysisPort.setupGuidance. The resolutions keep
both: availability remediation is the primary source, provider setup guidance
(with the pinned JAR URL and SHA-256) replaces the two hardcoded literals main
added to the application and server layers, and the reason field keeps
reporting the observation rather than the repair.

Main's morluto#8051 moved session registration into a family callback that already
supplies the availability probes, so the standalone block is dropped in favour
of adding androidSetupGuidance to that callback.

The IDA effects fixture added on main needs setupGuidance to satisfy the
widened AndroidAnalysisPort contract.
moah0911 added a commit to moah0911/rea that referenced this pull request Nov 6, 2026
…superseded

Main's owner-remediation contract already carries the provider's repair
instruction into capability discovery, so the guidance threaded through
AndroidAnalysisPort.setupGuidance, AvailabilityPolicy.androidAnalysisRemediation,
and SessionToolOptions.androidSetupGuidance never reaches a production server:
createServer always supplies an Android availability probe, and the status tool
drops the entries that would read the fallback. JADX_SETUP_GUIDANCE was inert.

Remove that channel and its wrapper, keep the provider-owned string in
JadxRelease and JadxConfiguration, and let the inventory read the availability
remediation the way its adb, apktool, and jeb siblings do.
zw-g added a commit to zw-g/rea that referenced this pull request Nov 8, 2026
main moved docs/native-investigation.md to
docs/guides/native/native-investigation.md (morluto#2791). Git carries this
branch's four-line docs change over to the new path.

main also made `remediation` required on an unavailable
ProviderAvailability (morluto#8532), so the unconfigured symbol provider
fixture in nativeDispatchAvailability.test.ts now sets one. Without it
the merged tree fails `npm run typecheck` (TS2322).

Signed-off-by: Zhaowei Gu <[email protected]>
@morluto morluto added the area: providers Provider and capability discovery, including provider proposal triage label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: providers Provider and capability discovery, including provider proposal triage bug Something isn't working track:bugs Small-bug loop track PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Capability discovery replaces provider recovery actions with failure descriptions

2 participants