#7004

feat(doctor): report the configured workflow beside an audit-wide result

Openakshatggwants to merge intofrom

Summary

Refs #6914. Without a scope option, rea doctor reports healthy: false whenever any detected client or provider is unhealthy, including ones the user never set up (here: IDA, JADX, Kuna, and the Codex, VS Code and Gemini registrations). A working setup then looks broken, and the report does not say which failures matter or how to check only the set-up workflow.

Problem and expected behavior

  • Trigger: run rea doctor with no --client, --provider or --skill on a host where only some clients and providers are set up.
  • Before: healthy: false and environment_healthy: false, with no pointer to the configured workflow's readiness. The scoped mode that answers this already exists, but the user has to know to use it and which IDs to pass.
  • After: the audit-wide report additionally carries configured_scope, with the set-up clients, providers and skill, their readiness under the existing explicit-scope rules, and the exact rea doctor command that reports that scope. healthy, environment_healthy, scope_checks and the exit status are unchanged.

Change and scope

  • src/application/DoctorScope.ts: new configuredDoctorScope, which selects:

    • clients whose registration state is anything except missing or manual (so stale, unknown and invalid registrations stay in, and their failures still count);
    • providers whose inspection reports configured: true, plus Hopper when it is configured or its launcher was discovered (presence, not readiness, so a failing Hopper stays visible);
    • the skill when any selected copy is installed, including a partial install whose aggregate state is missing.

    selectConfiguredDoctorScope picks the clients and providers; configuredDoctorScope builds the explicit scope and reuses scopeDoctorChecks for healthy, so there is no second definition of readiness. Nothing is reported when no client or provider is set up. It reports argv (the exact unquoted arguments, starting with npx -y rea-agents@<version> or bunx rea-agents@<version>, pinned to the running release, when doctor was launched that way, otherwise rea) and command, the same invocation quoted for PowerShell on Windows and POSIX shells elsewhere, quoting only arguments that need it (on Windows that includes a leading @ and any ,, which PowerShell treats as splatting and array syntax).

  • src/application/Doctor.ts: when any client is configured, inspectConfiguredScope reads that client set's skill copies (as the suggested --client … --skill scope does) through inspectSkillIdentity, the helper collectDoctorIdentity now shares, and judges configured_scope from those facts. With no configured client the suggested scope reads every copy, so the audit's facts are reused. The audit's own checks are unchanged. If doctor's final cleanup fails, configured_scope.healthy becomes false with the top-level fields, as the suggested scope would report.

  • DoctorReport.configured_scope? is emitted only when scope.mode === "audit-wide".

  • docs/installation.md: explains why an audit-wide healthy can be false for a working setup and what configured_scope contains.

  • Not included: no change to what healthy means or to the exit status; the issue's discussion suggests keeping both summaries, and this keeps the audit result authoritative. No new CLI flag (the existing --client/--provider/--skill scope already covers the "configured only" check; the report now names it).

Follow the contribution scope. Unresolved scope, authority, side effects, or required verification block integration. Link the required maintainer scope decision for new providers or capabilities involving target execution, injection, mutation, or protection recovery; ordinary fixes within existing boundaries may state "not applicable". Draft PRs may leave the scope decision pending and the readiness and merge checklists unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: doctor scope selection (DoctorScope.ts), consumed by inspectDoctor.
  • Contribution scope fit and linked maintainer decision: usability change within the existing doctor command; not applicable. The issue is labeled as a feature and its exact presentation is open for maintainer preference.
  • CLI and MCP/tool-catalog contract: additive optional configured_scope field on audit-wide doctor reports; no change for explicit-scope reports or to existing fields and exit status. No MCP tool schema change.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): read-only; reuses the facts doctor already collects (registrations, provider inspections, skill state). No new probes.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible.

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

Evidence and regression coverage

  • Tests added or updated: src/application/Doctor.test.ts → "doctor configured scope":

    • a workstation with an aligned cursor registration, missing codex/vscode, configured Ghidra, discovered Hopper and unconfigured IDA/JADX/Kuna: the audit stays healthy: false, configured_scope is {clients: ["cursor"], providers: ["ghidra", "hopper"], skill: true, healthy: true} with the matching command, and running that exact scope also reports healthy: true (and has no configured_scope);
    • a configured but unavailable Ghidra makes configured_scope.healthy false and lists ghidra-java with its remediation in failing_checks; a healthy scope has failing_checks: [];
    • a stale registration stays in the configured clients and fails it;
    • a target path with a space and a quote is shell-quoted in the command; on win32 it is quoted for PowerShell and kept unquoted in argv;
    • a partial skill install (aligned cursor, missing codex copy) keeps --skill and makes the workflow unhealthy;
    • a final cleanup failure (through runDoctorOwned) makes both configured_scope and the suggested scope unhealthy and appears in failing_checks;
    • a package-runner launch keeps the pinned npx -y rea-agents@<version> in argv/command, and systemDoctorHost detects bunx from the environment;
    • on win32, @sample.exe and a,b.exe are quoted while dir/a@b.exe stays bare; on Linux @sample.exe stays bare;
    • a discovered Hopper whose later check fails (Linux hopper-demo-runtime) stays in providers and makes the workflow unhealthy;
    • the skill is judged from the configured clients' copies: with an aligned cursor copy and a stale copy elsewhere, the audit keeps its failing skill:identity check while configured_scope.healthy is true and matches the suggested scope; a stale cursor copy makes it false (review finding);
    • no configured_scope when nothing is set up.
  • Base reproduction or other evidence: on the base revision the four positive tests fail (configured_scope is undefined); the "nothing set up" control passes on both.

  • User-visible CLI/MCP output (if applicable): rea doctor --format json on a real macOS host (one agent client registered, Hopper installed, IDA/JADX/Kuna and other clients not set up), run from this branch's build:

    {"healthy": false, "environment_healthy": false,
     "configured_scope": {"clients": ["<client>"], "providers": ["hopper"], "skill": true,
       "healthy": false, "command": "rea doctor --client <client> --provider hopper --skill",
       "failing_checks": [{"name": "registration:<client>", "ok": false, "classification": "config_drift", …},
                          {"name": "skill:identity", "ok": false, "classification": "config_drift", …}]}}

    (The registered client's ID is replaced with <client> here; everything else is verbatim.)

    Here configured_scope.healthy is false for real reasons rather than the unconfigured components: the development build expects skill version 46 while the installed copy is 42, and the client registration points at the installed 6.7.0 rather than this checkout. Running the printed command reports exactly those two failures (registration:<client>, skill:identity). The installed 6.7.0 on the same host reports the same healthy/environment_healthy without configured_scope.

  • Remaining proof gaps: not run on Linux or Windows hosts; Windows quoting is covered by a unit test only, and command targets PowerShell (cmd.exe callers should use argv). Whether maintainers prefer a different field name or an additional human-readable summary line is open.

For evidence-bearing changes:

  • 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

Node 24.22.1, macOS arm64, after npm ci. At head c91230b3:

  • npx vitest run src/application/Doctor.test.ts — 91 passed.
  • npx vitest run src/application tests/boundary/cli/doctorHopperDiscovery.test.ts tests/boundary/cli/cliSetup.test.ts (after npm run build) — 161 files passed; 2521 tests passed, 3 skipped.
  • npm run typecheck — passed.
  • npm run lint — 0 errors; 2657 warnings, identical to main without these changes.
  • npm run format:check and npm run docs:check — passed.
  • npm run build — passed.

At 78faaaa4 (first commit), additionally: npx vitest run src/application tests/boundary/cli — 329 of 330 files passed; 3648 tests passed, 8 skipped, 1 failed: tests/boundary/cli/idaRetainedCleanupCli.test.ts, which passes when run alone on this branch and on main without these changes. npm run verify:test-discovery and npm run verify:architecture-guards passed. These were not repeated at c91230b3.

GitHub CI on e7aebf37 failed only in tests/boundary/process/packedBridgeVerification.test.ts, which also failed on main at the base commit; that is now fixed on main. CI on 7baaa6ba failed only in tests/process-global/commandFinalizationCancellation.test.ts, which fails identically on current main 397aa62f without these changes (run locally on a clean checkout; see the PR comments).

Compatibility, safety, and release

  • Breaking changes or migration steps: none; one optional field added to audit-wide reports.
  • Real Hopper/Ghidra, browser, or OS coverage: real rea doctor on macOS arm64 (above). Not run on Linux or Windows.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new reads beyond what doctor already collects; the report repeats client and provider IDs that the audit already lists.

Author readiness

Human owner: @akshatgg

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

Activity

19
greptile-apps[bot]1mo ago

Confidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

Adds configured_scope to audit-wide doctor reports without changing the audit result or exit status.

  • Audit-wide doctor reports now show readiness for configured components.

Both earlier findings remain fixed: skill checks read the selected clients’ copies, and package-runner commands pin the running release. No new actionable issues or security concerns were found in the changes since the last review. Supersession could not be checked because GitHub access was unavailable. No runtime checks were run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Audit facts] --> B[Select configured clients and providers]
  B --> C[Read selected clients' skill copies]
  C --> D[Apply existing scoped checks]
  D --> E[Configured readiness and failing checks]
  E --> F[Append cleanup failure if needed]
  A --> G[Keep audit result unchanged]

Reviews (7) · Last reviewed commit: "feat(doctor): name the failing checks in..." · Reviewed by Greptile

chatgpt-codex-connector[bot]1mo ago

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

ReviewStatusCommitReview trigger
📝 Code Review✅ Completed 2026-10-25T21:17:50.631068Zc91230bNew 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.

akshatgg1mo ago

Note on the red CI: the only failing tests are in tests/boundary/process/packedBridgeVerification.test.ts, the packed Python bridge check, which this PR does not touch. The same test fails on main at this branch's base commit 2250e67b (run 40090967365) and on later main commits, together with packagedWasmVerifierOwnership. The other shards were cancelled after that failure. I'll update the branch once main is green so CI reruns.

akshatgg1mo ago

CI update: the earlier packedBridgeVerification failure is gone (fixed on main). The run on 7baaa6ba now fails only in tests/process-global/commandFinalizationCancellation.test.ts (five "preserves the analysis-view result and exit status …" cases), in Test shard 2/8 and Portable tests. Those five fail the same way on current main (397aa62f) without this PR's changes; I ran that file locally on a clean main checkout. This PR does not touch analysis-view or command finalization.

akshatgg1mo ago

@gensokyo-dev @morluto, this is ready for review when you have a moment. It addresses #6914: rea doctor gains an additive configured_scope on audit-wide reports, and healthy and the exit status are unchanged. All bot review threads so far have been answered with fixes and tests.

Two maintainer-only points:

  1. CI on this branch is red only in tests/process-global/commandFinalizationCancellation.test.ts, which fails identically on current main (397aa62f) without these changes (details in the comment above). A rerun once main is green should clear it, and I'm happy to update the branch then.
  2. The field name and presentation (configured_scope with argv and a host-quoted command) are open to your preference if you'd rather shape it differently.
Innerloop171mo ago

Tested this on a real Windows 11 x64 machine at commit e785f819d.

The new configured_scope behavior works as expected in my setup. rea doctor correctly detects my configured workflow as Codex + Ghidra 12.1.4 + JADX, while unrelated/unconfigured providers remain part of the audit-wide result.

Running: rea doctor --client codex --provider ghidra --provider jadx

returns healthy: true.

Adding --skill makes the scoped result unhealthy because my installed skill is reported as stale (installed_version: 42, expected_skill_version: 46), with config_drift reported correctly.

So on my Windows test, the configured-scope logic and the suggested scoped command both behaved as expected.

Innerloop171mo ago

One small UX observation from the Windows test : when configured_scope.healthy is false, the summary does not immediately show which configured check caused it.

In my case, I had to look further down to see that skill:identity was the failing check due to the stale skill version.

Would it be useful for configured_scope to also expose something like failing_checks or a short reason when it is unhealthy? I think that would make the new summary much easier to interpret.

akshatgg1mo ago

@Innerloop17 thanks for testing on Windows 11, and good suggestion. Added in c91230b3: configured_scope now carries failing_checks, the checks that make it unhealthy with their detail and remediation (empty when healthy). A final cleanup failure is listed there too.

It lists the scope's own checks rather than pointing into the audit, because the configured scope judges the skill from the configured clients' copies. Its skill:identity can therefore differ from the audit's. In your case it should show skill:identity with the stale-copy detail and the rea setup --skill-client … --skill remediation.

Can u test again.......

Innerloop171mo ago

The new failing_checks field works correctly on my Windows setup, thanks for adding it so quickly!!

One small readability thought: because detail and remediation can get fairly long, the current compact row format is a bit dense to scan. Maybe this is my Pythonic bias showing 😄, but I find a multiline rendering easier to scan, for example:

failing_checks:
  - name: skill:identity
    classification: config_drift
    detail: ...
    remediation: ...

The current output is technically fine; this is just a UX/readability suggestion for the summary block.

akshatgg1mo ago

Thanks @Innerloop17 for testing it again on Windows, glad failing_checks works for you!

The compact rows come from the CLI's shared default output format (TOON), which renders every list of same-shaped objects that way (checks, providerInspections, etc.). Changing it only for failing_checks would make the doctor report inconsistent.

For the multiline layout you showed, rea doctor --format yaml already prints each failing check as its own block with name, classification, detail and remediation on separate lines (--format json works too).

Changing the default rendering would be a CLI-wide decision for the maintainers, so I've kept this PR to the doctor data itself.

Innerloop171mo ago

Thanks, that makes sense. And good to know that --format yaml already gives the multiline structure I had in mind.

Thanks for the clarification!