Repository navigation
feat(identitybroker): give each agent its own identity, checked against loaded definitions - #2883
Merged
Merged
Conversation
…st loaded definitions Each agent instance now gets its own ag_ identifier when its incarnation first registers, kept for good, and the SPIFFE ID spiffe://<trust domain>/agent/<ag_ identifier>, which carries no definition name, incarnation, or ancestry. act.sub is that ID. The shared agent identity is removed. A new instance must name exactly a definition the broker loaded; an instance registering again is checked against its earlier registration, definition included, instead of the definitions loaded now. Startup loads the built-ins and the operator's global definitions from the agents directories, fails when one cannot be read, and logs each definition left out. The server registers a session's main agent with the loaded reference. The check that a registration answers its request moves into the broker package as CheckRegistration. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- CheckRegistration validates the trust domain with ValidateTrustDomain, and its tests pair each malformed ID with a credential naming it, so only the ID's form can fail them. - The server's IdentityDefinitions holds references only, marked as the #2548 shortcut, and the server logs a warning when a session runs a definition the broker did not load. - Test fixtures use the per-agent ID format; the D4 test gains a positive control; the mecak8s identity tests register with the loaded built-in main; the server test credential helper is shared. - The service contract documents CodeAborted; the operator docs say how to set the agents directory under Helm. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The server maps a session's agent name to the broker's global record, which holds only while the operator's agent directories win every name. An operator harness_context policy can let another source, such as a driver, win a name the broker loaded, so under a policy the server gets only the built-in references: named sessions are refused instead of registering another source's definition as the operator's. Also from review: conformance.DefinitionRefs gives the server tests one list of what the contract broker loaded, and a test checks AuthorizeCall refuses an agent registered to another session of the same broker without an ID-JAG exchange. The operator docs note the policy behavior. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 20, 2026
ChrisJBurns
reviewed
Nov 20, 2026
ChrisJBurns
left a comment
Contributor
There was a problem hiding this comment.
See the inline comments.
ChrisJBurns
approved these changes
Nov 20, 2026
…y broker A server with an identity broker but no IdentityDefinitions sent every agent's definition by name only, which the broker refuses, so every run failed at run entry with only a warning. NewService now refuses that configuration, and composition with an injected broker core still sends the references of the definitions its configuration loads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ChrisJBurns
approved these changes
Nov 20, 2026
Co-authored-by: Claude Opus 5.5 <[email protected]>
) Co-authored-by: Claude Opus 5.5 <[email protected]>
jhrozek
added a commit
that referenced
this pull request
Nov 21, 2026
…on test Since per-agent identities (#2883) the broker accepts only definitions it loaded, so registering {system, main} with no revision is refused with "the definition is not one the broker loaded". The rotation test needs a registered agent to obtain a credential, so register the built-in main by its loaded reference, builtinMainRef(). Co-Authored-By: mecatl <[email protected]>
jhrozek
added a commit
that referenced
this pull request
Nov 21, 2026
The identityBroker.enabled row said each subagent, parallel branch, and team member gets its own agent identity. No Parallel branch can run beside the broker: Parallel forks only a local workspace, which the broker refuses. The sentence arrived with the per-agent identities text (#2883) and became false once it met this PR's workspace rule. Co-Authored-By: mecatl <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every agent used to share one agent identity, so a grant, AS-1's actor check, and a gateway record could not tell which agent acted. Each agent instance now gets its own identity, and registration checks it against the definitions the broker loaded.
ag_identifier when its incarnation first registers, kept for good, and the SPIFFE IDspiffe://<trust domain>/agent/<ag_ identifier>. The ID carries no definition name, incarnation, or ancestry; the broker's record keeps those. Registering into a new broker session keeps the identity.act.subis this ID. The shared identity (/mecatl/agent/shared/inst/<incarnation>and the per-processag_) is removed.PERMISSION_DENIED.ALREADY_EXISTSotherwise). Per D4 (docs(agent-identity): keep a re-registered instance's revision, and pin a schedule's definition #2866), it is not checked against the definitions loaded now.NewServicerefuses an identity broker withoutIdentityDefinitions, so a missing list fails at startup instead of at every run, and composition with an injected test core loads the configured definitions (review follow-up).global/<name>at the loader's revision, orsystem/mainat the release's revision. A name the broker did not load is sent by name only and logged; the broker refuses it. Under an operatorharness_contextpolicy, which can order agent-definition sources or exclude one per name so that another source (such as a driver) wins a name the broker loaded, the server is given only the built-in references, so named sessions are refused rather than registered as the operator's definition.identitybroker.CheckRegistration. The client-side check that a registration answers its request moves into the broker package, which owns the ID format: the agent must be an agent instance's SPIFFE ID, and the credential'ssubmust name it. The credential holder keeps its comparison with the agent it held before.identityBroker.enabledrow describes the new behavior, and the design's "Loading definitions" no longer names the--agents-dirflag (review follow-up from docs(agent-identity): record which source tiers hold global definitions #2874).Issue relationship
Closes #2527. Closes #2555. Part of #2550 and #2554.
Carries #2912, #2913, and #2914 (#2555), merged into this branch; their closing keywords do not act on a non-default branch, so this PR closes #2555.
Type of change
Test plan
Baseline checks
task lint)task test:race)task docs)task site:build)task api:check): the engine is unchangedtask api:update+engine/CHANGELOG.md: not applicableContract tests (
internal/identitybroker/conformance)Every implementation now loads
conformance.Definitions(). New and changed cases:ALREADY_EXISTS, and the agent is unchanged;ag_identifier, and its SPIFFE ID is both its subject and its actor ID;Other tests
CheckRegistrationrejects malformed IDs and a credential naming another agent.identityAgentDefinitionpicks the loaded built-in or global reference, sends an unloaded name by name only, and never matches a name to a built-in; a session running an unloaded definition is refused and logged, with a positive control.AuthorizeCallrefuses an agent registered to another session of the same broker without an ID-JAG exchange, with a positive control in the agent's own session.Changes
internal/identitybroker/agents.go,credential.go,sessions.go,broker.goCheckRegistrationinternal/identitybroker/service.go,definition.gointernal/identitybroker/conformance/*internal/agentcredential/holder.goCheckRegistrationinternal/adapter/server/identity_broker.go,service.goIdentityDefinitions; sends the loaded referenceinternal/app/identitybroker.go,build.godocs/drafts/agent-identity/agent-definitions.mduser-docs/operating/mecak8s/identity-and-client-access.md*_test.goAPI compatibility
--enable-identity-brokeron:session_agent_definitions.CreateSession.agent_definition_name(orPOST /v1/sessions) naming an agent from a project, user, or driver source still creates the session, and still echoesresolved_agent_definition_name. Its runs, though, now fail at run entry with the existing internal error, because the broker refuses to register an agent whose definition it did not load. Before this change the shared identity registered any definition. Built-in sessions, and sessions named after an agent in the--agents-dirdirectories, are unchanged, except under an operatorharness_contextpolicy, where every named session is refused.act.sub. The ID-JAGs AS-1 issues for the gateway carry one SPIFFE ID per agent instead of one per process. The format,spiffe://<trust domain>/agent/<ag_ identifier>, is unchanged. Production configures no gateway yet.act.subchange keeps its format and meaning ("the acting agent"), and is now more precise.CreateSessionhas succeeded and echoed the definition; Full definition loader and registration rules #2551 replaces that with a refusal.port.ChildSessionCreator,port.ChildSessionResumer,port.ChildSessionInfo,agent.MemberBuild.DefinitionName), "Added" (minor), with no wire change.--agents-dirdirectories cannot start, nor any named helper under aharness_contextpolicy; the parent gets the existing creation-failure tool result. An API team whose member cannot register failsRunTeamwith that registration's class. Same rationale for no major bump as above.--agents-dirdirectory. Under aharness_contextpolicy, named agents cannot run with the broker until Sessions run and register the exact definition revision #2548. A missing--agents-dirdirectory now stops startup. The server logs a warning naming the session and definition when it registers an agent whose definition the broker did not load.User-facing change
Only with
--enable-identity-broker:--agents-dirdirectories cannot run, and under aharness_contextpolicy no named agent can;--agents-dirdirectory stops startup.With #2913 and #2914: each helper (subagent, parallel branch, team member) also gets its own identity under the agent that created it, and a helper naming an agent outside the
--agents-dirdirectories cannot start. Helpers that run no named agent can call the MCP gateway's tools under their own identity.Special notes for reviewers
ABORTED.RegisterAgentretries once when another first registration of the same incarnation recorded its identity while this one was signing; identities are never reassigned, so the retry succeeds.CodeAbortedis reachable only if two fresh 128-bitag_identifiers collide in a row, and the contract says registering again succeeds.CheckRegistration's format check.🤖 Generated with Claude Code