feat(daemon,proxy): serve checked RPC that refuses protocol skew before dispatch
Merged
TH
1d ago+1120+1120+0123456789012345678901234567890123456789-31-31-01234567890123456789
Summary
Adds POST /rpc/checked (also /agent-device/rpc/checked) on the daemon and proxy so the server refuses protocol skew before dispatch, in place of the client's /health probe. Replaces closed #5134. The client opt-in is #5145.
- Same auth, body and answer as
/rpc. Thex-agent-device-rpc-protocolheader is mandatory. - Skew gets 409 plus
x-agent-device-refusal(protocol-missing,protocol-mismatch, orupstream-protocol-mismatchthrough a proxy). - The proxy admits both routes through one path and forwards to the upstream checked route.
/healthandDAEMON_CAPABILITIESlistchecked-rpc. Additive ledger entries, no protocol bump. ADR 0006 amended.
Security
- The daemon verifies the transport credential (headers or JSON
params.token) before it reads the protocol or method: a wrong credential always gets 401. - The 409 comes only after the auth hook, tenant and token gates pass; any earlier failure gets the ordinary
/rpcrejection. A refused call reserves no request id. - Refusals echo only a bounded id and are built from local values; the proxy never copies an upstream refusal's body or headers, and never follows a redirect on the checked route.
- No state on disk, no resend.
Before / after
No observable change until a client calls the route. Released servers answer it with 404 before dispatch.
Validation
Head 1633e100df. Ordering, id, reservation, rebuild and redirect tests fail without their fixes (checked by mutation). Proxy and daemon checked tests, test/wire-compat, eager-closure budgets, the layering scan and fallow audit pass locally. CI pending.
š¤ Generated with Claude Code