Repository navigation
Add agent connection grants for programs connected to a product - #176
Merged
Merged
Conversation
A program a person connects to a product (an MCP client) was pinned to that person's session proof and died at its absolute sign-in deadline however much it was used. An agent connection grant is issued from a live session proof for one person, organisation and team, then lives on a 90-day idle clock that only the program's own use slides, under an optional organisation ceiling. Every renewal rechecks revocation, the credential epoch, active user and role, organisation and team membership, unpaid seats, the product mapping, SSO policy generation and, for SSO grants, the connection, external identity and provisioning. The new agent.connection mapping scope is the per-product switch and can never be minted through /auth/token. Grants carry no assurance id and cannot pass for a session proof; their resource tokens carry agent_connection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nessie at api.nessie.works holds agent connection grants for https://api.nessie.works/mcp without an operator mapping, as a first-party product. Other products still need an enabled agent.connection mapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rafiki270
marked this pull request as ready for review
November 22, 2026 22:17
rafiki270
enabled auto-merge
November 22, 2026 22:17
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
A program a person connects to a product, such as ChatGPT or Claude through Nessie MCP, currently dies at that person's absolute sign-in deadline, used or not. This adds a separate grant for such a connection that lasts until it is revoked or goes 90 days unused, as Microsoft and Atlassian refresh tokens do. Session assurance is unchanged and keeps its absolute deadline.
POST /auth/agent-grants(agent-connection-grant.service.ts): issues one grant per (connection, team). It requires the person's live, unexpired independent or SSO proof for that exact team, carried asassurance_refin a fresh subject assertion; recovery proofs are refused. The proof's evidence is copied onto the grant: method, SSO connection revision and generation, external identity, MFA source, AMR and policy generation. The samerequest_idrecovers the same handle.POST /auth/agent-grants/:handle/renew: returns the current org context and, on request, a 120-second resource token for a mapped downstream resource (ai.invoke,billing.read,memory.*).agent-connection-grant-evidence.service.tsand are threaded throughassertOrgAccessPolicy/getActiveClientOrgContextasagentGrant, so SSO-governed organisations admit a grant only with matching SSO evidence.touch: trueslides the idle deadline, at most hourly. Reconciliation and background work sendfalse.POST /auth/agent-grants/:handle/revoke: idempotent, and needs no current membership.agent.connectionscope onConfidentialDelegationMappingis the per-product switch.resolveConfidentialDelegationaccepts it only from the grant service and only on its own, so/auth/tokencan never mint it. The Admin delegation form offers it.agent_connection {grant_handle, connection_id}and noassurance_id.agent_connection_max_daysonPUT /org/organisations/:orgId(1–3650 or null) sets an optional absolute ceiling. It is read live, so lowering it applies to existing grants.20261122200000_agent_connection_grants: adds the enum value, the org column with a check constraint, and the table with the sameuoa_appdeny and RLS assales_research_job_grants./apiand/llm:schema.auth-agent-grants.ts,llm-agent-grants.ts, and the org schema field.On for Nessie from the start:
FIRST_PARTY_AGENT_CONNECTIONSletsapi.nessie.workshold grants forhttps://api.nessie.works/mcpwithout a mapping row. Other products need an enabledagent.connectionmapping. Nessie's side is the next PR. Plan: UnlikeOtherAI/Nessie#1857.Testing
Run on Minis against Postgres 16 (Maxis was at 82% CPU from other work):
@uoa/apitypecheck and lint,@uoa/admintypecheck and lint: pass.tests/integration/agent-connection-grant.test.ts, 5 tests (the fifth: a non-first-party product stops when its mapping is disabled):agent.connectionandtoken.provisionare refused and/auth/tokenresolution ofagent.connectionis rejected.auth-rate-limit-global.test.ts. The CSP and bootstrap suites need a builtAuth/dist, and passed once it was built.validateSessionAssurance.🤖 Generated with Claude Code