Repository navigation
Conversation
Setup built the agent MCP registration environment only from doctor provider inspections, but no JADX inspection existed: only Ghidra and IDA published one. A validated REA_JADX_MCP_JAR was therefore dropped, and agent sessions launched without the variable got capability_unavailable on Android tools. Add an inspectJadxProvider inspection that reuses the existing JADX configuration checks (inspectJadxAvailability) and publishes REA_JADX_MCP_JAR as registration environment only when the configured JAR validates. Wire it into the system doctor host alongside the Ghidra and IDA inspections. Fixes morluto#2944
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4365ed80f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| available, | ||
| providerVersion: null, | ||
| registrationEnvironment: | ||
| jarPath === undefined ? {} : { REA_JADX_MCP_JAR: jarPath }, |
There was a problem hiding this comment.
Persist the selected JDK with the JADX JAR
When a new registration uses only JADX and the JDK is available only through an explicit JAVA_HOME, this inspection successfully validates that JDK but emits just the JAR. systemSetupHost constructs the discovered client overrides from these registrationEnvironment maps, while clientConfigurationDesired deliberately does not copy the setup process's ambient environment, so an agent started outside that shell falls back to java on its own PATH and fails with runtime_missing; persist the selected JAVA_HOME along with the JAR.
AGENTS.md reference: AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
| available, | ||
| providerVersion: null, | ||
| registrationEnvironment: | ||
| jarPath === undefined ? {} : { REA_JADX_MCP_JAR: jarPath }, |
There was a problem hiding this comment.
Preserve the selected JAR path in registrations
When the caller supplies an absolute symlink such as /opt/jadx/current.jar, jarPath is the canonical real path because resolveJar() resolves it before putting it in diagnostics. Persisting that value here replaces the caller's stable selected path with its current target, so rotating the symlink later leaves every client pinned to the stale or deleted JAR until setup is rerun; retain the canonical path as validation evidence but store the original validated environment value in the registration.
AGENTS.md reference: AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
| availability.status === "available" | ||
| ? "Validated JADX configuration reported no JAR path." | ||
| : availability.reason, | ||
| remediation: JADX_JAR_CONFIGURATION_REMEDIATION, |
There was a problem hiding this comment.
Match remediation to the JADX failure
When the configured JAR fails because the JDK is missing (runtime_missing), the platform is unsupported (unsupported_host), or JAVA_HOME/JVM settings are invalid (open_options_invalid), this still sets the remediation to only “Set REA_JADX_MCP_JAR”. providerDoctorChecks() forwards that value unchanged as the failed doctor check's action, so a structured consumer receives remediation that cannot resolve the reported condition; select it from the failure code or reason instead.
Useful? React with 👍 / 👎.
…ations - Publish JAVA_HOME alongside REA_JADX_MCP_JAR so jadx-only registrations keep the validated JDK (mirrors GhidraDoctor). - Preserve the caller-selected REA_JADX_MCP_JAR value instead of the resolved real path so stable symlinks survive registration. - Select remediation by failure code: Java selection failures get JDK guidance; unsupported_host relies on its reason text.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b12d25cb3f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| : { | ||
| REA_JADX_MCP_JAR: configuredJar, | ||
| ...(environment.JAVA_HOME === undefined | ||
| ? {} | ||
| : { JAVA_HOME: environment.JAVA_HOME }), |
There was a problem hiding this comment.
Carry validated JADX resource overrides into registrations
When rea setup is launched with a valid REA_JADX_HEAP_MIB or REA_JADX_ACTIVE_PROCESSOR_COUNT, inspectJadxAvailability() validates those values in resolveJvmArguments(), but this newly published map carries only the JAR and JAVA_HOME. systemSetupHost() uses this map as the detected registration overrides and clientConfigurationDesired() intentionally does not copy ambient variables, so a newly launched MCP server silently falls back to default heap/CPU settings; this can reintroduce OOMs or remove a caller's CPU bound for Android analyses. Persist both validated overrides when present.
AGENTS.md reference: AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
| code === "runtime_missing" || code === "open_options_invalid" | ||
| ? JADX_JAVA_RUNTIME_REMEDIATION | ||
| : code === "unsupported_host" | ||
| ? null | ||
| : JADX_JAR_CONFIGURATION_REMEDIATION, |
There was a problem hiding this comment.
Derive remediation from the failing phase
Fresh evidence after the earlier remediation review is that this new dispatch still assumes each code has a single cause: resolveJvmArguments() returns open_options_invalid for malformed heap/CPU overrides, so it now advises changing the JDK, while inspectJavaRuntime() returns unsupported_version for JDK <17, which falls through to the JAR action; on unsupported hosts it emits no action at all even though failed doctor checks promise one. providerDoctorChecks() forwards these values unchanged, leaving structured consumers with remediation that cannot fix the reported condition. Select remediation from the producer/diagnostic phase and keep a non-null unsupported-host action.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2153ef7986
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| providerInspections: async () => [ | ||
| await inspectSystemGhidraProvider(environment), | ||
| inspectIdaRegistration(environment.REA_IDA_MCP_CONFIG), | ||
| await inspectJadxProvider(environment), |
There was a problem hiding this comment.
Expose JADX through the doctor provider selector
When a user runs rea doctor --provider jadx, setupCommands validates the option with z.enum(DOCTOR_PROVIDER_IDS), but src/application/DoctorProviderIds.ts:2 still lists only hopper, ghidra, and ida. The command is therefore rejected before this newly composed inspection runs, so JADX appears in audit-wide reports but cannot be selected as an explicit readiness scope; add jadx to that provider-ID boundary.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| diagnostics: Readonly<Record<string, JsonValue>>, | ||
| ): string | null => { | ||
| if (code === "unsupported_host") return JADX_UNSUPPORTED_HOST_REMEDIATION; | ||
| if (code === "runtime_missing") return JADX_JAVA_RUNTIME_REMEDIATION; |
There was a problem hiding this comment.
Route Windows ownership failures away from JDK guidance
Fresh evidence after the earlier remediation review is that on Windows x64, requireSupportedHost() emits runtime_missing with phase: "process-ownership" when the native artifact is missing, mismatched, or lacks owned protocol stdin. This unconditional branch then reports the Java-runtime action, so structured doctor output tells users to change JAVA_HOME even though the failure occurred before Java selection; preserve a native-package remediation for this producer phase.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
| return diagnostics["phase"] === "jar-inspection" | ||
| ? JADX_JAR_CONFIGURATION_REMEDIATION | ||
| : JADX_JAVA_RUNTIME_REMEDIATION; | ||
| return JADX_JAR_CONFIGURATION_REMEDIATION; |
There was a problem hiding this comment.
Route unresolved Java probes away from JAR guidance
Fresh evidence after the earlier remediation review is that Java output-limit, timeout, and unparseable-version paths all emit version_unresolved with phase: "module-inspection". Because this code has no branch here, it falls through to the JAR action, so rea doctor advises replacing a valid JADX JAR even though archive inspection never ran; route module-inspection failures to a Java/launcher remediation while retaining the JAR action for jar-inspection.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
… provider scope The phase-aware remediation dispatch still assumed each failure code has a single cause: - On Windows x64, requireSupportedHost() throws runtime_missing with phase "process-ownership" when the bundled native artifact cannot take process ownership; the unconditional branch told users to select a JDK, which cannot fix a native backend. Discriminate on the phase and report the Windows x64 REA package guidance instead. - Java output-limit, timeout, and unparseable-version probes throw version_unresolved with phase "module-inspection"; the fall-through told users to replace a valid JADX JAR even though archive inspection never ran. Route module-inspection failures to Java launcher guidance and keep JAR guidance for jar-inspection. Also expose JADX through the doctor provider selector: rea doctor --provider jadx was rejected because DOCTOR_PROVIDER_IDS listed only hopper, ghidra, and ida, even though the jadx inspection is composed into the system doctor host.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca7a122b8e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (code === "unsupported_host") return JADX_UNSUPPORTED_HOST_REMEDIATION; | ||
| if (code === "runtime_missing") | ||
| return diagnostics["phase"] === "process-ownership" | ||
| ? JADX_WINDOWS_NATIVE_REMEDIATION | ||
| : JADX_JAVA_RUNTIME_REMEDIATION; |
There was a problem hiding this comment.
Tag failure phases at the JADX configuration boundary
Fresh evidence after the earlier remediation fixes is that selectRemediation() now repairs the overloaded availability codes by reinterpreting magic phase and setting values from a loose diagnostics map. This makes both JadxConfiguration and the doctor adapter owners of the same failure semantics—the process-ownership path gets a native action here but is still classified as a generic missing dependency above—and any new producer branch can silently fall through to JAR guidance; return a tagged failure kind with its remediation and classification from the configuration boundary and project that typed fact here instead.
AGENTS.md reference: AGENTS.md:L23-L23
Useful? React with 👍 / 👎.
Route the doctor remediation and classification through a failure kind tagged where each JADX configuration failure is produced, instead of reinterpreting the loose phase/setting diagnostics in the doctor adapter. The Windows process-ownership failure is now classified as unsupported_host rather than a generic missing dependency, and new producer branches must tag a kind (the compiler enforces it) instead of silently falling through to JAR guidance.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e15d265a10
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| case "java_runtime": | ||
| return { | ||
| remediation: JADX_JAVA_RUNTIME_REMEDIATION, | ||
| classification: "missing_dependency", | ||
| }; |
There was a problem hiding this comment.
Classify malformed JAVA_HOME as configuration drift
When JAVA_HOME is relative or empty, resolveJava() returns open_options_invalid but assigns the new java_runtime tag, and this branch maps every such tag to missing_dependency. This is a new regression from the tag refactor: an installed JDK with a malformed selection should remain config_drift (as the previous code's non-runtime_missing mapping did), otherwise structured doctor consumers get the wrong failure class; split the tag or carry the producer-owned classification.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
| const outcome = projectJadxFailureOutcome( | ||
| availability.status === "unavailable" | ||
| ? asFailureKind(availability.diagnostics["failure_kind"]) | ||
| : null, |
There was a problem hiding this comment.
Preserve Java probe diagnostics in doctor output
When java --list-modules is unparseable, times out, or exceeds its output budget, inspectJadxAvailability() retains the selected executable, stdout/stderr, truncation state, and probe metadata in availability.diagnostics, but this projection reads only failure_kind and drops the rest. Consequently rea doctor --provider jadx --json can say that partial output was retained or ask the user to inspect launcher output while exposing none of it; carry these bounded diagnostics through the provider check/report (for example via structured details).
AGENTS.md reference: AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e10147de61
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| execFileOutputFailure, | ||
| } from "../process/ExecFileOutput.js"; | ||
| import { JADX_JAR_CONFIGURATION_REMEDIATION } from "./JadxRelease.js"; | ||
| import type { DoctorProviderCheck } from "../application/Doctor.js"; |
There was a problem hiding this comment.
Keep doctor classifications out of the JADX boundary
Fresh evidence after the tagged-failure refactor is that JadxConfiguration, which is used by normal Android execution as well as doctor, now imports the outer DoctorProviderCheck application contract and owns doctor-specific classifications and remediation. This reverses the documented application-to-Android provider dependency and forces execution configuration to change with doctor taxonomy; keep the typed producer failure in the provider layer, but define its outcome in a neutral inward contract or project the Doctor shape in the outer adapter without importing the shared workflow here.
AGENTS.md reference: AGENTS.md:L17-L17
Useful? React with 👍 / 👎.
| case "java_runtime": | ||
| return { | ||
| remediation: JADX_JAVA_RUNTIME_REMEDIATION, | ||
| classification: "missing_dependency", |
There was a problem hiding this comment.
Classify an outdated selected JDK as configuration drift
When JAVA_HOME selects a runnable full JDK 11, inspectJavaRuntime() emits unsupported_version but tags it java_runtime, so this branch reports missing_dependency; only actually absent or unrunnable Java should use that class, while an explicitly selected incompatible version is config_drift (the same distinction used by the existing Ghidra doctor). Structured doctor consumers therefore receive the wrong failure class; add an unsupported-JDK kind/outcome or carry the producer-owned classification.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
| ...(kind === "java_probe" && availability.status === "unavailable" | ||
| ? { details: probeDetails(availability.diagnostics) } | ||
| : {}), |
There was a problem hiding this comment.
Preserve all bounded Java probe evidence
When java --list-modules is unparseable, times out, exceeds its output budget, lacks jdk.compiler, or reports JDK <17, inspectJavaRuntime() retains bounded stdout/stderr plus partial compiler/version facts. Fresh evidence after the earlier diagnostics review is that this new gate emits details only for java_probe, and probeDetails() still omits stdout/stderr, so rea doctor --provider jadx --json either loses all details for java_runtime or claims output was retained without exposing it; project bounded probe evidence for both failure kinds and include the captured output or an explicitly bounded useful excerpt.
AGENTS.md reference: AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
| @@ -1,2 +1,2 @@ | |||
| /** Deep-analysis providers whose readiness can be selected explicitly by doctor. */ | |||
| export const DOCTOR_PROVIDER_IDS = ["hopper", "ghidra", "ida"] as const; | |||
| export const DOCTOR_PROVIDER_IDS = ["hopper", "ghidra", "ida", "jadx"] as const; | |||
There was a problem hiding this comment.
Document the JADX setup and readiness path
When users follow the canonical setup/readiness docs, a repo-wide search finds no rea doctor --provider jadx example: docs/installation.md:44 mentions saved Ghidra paths but not JADX, its line 144 still lists only Hopper/Ghidra/IDA, and docs/android-analysis.md:38-45 only tells users to edit the shell or MCP environment. The new automatic setup propagation and scoped readiness check are therefore undiscoverable from the repository-owned provider guides; update the Android and installation guides alongside this provider-ID addition.
AGENTS.md reference: AGENTS.md:L5-L5
Useful? React with 👍 / 👎.
Keep layered environment choices, current byte-exact recovery snapshots, and package-manager failure details. Report pinned package drift without claiming runner resolution. Retain failed Linux installer cleanup for host-owned retry while preserving the install outcome. Reviewed fixes include #2632, #2769, #2783, #2959, #2979, #2983, #2995, #3009, and #2559. Validation: 98 focused setup/registration tests passed; 45 Linux installer tests passed. Real Linux package installation remains unverified.
|
CI-fix track: this change is already on main. ec56c1d lists #2983 among its reviewed fixes. After merging current main and resolving the three conflicts ( |
|
Closing this one out — morluto's ec56c1d landed the JADX doctor fix on main and lists this PR among the reviewed fixes, so there's nothing left for this branch to do. Thanks to @kaoru0822-kitauji for flagging it, and to everyone who reviewed along the way. |
With
REA_JADX_MCP_JARset in the shell,rea setupwrote onlyGHIDRA_INSTALL_DIR/JAVA_HOMEinto the agent MCP registration. Any agent session started without the variable then hitcapability_unavailableon the Android tools.Root cause: the registration environment is built only from
DoctorProviderInspection.registrationEnvironment(seeSetupRegistrationEnvironment.ts), and the system doctor host composed inspections for Ghidra and IDA only. There was no JADX inspection, so a validated JAR path had no route into the registration.This adds one, following the Ghidra/IDA pattern:
src/android/JadxDoctor.ts(new):inspectJadxProvider()runs the existinginspectJadxAvailability()checks and projects the result into the doctor contract.REA_JADX_MCP_JARis published as registration environment only when the configured JAR validates (the canonicalized real path, not the raw env var); otherwise nothing is published and theconfigurationcheck reports the failure with the repo's classification taxonomy (missing_analysis_engine,config_drift,missing_dependency,unsupported_host).src/doctorRuntime.ts: the inspection is wired intocreateSystemDoctorHost'sproviderInspectionsnext to Ghidra and IDA.Verified with TDD. The composition test failed before the fix (
expected [ 'ghidra', 'ida' ] to include 'jadx'), then went green with it. New tests: 4 unit cases intests/boundary/android/jadxDoctor.test.ts(valid JAR publishes the var, unset var publishes nothing, invalid JAR publishes nothing, missing JDK classified asmissing_dependency) and 2 composition cases insrc/doctorRuntime.test.ts(validated var carried intoproviderRegistrationEnvironment, absent when unconfigured).Broader suites: 90 passed, 1 skipped (pre-existing platform-conditional skip), across the android boundary tests, setup planning, and the Ghidra/IDA/doctor tests.
npm run check:fast(typecheck + lint),npm run verify:test-discovery(1114 test files),npm run verify:package, andnpm pack --dry-runall pass.Fixes #2944