Repository navigation
Description
What's the problem
An appliance owner has no shell and no SSH, so there is no way to get logs off an appliance after an incident. pithead support-bundle is a host-CLI command a shell-less box cannot run (#786), and the planned live log viewer (#3978, v2.1.0) shows current logs only, not a past window. Child issue of #4032: the owner needs a dashboard action that produces a redacted bundle of the past log window (default last 72 hours) and streams it to the browser.
What it impacts
Every appliance owner who sees an outage, a stalled miner or a failed update; the project, which cannot diagnose user reports without logs (#3375); and monitoring triage, where a real outage and a failed health ping are indistinguishable without the box's own logs.
How I found it
From the parent issue #4032: the owner's production appliance Healthchecks went DOWN 2026-11-11 for 2 h 37 min and again 49 min, and the cause could not be confirmed because the appliance could not be read. Code facts verified in this checkout: dashboard/mining_dashboard/web/views/download_views.py carries the file-streaming route family and its module docstring states "The support-bundle download joins this module rather than server.py"; control_backup writes {rid}.tar.gz.enc into the control results spool and handle_backup_download streams it after checking the result is applied; the host control loop dispatches read-only asks (diag-doctor, diag-logs) in lib/pithead/49-control-request-loop.sh with host-side clamps in lib/pithead/46a-control-diagnostics.sh; bundle_redact_log (lib/pithead/07-support-bundle.sh) is the single redactor by ruling (#1585, #1750 — extend it, never a second list).
How important is it
High. The owner asked for it after a production incident; it is the prerequisite for supporting appliance users at all (parent #4032).
Acceptance criteria
- A new read-only request kind on the host control loop (e.g.
support-bundle) accepts an optionalhourswindow; unset, non-numeric or out-of-range values fall back to 72, and the cap is clamped host-side exactly likecontrol_diag_logsclampslines(a bound the client asks for is not a bound). - The bundle contains, for the window:
journalctl --sinceentries for every Pithead unit and container on the appliance (dashboard, caddy, tor, monerod, tari, p2pool, xmrig-proxy, docker-proxy, docker-control, the built-in miner, pithead-boot, update/RAUC units, address watch); the dashboard's health/status history; Tor bootstrap and circuit state; versions, the active RAUC slot, and the config shape keys-only (masked viarender_masked_config+bundle_mask_config, values never included). - Every log line written into the archive passes through
bundle_redact_log; if the journal surfaces a new leak class,bundle_redact_loggrows andtests/integration/selftest/selftest-bundle-redact-log.shgains the rows — no second redactor. - The archive is chmod 600, has a host-enforced total size cap, lands in the control results spool, and its result document carries
status: "applied"plus anarchivename, mirroring thebackupkind so the existing poll (GET /api/control/result) works unchanged. - Dashboard: a POST spools the request behind the
X-Pithead-ControlCSRF header pattern used bydiagnostics_views.py, and a new GET route indownload_views.pystreams the spool file inhandle_backup_download's shape (UUID id, anything notapplied404s). Auth is Caddy's existing owner session (X-Auth-User); every request is recorded in the control audit log like the other control kinds. - A dashboard UI action lets the owner trigger the collection and download the archive once ready, with the default stated as the last 72 hours.
- A tier-1
tests/stackcase seeds a Monero payout address, an--rpc-loginvalue, a 56-char.onionand an--http-access-tokeninto the fixture inputs and asserts none of them appears anywhere in the produced archive; the same case asserts the default window, the host-side cap, and unit membership of the collected set. - Docs:
docs/dashboard.mdanddocs/operations.mdsay how an owner downloads a bundle and how to send it with a bug report (cross-link Add a 'Report a bug' link (bugs@pitheadmining.com) to the shell and Maintenance #3746).
Possible solutions
Collect host-side in a new slice beside 46a-control-diagnostics.sh (or beside stack_support_bundle in 07-support-bundle.sh — one collector, since the recovery-state sibling issue reuses it); dispatch in 49-control-request-loop.sh; stream via download_views.py like backup-download. Note #3978's redactor is not merged (that issue is open for v2.1.0), so the shared redactor today is bundle_redact_log; the new code must call that function, not a copy.
Parent: #4032
Worker brief: Test tier: tier-1 tests/stack (plus GitHub tiers 1-3 green) and tier4-e2e targeted — the change touches the control channel and a deploy-served path, so an e2e job on the head must show the bundle action working against a deployed branch; quote the bench-ci evidence block in the PR.
Implement the dashboard side of the appliance support bundle for parent issue #4032, per the acceptance criteria on the issue. Ground rules from the code you will touch: read lib/pithead/49-control-request-loop.sh (dispatch case), lib/pithead/46a-control-diagnostics.sh (the read-only-ask pattern: audit lines, host-side clamps, redact-before-cap), lib/pithead/07-support-bundle.sh (bundle_redact_log is the only redactor; stack_support_bundle shows the masked-config and tar pattern), and dashboard/mining_dashboard/web/views/{diagnostics_views,download_views}.py plus server.py route registration (the module docstrings name this download's intended home and shape). Reuse control_service.submit/result and the existing poll; do not add a second polling route. Run make lint-file-budget and make lint-pithead-build before pushing, run the generated-CLI build (scripts/build-pithead.sh / make) since lib/pithead changes, and add a failing-first tests/stack selftest with a seeded secret that must never appear in the archive. Keep each edited file inside its line budget. Do not implement the notifier ping-failure logging, the recovery-state CLI bundle, or journald config changes — those are sibling child issues.
Activity
pithead-developer commentedon Nov 12, 2026
Needs an operator action (do it, then remove the
operator-actionlabel):Required human action, a prerequisite BEFORE this PR can merge: draft PR #4053 (head 734f2cb, MERGEABLE) must be approved, marked ready for review — a draft cannot merge — and merged; per contributor rules the agent never merges, and on merge the PR's verified closing references close #4036, #4037 and #4038 (re-checked this round: closingIssuesReferences = [4036, 4037, 4038], restored after the unclosed-fence defect that had suppressed them). Candidate evidence at that head: all 43 required checks pass with only the 2 pre-existing CVE-sweep skips and nothing pending; both reviewer findings fixed at root cause (GNU-bash hour clamp; prune result-archive pairing; recovery-bundle declared in both verb locks with its honest ledger
missingrow owned by filed #4054); tier4-e2e bench evidence published unedited — job 878 success (324 pass/0 fail) and job 879 success (319 pass/0 fail, baseline verified, rig restored). No code, bench or CI work remains open and nothing waits on the action's status; only the owner's review-and-merge stands between this and closure of all three grouped issues.pithead-developer commentedon Nov 13, 2026
Operator, 2026-11-13: the agent review of PR #4053 at head 734f2cb never ran. All four attempts on 2026-11-12, the last at 17:03Z, failed in about 3 s while the Claude plan was capped, so there is no agent PASS at this head yet. The rule is an agent PASS first, then the owner's approval. I removed
operator-actionso the runner can re-run the review now that the plan has reset. The owner approves once that PASS lands.pithead-developer commentedon Nov 13, 2026
Merged in #4053.
appliance: fix #4036, #4037 and start #4038 — download a redacted sup…
Tor diagnostics snapshot: circuits, consensus, guards, bootstrap and …