Repository navigation
feat(daemon): add machine lifecycle endpoints - #1316
Conversation
…equiring factory Vera on #1315: a scope nobody reads doesn't hold the claim. adopt now requires 'agents:adopt'; heartbeat-only credentials 403. No legacy daemon credentials exist, so enforcement is strict from birth. This is THE daemon middleware — #1316 should consume it, not duplicate it. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013pc6nGXRS8mHvrwcXMSRDK
…1315) * feat(daemon): identity-level machine binding + adoption CAS — ADR-026 D3 (Phase 1 S2) cm_daemon_* auth against the ledger (lifecycle-scoped: cannot pass agentRuntimeAuth or act as any agent); botMetadata.machineId declared on interface AND schema; POST /api/agent-binding/adopt is an atomic unbound→bound(machineId) conditional update — machineId comes from the credential server-side, never the body; concurrent adopts yield one winner and a clean 409; release is an explicit owner action, making rebind a deliberate two-step. 6 CAS invariant tests on mongodb-memory-server incl. the concurrent race. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013pc6nGXRS8mHvrwcXMSRDK * fix(daemon): enforce credential scopes — daemonAuth becomes a scope-requiring factory Vera on #1315: a scope nobody reads doesn't hold the claim. adopt now requires 'agents:adopt'; heartbeat-only credentials 403. No legacy daemon credentials exist, so enforcement is strict from birth. This is THE daemon middleware — #1316 should consume it, not duplicate it. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013pc6nGXRS8mHvrwcXMSRDK * fix(daemon): routes see req.machine and nothing else (Vera's S1 contract) Minimal projection {machineId, ownerUserId, scopes} — the credential document and its internals never reach route handlers. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013pc6nGXRS8mHvrwcXMSRDK * fix(daemon): sole-installer ownership predicate (Vera's #1315 ruling) Adoption requires an active installation installedBy the owner AND no active installation of the identity installedBy anyone else. Test pins the negative clause: a shared identity is not adoptable by either party. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013pc6nGXRS8mHvrwcXMSRDK --------- Co-authored-by: Claude Fable 5 <[email protected]>
|
Held by Sam's ruling (2026-08-30): ADR-026's direction is approved and the doc merges as Proposed, but Phase 0 (token substrate) and everything after it are gated on ADR-023 W2 (hosted runtime) being live — casual signups are the activation goal and hosted is the bigger lever for them. This PR stays open until that gate opens; rebase when it does. Added acceptance criterion for Phase 1: revoke a machine → every agent bound to it stops within one heartbeat, as a tested requirement. The D6 ack race is now its own P1 row (TASK-090) — fix it independently of this stack. |
|
RETRACTED — the hold comment above was written from a stale queue listing. Sam ratified ADR-026 as Accepted via his other session on 2026-08-30 and this PR was merged and deployed under that decision before the comment landed. The ratification stands; ignore the hold. |
ADR-026 Phase 1 S1 on the AgentCredential substrate. Adds Machine rows, daemon-only credential issuance/auth, register/list/heartbeat/delete routes, cascade revocation, and agent unbinding by User.machineId.\n\nVerification: git diff --check and Node syntax checks passed. Jest is unavailable in this worktree (no node_modules), so the new service, middleware, and route tests are unrun.\n\nS2 contract: adoption CAS must bind the root User.machineId field.