Repository navigation
Description
What's the problem
The sister API (util/api-server.py, :8081) serves a fixed ROUTES table of pre-built files and exposes no logs, and every token it accepts gets the same everything: the Pithead coordinator (pithead#4017) cannot pull rig logs, and handing it a log reader must not be an ordinary read token (parent rigforge#682).
What it impacts
The worker-to-Pithead wire contract: a new GET route, a new derived-token scope, and the doc tables that lock them (docs/pithead-integration.md token rule, docs/configuration.md cross-reference). Depends on chunk 1 (redactor) and chunk 2 (ring file + read helper); this is the chunk that puts log lines, redacted, on the wire.
How I found it
Parent rigforge#682's acceptance criteria. Read api-server.py (ROUTES table, derive_read_token's HMAC scope pattern, the locked wire-contract docstring) and docs/pithead-integration.md's token rule table and one-token-per-stack section.
How important is it
This is the feature: rigforge#682 ships only when the pull endpoint exists with its own scope.
Acceptance criteria
- A
GET /logsentry in util/api-server.py's ROUTES, serving chunk 2's ring through its read helper:?cursor=<seq>&limit=<n>returns the next chunk — entries withseq> cursor, at mostlimit(default 500) and at most 256 KiB of body, whichever hits first — plusnext_cursor; when the cursor is older than the ring's oldest surviving entry the response reports lost lines; unparseable cursor/limit → 400. Wire contract preserved: GET-only, application/json, exactly the Content-Type/Content-Length/Connection headers, no banner; the read is a single byte-bounded scan of a ≤ ring-cap file on the existing single-threaded server (rate is bounded by that microsecond file-serve — no new timer); zero outbound traffic is added. - Dedicated log scope: a second derived bearer, HMAC-SHA256(token, "rigforge:api-logs:v1") lowercase hex (same derivation rule and token-strength gate as the read scope), accepted ONLY on /logs. The read bearer and ordinary named tokens get 401 on /logs; the raw master token still passes everywhere; comparisons stay constant-time per candidate. With no token configured the existing open posture applies and docs state that open callers still only ever see redacted lines.
- docs: pithead-integration.md token table gains the log-scope row and the wire section describes /logs (cursor semantics, defaults); configuration.md cross-references
logs/log_ring_mb. Defaults also stated in the PR: ring 2 MiB, chunk 500 lines / 256 KiB, rate = single-threaded request serialization. - tests/run.sh cases (red on base): read token 401 on /logs while 200 on /1/summary; log-scope token 200 on /logs and not accepted on /1/summary; raw master 200 on both; cursor advances exactly; chunk never exceeds the stated line/byte bound; loss reported when the cursor predates the ring after wrap; bad cursor 400; unknown path still 404.
- End-to-end one-line-leak proof (new tests/e2e-log-tail.sh, tier4-e2e battery row): with
logsenabled on a real rig, write one line carrying a leaked token, a pool password and a wallet address into the miner log, pull it via /logs with a log-scope token, and assert every line arrives redacted, cursor advance works, and cursor loss reports through the real ring.
Possible solutions
Serve the ring via chunk 2's read helper on the request path (one read of a ≤ ring-cap file, filter by seq, cap at 256 KiB); a LOG_TOKENS set next to READ_TOKENS in api-server.py; the e2e script joins the existing tier4-e2e scenario set.
Parent: #682
Worker brief: Test tier: tier4-e2e — this is a worker-to-Pithead contract change (new route + new token scope + the end-to-end one-line-leak row on a real rig), which is exactly what RigForge sends to the bench; plus GitHub tiers 1-3 green on the head (lints, tests/run.sh auth/bounds/loss cases). Submit through bin/bench-submit with --base develop and the full 40-hex SHA, scoped to the log-tail scenario; paste the unedited bench-ci evidence block on the PR. State the PR defaults: ring 2 MiB (log_ring_mb), chunk 500 lines / 256 KiB, rate bounded by the single-threaded server, scope string rigforge:api-logs:v1. Run the verifier and the security-reviewer subagents (auth matrix, untrusted input, credentials) until they find nothing. No comments or docstrings in edited hunks; FILE_BUDGET_REQUIRE_BASE=1 bash scripts/lint-file-budget.sh before proof. Blocked by the two earlier rigforge#682 chunks (imports util/log-redact.py and the ring read helper) — do not start until both are merged.
Release: issue rigforge#691 closed
Who: operator
Activity
pithead-developer commentedon Nov 23, 2026
Needs an operator action (do it, then remove the
operator-actionlabel):The runner stopped a respawn loop after 3 fresh workers reached
errorwithin six hours. Inspect the repeated outcome, then remove this label to release one new worker.pithead-architect commentedon Nov 27, 2026
Release regroom (owner request, 2026-11-27): moved from v1.20.0 to v1.21.0. Trimmed from v1.20.0 (update API only) per the owner. Log tail API; the pithead log store depends on it.