Repository navigation
feat(agents): server-managed Agent keyrings and key-bearing tokens - #1102
Merged
Merged
Conversation
…g tokens
Agent tokens were bearer-only (pss_agent:v1), so letting them read app
secrets or end-to-end credentials later would have meant a new token
format and reissuing every token.
Each Agent now gets an Ed25519 keyring at creation, wrapped for the
server like a service account with server-side key management, and
shared by all of its Workflows. Tokens stay scoped to one Workflow and
are minted as pss_agent:v2:{token}:{kx_pub}:{share_a}:{wrap_key}; the
server keeps only the bearer digest and the wrapped second share.
Authentication still uses the bearer part alone. Deleting an Agent wipes
its server copies, and the Agent page shows server-side KMS.
The fields mirror ServiceAccount so client-side key management can be
added later without changing tokens.
No release has ever minted pss_agent tokens, so the first released form
is pss_agent:v1:{token}:{kx_pub}:{share_a}:{wrap_key}. The prefix alone
selects Agent authentication, so the version does not need to match
Service Account tokens.
- The REST mint now returns 403 invalid_agent_keyring when the Agent's keyring does not open, and 404 workflow_not_found if the Workflow is retired mid-request, instead of a 500. Adds endpoint tests, which did not exist (the CLI's Agent SDK uses this endpoint). - Retiring a token clears its wrapped key share, on every path: token, Workflow and Agent deletion, and member retirement. An old token string can no longer rebuild the Agent key from a copy of the row. - Documents that the Agent, not the Workflow, is the cryptographic principal: Workflow isolation is enforced by the server.
rohan-chaturvedi
self-requested a review
October 29, 2026 09:55
rohan-chaturvedi
approved these changes
Oct 29, 2026
3 of 6 tasks
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
pss_agent:v1:{token}:{kx_pub}:{share_a}:{wrap_key}. This is the first released Agent token form, so it starts at v1. The server stores only the bearer digest and the wrapped second share. Authentication is unchanged (Bearer Agent <token>), and the GraphQL and REST mint endpoints both return the full token.403 invalid_agent_keyringwhen the keyring doesn't open, rather than a 500.ServiceAccount, so client-side key management can be added later without changing the token format.CLI side: phasehq/cli#327.
Migration
0144_agentsis edited in place (unreleased). To update a local database: deleteAuditEventrows withresource_type='agent_request'(the rollback shrinks that column back to 10 characters), thenmigrate api 0143andmigrate api. This wipes local Agent data.Testing
tests/test_auth_password.py, and a file-permission test that cannot pass as root in the container).