Repository navigation
feat(contract): agents, their approval signature and roster entry - #1642
Conversation
Names and wire for agents: an assistant through MCP, Sourceful support for one ticket, and the release check. docs/agents.md is the normative text; Core enforces it in a later pull request. - Registry copy: roles agent, support and release; scopes for logs, config, diagnostics, capped holds, owner-confirmed requests and update requests; an agent scope on each op; access.agents; eight refusals; push kinds agent.added and agent.request. - gencontract reads the ops' agent scope into RegistryAgentOps, emits role names into go/protocol for FTW Cloud, and counts hold and request scopes as writes. - go/protocol/agents.go: the agent messages, limits, and the approval signature: ECDSA P-256 over deterministic CBOR, with golden vectors in testdata/approval-vectors.json for the phone and FTW Cloud. - cloudwire: a roster Device may carry an agent grant (scopes, ops, caps, expiry, principal). Envelopes may carry by, the staff id on a support call. - appenroll refuses an agent's role on a pairing code or a role change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce0e361afa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| r := new(big.Int).SetBytes(sig[:32]) | ||
| s := new(big.Int).SetBytes(sig[32:]) | ||
| if !ecdsa.Verify(key, digest[:], r, s) { |
There was a problem hiding this comment.
Canonicalize ECDSA signatures before replay tracking
ecdsa.Verify accepts both (r, s) and (r, N-s) for the same P-256 approval, so a party that obtains an accepted request can replace the final 32 signature bytes and produce a second valid signature over identical approval bytes. Because the contract says the box remembers accepted signatures to reject replays, tracking the raw 64-byte value can therefore be bypassed; reject high-S signatures or canonicalize them before verification/replay storage (and add a vector for the alternate-S form).
Useful? React with 👍 / 👎.
…ollows the build The grant offer is a type FTW Cloud's consent page and the box page share. Request routes on the box page move to /api/agent-requests, config.get reads one section, every read fits one bulk frame, and E_RATE_LIMITED carries retryAfterMs in the error body. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Blockers: - Only FTW Cloud's keys part opens an agent's session: agent rows carry tun false and no copy scopes, and the cloud admits them on no door. - Offers are signed by a pinned offer key (SignedOffer, OpenOffer), live at most ten minutes, carry clientHost and verified, leave home empty, and a support offer comes only from SupportClientID. - Agent holds: battery.hold and loadpoint.boost lose their agent scope; agent_args allowlists each op's arguments; holds carry their setter, an owner's hold wins, and revoke or expiry ends an agent's holds. - The box page needs the house password for every widening route, from loopback too, and drivers never reach the box. Signed bytes and wire shapes: - agent.widen signs the row's key; agent.confirm signs the agent, the op and the hash of the args; request ids are 128 bits; replay memory keys on the signed bytes. - by is staff:<id> or bot:<name>, and only a support session may send it. - The roster carries the box's Noise key (noise) for the keys part. - Typed reads (live.get, loadpoints.get, cars.get, drivers.get) and cursors on logs and events, listed in the registry's reads table. - approval.key.set takes prevSig; audit rows carry count; agent.decided tells an agent how a request ended; E_CLOCK_SKEW; push kinds agent.expiring, approval.key.set and owner.added. Vectors regenerated: approval, offer and roster. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…gent key Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit b952561)
TestOneDeviceCannotStarveTheOthersOfHandshakes gave twelve handshakes two seconds; under -race on a loaded runner one came late. It now waits for the budget to be spent, then half a second for any answer past it. TestTunDoesNotSpendTheCopysBudget read the counts before the last tun was counted, and failed if a heartbeat went meanwhile; it now waits for the count and checks that the tunnel's bytes never land on the copy's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
OfferKid is the first 16 characters of base64url(SHA-256(SEC1 point)), as FTW Cloud's keys part names its offer key. The offer vector uses it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… count Handshakes run side by side and a device keeps at most four unproved sessions, so on a loaded runner one could be evicted before it answered and the test saw 11 of 12. The property is that a device never gets more than its budget and another phone still gets in. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Agents and support reach the box only through FTW Cloud's tunnel, with a grant the owner approved: scopes, a per-grant op allowlist, caps, an end time, holds that end, durable changes as owner-confirmed requests, an audit log the owner reads, and logs and config redacted on the box. Built on the contract in #1642. Squashed from claude/agents-core onto master after #1642 merged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* feat(agents): enforce agent and support access in Core Agents and support reach the box only through FTW Cloud's tunnel, with a grant the owner approved: scopes, a per-grant op allowlist, caps, an end time, holds that end, durable changes as owner-confirmed requests, an audit log the owner reads, and logs and config redacted on the box. Built on the contract in #1642. Squashed from claude/agents-core onto master after #1642 merged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(agents): log cursors, phone reads, clock rules, doc Typed reads: logs.get pages with beforeMs and afterMs over the whole ring and says more; phones may send live.get, loadpoints.get, drivers.get and cars.get under their scopes. N4: the box page may reset the clock's mark, with the house password; every agent's grant ends with it. N5: approving a request needs a wall clock the box trusts. Doc: agent hello and sub, safe error args, holds in one step, the hold gap, security notices, audit folding, the clock reset, offer limits. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(agents): the agent routes need sign-in with lan_auth on Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(agents): no sub through an agent's hello Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
What
The contract for agents: an assistant through MCP at FTW Cloud, Sourceful support for one ticket, and the release check.
docs/agents.mdis the normative text. Core enforcement follows in a stacked PR; this one changes no behaviour except one refusal (below).docs/agents.md. Principals, scopes, which messages each scope opens, the op allowlist, caps, durable requests that wait for an owner, the seven messages with their fields and errors, the roster entry, expiry, the approval signature, approval on the box page, the grant offer FTW Cloud's consent page shows, push kinds, the audit log, and the numbers in one place.agent,support,release; six scopes; anagentscope on each op;access.agents; eight refusals; push kindsagent.added,agent.request.RegistryAgentOps, emits the role names intogo/protocol(so FTW Cloud stops spellingownerby hand), and countsholdandrequestscopes as writes.go/protocol/agents.go: the message shapes and limits, and the approval signature: ECDSA P-256 over the deterministic CBOR of["ftw.approval.v1", what, boxKey, deviceId, atMs, ...fields],r ‖ s. Golden vectors ingo/protocol/testdata/approval-vectors.jsonfor the phone and FTW Cloud.Devicemay carryagent {scopes, ops, caps, expiresAtMs, principal};docs/protocol-cloud.mdgains the tables. Envelopes may carryby, the staff id on a support call.appenrollrefuses an agent's role on a pairing code, a box code or a role change. Without it, the new roles would be valid phone roles the moment the registry names them.The box page's sign-in, as checked
docs/agents.md, "Approval on the box page", says it plainly: withapi.lan_authoff (the default) every LAN client is an owner with no sign-in, so widening routes need the box itself or the house password. With it on: argon2id, at least 10 characters, five wrong guesses lock sign-in for 30 s box-wide, a 12-hourHttpOnlySameSite=Strictcookie, but plain HTTP on the LAN and one shared password with no person behind it.Paired PRs
Contract.swift.Contract-pair: srcfl/ftw-webapp@claude/registry-agents
Tests
go test -p 2for./protocol/...(vectors, tamper, unsorted lists, envelopeby, allowlist against the document),apiauth,appenroll(new: an agent's role is never a phone's),appproto/...,appuplink,cloudlink,notifications: all pass.The changeset is
patch: names and a refusal, nothing a user sees.After the review (adversarial, at f557f6d)
Fixed before merge, the three blockers and everything that changes signed bytes or wire shapes:
tun: falseand no copy scopes; only FTW Cloud'skeyspart opens an agent's session, never/v1/app,/v1/app/onceor the relay (docs/protocol-cloud.md). Offers are signed (SignedOffer {o, kid, sig},protocol.OpenOffer) by a pinned offer key, live at most 10 minutes, carryclientHostandverified, leavehomeempty, and a support offer comes only fromSupportClientID.battery.holdandloadpoint.boostlose their agent scope. A newagent_argsblock allowlists each op's arguments, with labels (sovoltage,max_amps_per_phaseand the rest stay with owners). Holds carry their setter, an owner's hold wins (E_NEEDS_OWNER), an agent clears only its own,maxWis |W|, and revoke or expiry ends an agent's holds.agent.confirmsigns[reqId, agent, op, sha256(args)]; request ids are 128 bits; anatMsfrom before the box started is refused.agent_argsand the op's own checks.byisstaff:<id>orbot:<name>, refused from any session but support.agent.widensigns the row's key.Roster.noise); typed readslive.get,loadpoints.get,cars.get,drivers.getin a registryreadstable, cursors on logs and events, agent ids under the box's own key.approval.key.settakesprevSig, audit rows carrycount,agent.decided,E_CLOCK_SKEW, push kindsagent.expiring,approval.key.set,owner.added,ftw.update.requestmarked reserved,E_NOT_FOUNDworded for any id (the car contract can reuse it).Vectors regenerated: approval (widen and confirm bytes changed), a signed offer, and the roster (with
noiseand an agent row).🤖 Generated with Claude Code