feat(release): add a read-only host doctor that run, resume and prepare consult first #2454
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2454"
general
weight: 0.35
endaye
Summary
Item 5 of the "now" plan in #2422 (with the automatable half of item 7). Every non-product failure of 2.0.122.0's
prepareandresumerounds was a host condition the tool could have named before starting: the pinned emsdk deleted by a cleanup, a signing key sought in the wrong keyring, a staleghlogin, a second driver on the journal, a workstation at load 35 withfseventsdpegged, the M1 runner executing a candidate batch on the same cores.Change
tools/release/doctor.py:run_doctoris a read-only preflight (no build, no write, no lock held beyond a non-blocking probe) that reports each check asok,failwith why and remedy, orskipwhere it does not apply to the platform:- emsdk:
$EMSDKorbuild/toolchains/emsdkexists, its Git HEAD, release mapping and installedemscripten-version.txtmatchtools/web-runtime/emscripten.lock.json; the remedy is the exact install sequence and a reminder thatbuild/toolchainsis release-owned.- signing keys: the product role in the ambient keyring (
GNUPGHOMEor~/.gnupg), the checksum role in the dedicated keyring, each by policy fingerprint; the remedy names the keyring and therelease-signing-role-keyringspitfall and says not to move the other role's key.- gh auth:
GITHUB_TOKENorgh auth token.- journal lock:
writer.locktakeable (never deleted); an unopenable lock (permissions, a symlink) is a distinct failure with the ownership remedy.- release processes: another interpreter (any options,
cli.pyor-m tools.release.cli) running a driving command (run,resume,retire,prepare,push-tag,create-draft,publish-draft,promote,editorial,rehearsal); read-only commands beside a driver, this process's own wrapper shells, and a shell whose command string merely mentions the path do not count.- disk space (20 GiB for two clean Web Host builds and the Core package) and host load (1-minute load above the cpu count fails; the remedy names what to stop and the runner pause).
- fseventsd and Spotlight cpu pressure (macOS), with the restart / Spotlight Privacy remedies.
- M1 runner: every loaded
actions.runner.service is inspected; aRunner.Workerrunning from a service's directory (launch-agentWorkingDirectory, else its program's directory) fails against that service (a worker under a service whose agent definition is unreadable is reported as unattributable, with every service's pause command); a loaded runner fails forprepareand for aresumewhose next step isprepared(the batch arunor an earlierresumewaits on executes on this runner, so those keep it up and print each service's exactlaunchctl bootout/bootstrappause and resume commands); no service passes.scripts/release.sh doctorprints the report and exits 0/2; an unreadable policy or Git directory is itself reported as a failed check with a remedy.run,resumeandpreparecall it first and refuse with the report while any check fails (aresumeof a request the journal does not hold is reported by the journal, read-only, before the doctor); after the canonical fetch they check both key roles again against the fetched policy's fingerprints (confirm_canonical_signing_keys), since the checkout's policy may be stale.status,auditand the other read-only commands never wait on it.lmdj-releaseskill names the doctor and what it covers.Probes are injected (
HostProbes), so every check is exercised without the host; the production probes are plainos/subprocessreads.Related Issue
Related issue: #2422
Premise refresh (issue-done §0)
Base:
origin/mainat10d656507ccc15ebe582379913234ca9edb4dcdc. Nodoctorexisted intools/release/orscripts/release.sh;run/resume/preparestarted with no host check. Still outstanding; delivered here.Verification
New tests, each fixing one fact:
release_doctor_test(18): the pinned emsdk passes and each drift (HEAD, release mapping, installed version), a missing SDK and an unreadable lock fail with the install remedy; each key role is looked up in its own keyring and a missing role names its keyring and the pitfall;gh authaccepts a token or a login; a held writer lock is named and never deleted; only an interpreter running the CLI counts as a release process; disk and load thresholds; fseventsd/Spotlight limits andskipoff macOS; runner idle/busy/absent with the pause and resume commands;run_doctororder and fail-closed aggregate; a failedCheckmust carry a remedy;HostProbes.lock_freeagainst a real held flock;psrow parsing.release_cli_orchestration_test(7 new):prepareand a resume at thepreparedstep require the runner paused, earlier resumes andrundo not; an unknown resume is reported while another writer holds the lock; an unknown resume is reported before the doctor; the doctor reports its own unreadable inputs as checks; the key roles are rechecked against the canonical policy after the fetch and a missing canonical key refuses before the orchestration policy is built;run,resumeandpreparerefuse with the report and remedy before any context is built, andstatusnever consults the doctor; thedoctorsubcommand prints every check and exits 0/2;release_doctorbinds the policy fingerprints and the journal root.Mutation proofs (file restored with a fresh mtime,
__pycache__cleared, exit read):test_run_resume_and_prepare_refuse_while_the_doctor_failsfails (3 cases).test_runner_states_pause_and_resume_commandsfails.test_the_signing_keys_are_rechecked_against_the_canonical_policyfails; lock probe back toO_RDWR→test_lock_free…fails; any worker counts →test_runner_states…fails.test_only_an_interpreter…fail; first label only →test_every_loaded_runner_service_is_inspectedfails.test_only_an_interpreter…fails; no program-directory fallback →test_runner_states…fails;load_policyleft to raise →test_release_doctor_reports_its_own_unreadable_inputs_as_checksfails.test_a_held_writer_lock…fails; module form dropped →test_only_an_interpreter…fails; unknown-resume gate removed →test_an_unknown_resume_is_reported_before_the_host_doctorfails; unattributable worker blamed on the service →test_runner_states…fails.test_an_unknown_resume…fails; paused-runner flag ignored →test_runner_states…, the aggregate test andtest_prepare_and_a_resume_at_the_prepared_step…fail;split()[0]→ the fseventsd/Spotlight test errors.Commands run on the committed head:
Real runs on this M1 (worktree,
EMSDKexported). Quiet host: all 11 checksok, exit 0; withoutEMSDKthe emsdk check fails with the install remedy, exit 2. Later, while this PR's own CI job ran on the M1 and the release suite ran locally, the same command reported exactly the conditions item 7 lists:host load: load 29.1 exceeds 8 cpus,spotlight: Spotlight is indexing at 68% cpu,m1 runner: … is executing a CI job on this host(worker under~/actions-runner/lmdj/bin.2.337.0/), each with its remedy, exit 2. Quiet-host output:Complete
tests/build/release__test.pyrun (all 80 modules including the newrelease_doctor_test, one at a time, started onc2444e5): 79 PASS, 1 FAIL. The modules the later commits touch (release_doctor_test,release_cli_orchestration_test,release_prepare_test) were rerun on the final head663a3c6: 18 / 42 / 45 OK. The one failure,release_prepare_test.test_cli_reports_the_sanitized_subprocess_reason, drovepreparethroughcli.mainon a bare fixture root and stopped at the doctor's missing policy before reaching the subprocess diagnostic it pins;e17e641stubs the doctor there (test-only), and the module passes again (45 OK). The other 79 modules are unaffected by that commit.PR Review
Head SHA:
663a3c6f70a8ac6d93b48ba423ec582875d90339. The review ofef489dfraised four findings (unknown-resume precheck took the writer lock; idle loaded runner passed despite the pause remedy; blank ps command fields ×2), all fixed in663a3c6. The review ofd12ae01raised four findings (CLI invocation forms, unopenable lock reported as held, unknown resume hidden behind the doctor, unattributable worker blamed on a service), all fixed inef489df. Earlier: Reviews:c2444e5→ three findings (checkout policy, lock probe write access, worker attribution), fixed in15dc831;15dc831→ zero;e17e641(test-only) → two (read-only commands counted as a driver; only the first runner label inspected), fixed in7e7ebe1;7e7ebe1→ four (wrapper shell counted as a driver; runner without WorkingDirectory; doctor's own unreadable inputs;EMSDKcontainment — answered: it is the same path the build verifies), three fixed inac0e859.d12ae01is test-only (stubs the doctor in the prepare usage case). All threads resolved. Earlier: the review ofc2444e5raised three findings (doctor read the checkout's policy; lock probe needed write access; anyRunner.Workerattributed to the M1 runner); all fixed in15dc831and resolved in their threads. Current-head review evidence is checked withscripts/ci/review_wait.pybefore merge; findings and dispositions are recorded in the thread.CI Scope
Expected mode: focused
Expected selected lanes: ci_contract deploy_contract docs_static
Expected skipped lanes: core_asan core_coverage core_macos core_ubuntu creator package portal web_runtime_host web_runtime_lab web_toolchain
ci:fullrequired: noReason: release tooling, its Python tests and the release skill only.
Version Management
Version impact: none
Reason: release tooling only; no Module, Host, Contract or Product identity changes.
Documentation Impact
Documentation impact: none
Affected portal pages:
Reason: release-tool behaviour and the
.agentsskill; no page underapps/docs-site/docs/changes.Pitfall Impact
Pitfall impact: none — reason: the host conditions are now a gate with named remedies (
gate:tests/build/release_doctor_test.py); the operator checklist itself (item 7) lands in the next PR with the skill text.Merge Danger
Door: two-way
Blast Radius:
run,resumeandpreparenow stop on a failed host check with the report; the doctor performs no write and no build.Release Impact
Release impact: none
Candidate tag: none
Profile: none
Channel: none
Intent disposition: none
Release assets: none
Release gates: none
Reason: no release is active; tags, Releases and the ledger are untouched.
Transition authority
Authorized transitions: push | PR | merge (standing Task authorization in
CLAUDE.md; cleanup not requested)No tag, Release, deploy, publication, or Channel promotion is implied.
🤖 Generated with Claude Code