Skip to content

Identity: add an unlisted attestation pool and take command - #354

Open
drapeau-stripe wants to merge 2 commits into
drapeau/identity-list-showfrom
drapeau/identity-attestation-pool
Open

drapeau-stripe wants to merge 2 commits into
drapeau/identity-list-showfrom
drapeau/identity-attestation-pool

Conversation

@drapeau-stripe

@drapeau-stripe drapeau-stripe commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Every AAT request currently creates another batch file, leaving agents to track token usage themselves. Add a CLI-managed pool and take so an agent can obtain one token for its browser or HTTP client without managing those files. Explicit batch export remains available for agents that want to own token management.

Stacked on #353. All commands remain Unlisted and excluded from MCP; wallet credentials are unchanged.

export LINK_IDENTITY_COMMANDS=1
link-cli identity attestations request --count 10
link-cli identity attestations take --format json

Sample take output:

{"issuer":"https://api.link.com","token_key_id":"","token":"","authorization":"PrivateToken token=\"\""}

For an independently managed batch:

link-cli identity attestations request --count 10 --output-file ./aats.json

Default requests append to ~/.link-cli/attestations/pool.json. take removes a token before returning it; an empty pool reports ATTESTATION_POOL_EMPTY. Exports never enter the pool, and existing exports are not auto-imported. list distinguishes pool batches from exports and retains per-batch stored_token_count and aggregate total_token_count.

Append and take share an exclusive lock and atomic file replacement. Locks are never stolen based on age; a crashed holder requires explicit recovery after ensuring no commands are active. A crash after removal can lose a token. POSIX syncs the file and directory; Windows uses file sync and atomic rename.

Validation: 38 focused tests passed, including mocked request→list→take/export flows, separate-process concurrency, failed writes, corrupt pools, and export path aliases. A usage agent passed 44 built-CLI checks covering terminals, formats, contention, and MCP exclusion. CI passed, including build, typecheck, lint, the full test suite, Go race tests, and package publishing checks; independent review found no remaining actionable issues. Windows was not runtime-tested.

r? @drapeau-stripe

-- Written by Codex

Store default issuance batches in one managed pool and remove each token before returning it to an agent. Explicit exports let callers manage their own batches without sharing consumption state with the CLI.

Serialize pool mutations with an exclusive lock and atomic replacement. Never steal locks based on age, since a paused writer could restore tokens already handed out.

Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@drapeau-stripe
drapeau-stripe requested a review from a team as a code owner September 18, 2026 23:57
@drapeau-stripe drapeau-stripe self-assigned this Sep 18, 2026
Keep the existing non-secret terminal confirmation test aligned with the pool path and version-2 storage format.

Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant