Repository navigation
feat(doctor): check that the configured agent CLI actually starts - #822
Merged
coo1white merged 1 commit intoOct 17, 2026
Merged
Conversation
cw doctor said all green while the configured agent could not start (claude: "native binary not installed ... reinstall without --ignore-scripts / --omit=optional", exit 1). Doctor only checked that the file was there. New check agent-runs: when an agent command is set, doctor runs its vendor CLI with --version (argv-style, shell:false, 15 s timeout, the same child env as a real agent via buildAgentChildEnv, cwd = repo). It reads only the exit code and the first lines of output. - exit 0: ok, "<cli> --version → <first line>" - non-zero / no start / timeout: fail (doctor not ready, exit 1), up to 4 of the CLI's own lines (300 chars) and a fix line - a custom command is never run: warn "not probed: custom command" The vendor CLI per builtin wrapper is data in scripts/agents/builtin-templates.json (versionProbe); core holds no vendor table. buildChildEnv/buildAgentChildEnv now take only the env part of a policy, so doctor needs no sandbox-profile load (module ratchet unchanged). POLA exception: operator's dated yes in intent 2026-10-16-release-gate-ci.md (0.3.3 part), docs/doctor.7.md says the new check; the version raise comes in the 0.3.3 bump PR. Test: test/doctor-agent-probe-smoke.mjs (fails on main's dist, passes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NpzNqRDJFpBt4cSyYjhbV3
coo1white
marked this pull request as ready for review
October 17, 2026 20:53
coo1white
enabled auto-merge
October 17, 2026 20:53
coo1white
deleted the
claude/trusting-wozniak-d0z17o-doctor-agent-probe
branch
October 17, 2026 20:58
coo1white
pushed a commit
that referenced
this pull request
Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NpzNqRDJFpBt4cSyYjhbV3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Capability
cw doctornow catches an agent that is installed but cannot run. In the operator's 0.3.3 acceptance, doctor said all green whileclaudefailed withError: claude native binary not installed … reinstall without --ignore-scripts. Doctor now runs the vendor CLI once with--version, fails when it cannot start, and shows the CLI's own fix hint.Implementation
agent-runs, right afteragent/agent-binary:✓ agent-runs: claude --version → 2.1.295 (Claude Code)✗ agent-runs: claude --version exited 1: <first lines of its own output>+fix:line; doctor not ready, exit 1. Also timeout (timed out after 15s),could not start (ENOENT), stopped by signal.! agent-runs: not probed: custom command …— never executed.--json: one morechecksentry in the same shape.versionProbe.clisinscripts/agents/builtin-templates.json(core holds no vendor list);agentProbeTarget()insrc/shell/agent-config.ts.spawnSync(cli, ["--version"]),shell:false, 15 s timeout (CW_DOCTOR_AGENT_PROBE_TIMEOUT_MS), cwd = repo, env frombuildAgentChildEnv(provider keys, proxy,USERas in a real run); control chars stripped; output capped (pass 1 line/120 chars, fail 4 lines/300 chars); env values never printed.buildChildEnv/buildAgentChildEnvacceptPick<ResolvedSandboxPolicy,"env">(type-only), keepingdoctor.modulesat 42 for the perf ratchet.POLA exception
project/docs/intent/2026-10-16-release-gate-ci.md, "Operator decisions for 0.3.3": the question, the chosen option and the operator's full answer verbatim (2026-10-17), with a table of which bytes change.docs/doctor.7.md, "agent-runs (new in 0.3.3)".Tests
New
test/doctor-agent-probe-smoke.mjswith stub CLIs on PATH: broken install (fail + hint + fix, JSON shape), working CLI (pass; probe env gets provider key, not unrelated vars; no value printed;CW_AGENT_COMMAND="claude -p"probed), hanging CLI (fails as timeout promptly), custom wrapper (not probed; marker proves it never ran), other checks unchanged and no entry when no agent. Fails on main, passes here. Byte compare vs main: human output differs only by the added line;--jsonidentical once that entry is removed.build, check, test:unit 144/144, test:gate 278/278, citation, growth, index, purity, lang, onramp check, release:check, perf counts: pass. Conformance 88/88 with a CI-like PATH (86/88 with the sandbox's PATH, the same 2 known failures as main).
Risk
Low-medium: a configured vendor CLI missing from PATH now fails doctor (before: a warn). Custom commands are never executed by doctor.
Generated by Claude Code