Repository navigation
Agents: an external key registers its own agent, naming its owner (0.1.14) - #12
Merged
Merged
Conversation
…1.14) Registering an agent needed an Admin to type the handle before the key could be used. Minting an external-subject key already needs a Project admin, so that is the admission decision: POST /agents/register creates the agent from the assertion's handle with the owner the agent names. The owner must have a signed-in write in this workspace; the claim is recorded with the key name (registeredByKey). Disabled agents cannot register again.
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.
Why
An agent could not use its key until a Tracker Admin had registered the same handle by hand (
POST /agents). Minting an external-subject key already needs a Project admin, so the second approval added a step and no decision.What
POST /agents/register{ name, description?, ownerSub }: an external key whose handle is not registered creates its own agent (201). Already registered and active → 200 with the existing agent, body not applied, so an agent can call it on every start. The handle is the assertion's subject, never a body field.store.KnownName), and the agent recordsregisteredByKey(the Access Key name). The Agents page marks self-registered agents and says the owner is unconfirmed.key_subject). The route ignoresIdempotency-Key, so a stored 201 is never replayed after a disable.GET /agent-guide; every other route still answers 403key_subject, now naming the route to call.ownerSub.design/API.md§ Self-registration (v0.1.14). Migration 014 addstracker_agent.registered_key.Review focus (authorization boundary)
route()incmd/server/internal/api/api.go: theunregisteredflag lets exactly two routes proceed whenAgentBySubjectanswerskey_subject.RegisterAgentincmd/server/internal/store/agents.go:CreateAgentkeeps its Admin check; self-registration does not go through it.Verification
go vet ./cmd/...;go test -count=1 ./cmd/...against a disposable Postgres 17: all packages passed (CI skips the database tests).web:tsc --noEmit,bun test src;bun test hack.