Repository navigation
Description
Depends on: #2559's workload-authentication PR (nothing is saved under the unverified placeholder workload); #2569 (the schedule grant store interface)
Removes shortcut: the broker's and AS-1's state are in memory, so a restart signs users out and gives every agent instance a new ag_ identity (#2451; the shared identity is gone since #2527)
Removes shortcut: schedule grants are held in memory; a restart loses them (#2545)
Removes shortcut: run and delegation records are capped at 4096 per session in memory, oldest forgotten first (#2557)
Removes shortcut: after a restart each agent instance registers again and its tool limit is computed afresh against the definitions and gateway servers loaded then, so a longer server list can widen it under the same definition revision (#2842)
Problem
Broker sessions, refresh tokens, agent identities, call decisions, and schedule grants live only in memory, as do AS-1's users and grants. A restart signs every user out, gives them new AS-1 subjects, voids every session's refresh token, and stops every schedule.
Implements
- credentials-and-lifecycle.md: Pauses and restart
- credentials-and-lifecycle.md: (3) Session open and the broker refresh token: shared storage, converted
jtis, closed records for checks 2 and 3 - credentials-and-lifecycle.md: Schedule setup: grants stored under the schedule with the owner
- agent-definitions.md: Identity continuity across runs and restarts
- implementation.md: Grant record: the broker grant record
- implementation.md: Modulith constraints: separate storage
- implementation.md: Session binding checks
Scope
- Broker records: sessions and their bindings; refresh tokens with the grant record; converted
jtis; pending AS-1 revocations (Sign-out and revocation #2568); instances with definition records,ag_identifiers, and issued-credential hashes; call decisions and retry state. - Schedule grants: behind Phase 2, Slice 3: Scheduled runs — A scheduled run calls gateway tools on its own grant, with no one present #2569's interface, owner kept across renewals and revocations, recovered after restart.
- Secrets: refresh tokens and schedule grants protected at rest, never logged or returned by a read API.
- AS-1: its users, upstream tokens, grants, and pending authorizations in ToolHive's Redis storage, keeping the pending-authorization cap, separate from AS-2's. Its signing key is Keys and gateway entries for the identity broker #2538's.
- Identifier lengths (host session, owner) bounded before they become stored schema and before Broker over gRPC, authenticated as the mecak8s workload #2559's contract.
- Retention: the latest closed record per root host session kept; closed records purged after a retention period set in the broker's file, at least AS-1's access-token lifetime plus the clock skew, so a reopen still finds the closed record (step (3), check 3); agent records purged once their session is closed and credentials expired; sessions whose host session is gone closed.
- mecak8s's held agent credentials (
internal/agentcredential) are in memory too: after a restart, run entry registers the main agent again and a resumed helper registers as a new one. Recovery should keep their identities. - Grants keyed by (session, user), with exactly one entry per session for now (
run-owner.mditem 3, moved from Runs, delegations, and the run owner #2557). In memory the grant only records its owner. - Run and delegation records (Runs, delegations, and the run owner #2557) and each instance's effective tool limit with its resolution inputs (Per-agent tool limit, checked by the broker #2842): kept for the session's life as the design says, with a retention rule in place of the in-memory cap.
- Not here: vMCP sessions, send-once, and parked calls (MCP client state: one vMCP session per agent, durable send-once and parked calls #2564).
Decide before starting
- How are sessions whose host session is gone found: a periodic reconcile, or a lease mecak8s renews?
- The grant record's open item: persistence ordering of correlation records across a restart.
- Schedules pin the exact definition revision they were set up with (docs(agent-identity): keep a re-registered instance's revision, and pin a schedule's definition #2866). Once schedules survive restarts, a restart that loads a newer revision leaves the pinned one unavailable. What happens then: the run stops and the owner re-approves the schedule, or the schedule follows the new revision but never gets more tools than it was set up with, or both? Record the answer in the design.
Done when
- After a restart, sessions, refresh tokens, schedule grants, instances, and decision records recover with the same IDs and owners, without a new sign-in; schedules keep running.
- A parked call resumed after a broker restart is authorized again.
- AS-1 keeps each user's subject and accepts refresh tokens issued before the restart.
- Unrecoverable state, or another workload, fails closed.
- Refresh tokens and schedule grants never appear in logs or read APIs.
Earlier notes: #2847 (closed; storage part merged here, revocation part into #2568).
Activity
test(e2e): check AS-1 isolation and claim checks; tighten private IdP…
test(e2e): check AS-1 isolation and claim checks; tighten private IdP…
ChrisJBurns commentedon Nov 18, 2026
Design decision for this ticket: how a durable schedule picks up a changed agent definition. #2866 pins the exact revision for now; once schedules survive restarts (this ticket), a restart can load a newer revision and leave the pinned one unavailable. Options: the owner re-approves the schedule, or the schedule follows the new revision but never gets more tools than it was set up with, or both. Record the answer in credentials-and-lifecycle.md: Schedule setup when this ticket is picked up.
rdimitrov commentedon Nov 20, 2026
Run and delegation state after #2557
#2557 (PR #2930) added two pieces of in-memory state and names this ticket as where they become durable. Neither is in the scope list above yet:
internal/identitybroker/runs.go). They should recover with the session. Otherwise a helper still running after a restart has its calls refused until it is delegated again.agentcredential.Holderkeeps each helper's current delegation and an ordered list of every delegation in the tree, at most 4096 per root. Run entry uses the list to report delegations again after the broker session reopens. This is the same in-memory holder the scope already mentions for agent credentials. Recovery should keep these delegations along with the identities, or report them again from durable state.Recovery also has to keep the order: a delegating run must be recorded before the runs it delegated to.
chore(identitybroker): mark the secrets still generated at startup as…
fix(identitybroker): tighten the tool limit after review
docs(agent-identity): answer the review of the write-order rules
rdimitrov commentedon Nov 25, 2026
#2985 adds in-memory broker state that durable storage must keep: the open record reference on each grant and user, each registration's record, each delegation's latest accepted record by root host session, and close records waiting to be sent.
rdimitrov commentedon Nov 25, 2026
Follow-up from #2985: the broker's queued records are in-memory state too. That is the bounded queue of close and refusal records (denied-call decisions included) that
Broker.Closedrains at shutdown, and a held close that a refused open keeps back until its refusal is queued. A restart loses both, and the queue's order is the only record of which close follows which refusal. Making the broker's state durable should cover them, or this ticket should decide that #2848's lossless delivery does.fix(identitybroker): address the fourth review of the broker records