feat(cli,daemon): say which bearer checks the running daemon started with #4183
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 #4183"
general
weight: 0.35
mvschwarz
Refs #4181.
A daemon's bearer tokens come from whatever starts it: a supervisor's unit, or the shell that runs
rig daemon start(orrig up,rig startorrig contextwhen one of them starts the daemon). Nothing said which ones the running daemon had, so a daemon restarted from a shell without them looked the same as one its supervisor started, and a request to/healthzor/api/views(neither checks a bearer token) succeeded either way.What a person or their agent sees now
rig daemon start,rig daemon statusandrig status --json(daemon.bearerChecks) say what each of the daemon's two bearer checks had when it started, never the token:(Captured from a test-machine walk at the first head; the second head changed only the parenthesis's last words.)
operatorisconfigured,empty(set to an empty or blank value: the check still runs, so a request with no bearer gets 401) orabsent.terminalisconfigured,operator(an explicit bind outside loopback and tailnet with no terminal token, which checks the operator token) orabsent.unknownwhen nodaemon.jsonrecord of them is confirmed for the daemon described: a record an earlier version wrote, one whose PID/healthzdoesn't name, a/healthzthat didn't answer, or a daemon reached throughOPENRIG_URL.The change
resolveBearerChecksinmiddleware/auth-bearer-token.ts) gives the daemon its two tokens and their labels, so a label can't disagree with what the daemon checks. The empty and unset handling is the daemon's existing handling, unchanged.rig daemon startrecords the labels from the environment it gives the child, indaemon.jsonand in the start reservation. A later start that finishes a pending one publishes the labels that launch recorded, not its own environment's. The daemon entry run directly, as a supervisor runs it, writes its own./healthznames that record's PID; otherwise they readunknown.getting-started.md(set the tokens in the supervisor's unit; a daemon started any other way gets that shell's environment),daemon-http-clients.md("Bearer tokens"), the command reference, and therigsskill's start step (restart a supervised daemon through its supervisor).Unchanged
Every route's bearer check, the explicit-bind startup check, the bind plan,
/healthzand every endpoint. There's no new refusal or error code, and no token value or fingerprint in any record or output.Tests
On Linux (Node 22) on a test machine, at
80e2735c.- 7 daemon files pass (261 tests): the bearer middleware and its new derivation cases, the daemon entry's own record (a real daemon: its record's labels, a guarded route answering 401 without the token and passing with it,
/healthzand/api/viewsanswering 200 either way), the entry, terminal-bearer and seat-auth files, and restore-check;- 15 CLI files pass (587 tests, 1 skipped): start and status records, the finished pending start, the person offer, status JSON and the start, up and restore-check paths;
- both packages'
tsc --noEmit, the daemon build,mirror-skills --check,check-docs-guardandgenerate-context-packs --checkpass.OPENRIG_URL; and a start that ended pending, finished by a start from a shell without the token. Each output said what's listed above, the guarded route agreed with the label, and no token value appeared in any output, record, log or reservation.empty): against the first head, its new and changed cases fail, 2 in the daemon and 7 in the CLI. With it, the same 7 daemon files pass (262 tests) and the same 15 CLI files (589 tests, 1 skipped), with bothtscruns and the three repository checks. The checks also pass on the tree merged with current main.operatorcase (an explicit bind outside loopback and tailnet). It's covered by unit tests only.Cost
Source +160/−41 (net 119), tests +217/−7, docs and skill text +41/−9.
🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
rig daemon start,rig daemon status, andrig status --jsonreport the daemon’s operator and terminal bearer-check states, including configured, absent, empty, or unknown, without exposing token values.For external binds, the operator token can also serve as the terminal check when no terminal token is set.
Documentation
Updated setup and reference guidance to explain how startup environments and supervisor settings affect bearer checks, and how to restart supervised daemons.
Clarified that successful health or views requests do not reveal whether bearer checks are active.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->