Repository navigation
Description
What's the problem
pithead doctor --json returns checks[] rows of only {status, message}. Nothing says which check a row is, so every machine consumer must match the wording of the message, and a reworded message breaks it quietly: the consumer keeps reporting, about the wrong check.
The id is lost at the source. dr_ok, dr_warn, dr_fail, dr_info and the *_surface variants take only a message, dr_record writes two tab-separated fields (status, message), and doctor_json turns each line into the row. The report's version, exit and summary are not part of the gap.
What it impacts
- Anything using
doctor --jsonas a health gate in cron, CI or monitoring (the reason the flag exists): it can bucket bystatusand nothing else. - The dashboard's diag-doctor route and the support bundle, which carry the same document. The Maintenance health view (Sovereign: build maintenance health and contextual troubleshooting #2540, Advanced drawer) groups doctor results by problem; a stable id gives it a key that survives message edits.
- Agent skills that map a failing check to the remedy the docs already name.
- Unaffected by design: readers of
statusandmessage, the exit code, the human report.
How I found it
Found while designing p2pool-starter-stack/.github#5. The operator's 2026-09-23 investigation comment confirmed the root cause and the additive fix shape. Re-read on 2026-10-27: develop (37c3bb2) and develop-v2.1.0 (7cb2266) still have the two-field dr_record in lib/pithead/05-doctor-checks.sh and still emit only {status, message} from doctor_json in lib/pithead/06-doctor.sh. Verdicts are also raised from the other doctor check files and from the LAN-guard, container-restart and disk-budget helpers. No open issue or PR has the row shape as its subject.
How important is it
Low. Nothing is wrong for a person reading the report; the cost falls on machine consumers, and the 2026-10-21 lean roadmap parked it as "only matters for machine consumers". It is eligible now because the owner's 2026-10-27 decision puts idle capacity on workable Icebox issues, and the change is bounded and host-side only.
Acceptance criteria
- Every
checks[]row ofdoctor --jsonhas a non-empty stringidbesidestatusandmessage.version,exitandsummarykeep their shape, and the exit code is unchanged (any failure returns nonzero, warnings alone return 0). - Ids are lowercase kebab-case slugs (for example
hugepages,monero-address-type,tor-clearnet-egress). A tier-1 test runsdoctor --jsonover the existing doctor stub scenarios and asserts every id matches the slug pattern and the set of ids equals a pinned list that names the check each id belongs to, with no id listed twice, so adding, renaming or removing an id fails the test. No tier-4 e2e is needed, because only the output shape changes. - One check keeps one id across its ok, warn, fail and info outcomes and across rewording of its message. The
*_surfaceverdicts carry the same id on DIY and on appliance wording. Rows a check raises per container, mount or port share that check's id. The existing surface and appliance doctor tests are extended to assert this. statusandmessagefor every existing check are byte-identical to before. The existing doctor tests pass, with changes limited to the stubs' call shape.- The diag-doctor result and the support bundle carry the ids: the redacted document still parses (
jq -e .), stays inside the existing size cap, and the ids pass the redactor unchanged. The existing control-diagnostics test is extended to assert it. - The
doctorentry indocs/operations.mdstates theidfield, the slug rule, that a released id is never renamed, and that the change is additive for consumers readingstatusandmessage. - Out of scope, visible in the diff: no change to the current dashboard UI (including the diagnostics card's regex grouping, which goes at the 2.1.0 cutover, Sovereign: verify complete feature coverage, accessibility and migration #2547), no new service, and no added code comments.
Possible solutions
- Add
idas a required first argument to thedr_*wrappers (a*_surfacewrapper takes it once for both wordings), carry it as an extra tab-separated field throughdr_record, and addidto the jq row map indoctor_json. This is the issue's original suggestion and the operator comment's recommendation. - Set a per-check variable once at the top of each check instead of editing every call site. The diff is smaller, but a stale id can leak into the next check; the pinned-list test would catch it.
- Slug convention: flat kebab-case, as in the examples above.
- The change is mechanical across the doctor files, and open PRs Fix non-root image permissions for restrictive DIY checkouts #3552 and testing: fix #2603 — exercise dashboard onion authorization #3539 touch some of them, so land it after those merge or rebase on them. Target develop-v2.1.0.
- A per-subject field (which container, mount or port) and moving consumers off message matching, such as the Sovereign: build maintenance health and contextual troubleshooting #2540 health view, are separate follow-ups, not part of this issue.
Earlier scope, kept as evidence only (superseded 2026-10-27; do not implement from it)
What's the problem
pithead doctor --json emits {status, message} rows with no stable check id, so every programmatic consumer has to string-match prose.
Found while designing p2pool-starter-stack/.github#5.
dr_record() (lib/pithead/05-doctor-checks.sh:51) writes two tab-separated fields:
dr_record() { [ -n "${DR_JSON_FILE:-}" ] && printf '%s\t%s\n' "$1" "$2" >>"$DR_JSON_FILE" || true; }and doctor_json() (lib/pithead/06-doctor.sh:359-372) turns each into
{status, message}. status is one of ok | warn | fail | info. There is nothing else on a row.
That is fine for a person reading the report. It is a problem for the three consumers that already
exist or are being designed:
- the dashboard's
POST /api/control/diag-doctor
(dashboard/mining_dashboard/web/diagnostics_views.py:40-52), which renders the rows in a browser; - anything using
doctor --jsonas a health gate in cron/CI/monitoring, which the--jsonflag was
added for; - an agent skill, which wants to map a failing check to the remedy the docs already name.
All three can only bucket by status and match on the message text — and the message text is prose
written to the house style, which is edited between releases by design. A consumer keyed to it
breaks quietly on a wording change, which is the worst shape: it keeps reporting, just about the
wrong check.
Suggested: add a stable id to each row — a short slug set where the check is written
(hugepages, monero-address-type, tor-clearnet-egress, …), carried through dr_record as a
third TSV field and emitted as {id, status, message}. message stays free to be reworded.
Existing consumers that read status/message are unaffected.
Read at origin/develop-v2 = 3a806dd4.
what it impacts
Impact is not separately established in the existing report; confirm the affected users or behavior.
How I found it
Discovery details are not separately established in the existing report; preserve and verify the evidence already recorded.
how important is it
Importance has not been assessed explicitly; triage must state the priority and its reason.
acceptance criteria
Acceptance is not isolated in the existing report; the agent must identify a testable outcome before implementation.
possible solutions
No distinct solution options are recorded; investigate the existing report before choosing an approach.
Activity
pithead-developer commentedon Sep 24, 2026
Investigation brief (operator pre-read, 2026-09-23) — verified against develop@a5af51ad
Still present on
developheada5af51ad(no commits have touched either file since the brief's cited296c860e).dr_record()(lib/pithead/05-doctor-checks.sh:51) writes only{status, message}as a 2-field TSV row;doctor_json()(lib/pithead/06-doctor.sh:359-378, comment block at 359, jq's{status, message}map specifically at line 369 — corrected from the original brief's 363-364) splits on tab and emits exactly{status, message}, matching the issue verbatim.Root cause:
dr_ok/dr_warn/dr_fail/dr_info/dr_*_surface(05-doctor-checks.sh:14-47) take only a message string — there's no slug anywhere upstream ofdr_recordto carry. ~143 call sites (corrected from ~132;grep -rEo 'dr_(ok|warn|fail|info|fail_surface|warn_surface|info_surface)\b' lib/pithead/*.sh | wc -l= 143) acrosslib/pithead/*.shwould need a leading id argument.Fix shape (additive, backward-compatible, matches the issue's own suggestion): add
idas the required first arg to thedr_*wrappers, thread it throughdr_recordas a third TSV field, extend the jq map at 06-doctor.sh:369 to emit{id, status, message}.status/message-only consumers are unaffected — including the dashboard'sdiag-doctorproxy handler (dashboard/mining_dashboard/web/views/diagnostics_views.py, confirmed read-only/pass-through, not the path the original brief cited). The dashboard's diagnostics card (dashboard/mining_dashboard/web/static/system/diagview.mjs:38-50) already ships a deliberate regex-basedSERVICE_HINTSgrouping overmessagetext (from #913/#1736, predates this issue) — it explicitly chose that over a third field at the time; this issue's fix doesn't require touching it.Evidence tier: tier-1 sufficient, confirmed (not just inferred) against
docs/dev/testing-strategy.md:48, which scopes tier4-e2e tolib/pithead/*.shapply, render and inject paths and the control plane's start/stop/hold/release actions — this change touches none of those; it's a pure diagnostics-output-shape addition. No tier4-e2e required under "tier follows the path" as written.No duplicates. Related-not-duplicate, both verified on GitHub: #1807/PR #2389 (merged) fixed a summary-count bug in the same file, unrelated to row shape; #2145 changed nonzero-doctor exit/result-status semantics, also unrelated.
Rulings needed: (1) slug naming convention — recommend flat kebab-case per the issue's own examples; (2) one mechanical PR vs. several — recommend one, since it's pure thread-through with no design risk; (3) whether to later migrate the dashboard's regex grouping to id-based matching — recommend defer, separate issue if wanted.
Ready = yes, a worker can implement directly from the issue body plus this brief without further design input.
Triage recommendation: MOVE-2.0.x — not a GA blocker, correctly already placed in milestone "v2.x - post-GA" (confirmed via
gh issue view 1805), no milestone change needed.Corrections applied by refutation pass: jq-map line citation (363-364 → 369) and call-site count (~132 → ~143, confirmed 143 by grep). Root cause, fix shape, evidence-tier conclusion, duplicates, and triage all survive verification against the current checkout and GitHub state.
pithead-developer commentedon Oct 30, 2026
Merged in #3716.
doctor: fix #1805 — add stable check ids (#3716)
fix(os): clear cosign go-jose vulnerability (#3762)
test(lan): retain bounded crash-recovery evidence (#3793)