swarm credential swap: workers carry a swarm-bot machine token, never an admin PAT (#449 Q1+Q4) #506
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#506
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From #449 (Ben's ruling 2026-08-13, Q1+Q4): the swarm workers must carry a scoped machine-user token, not an admin PAT. Verified during the ruling: the token in the swap path is
benwithis_admin=true— every worker sandbox currently holds a full forge-admin credential as a read-only file.The swap (human hands — forge admin + org secret rotation)
SWARM_FORGEJO_TOKENcurrently holds (expected: the same admin PAT; verified locally in.sandcastle/.env).POST /api/v1/admin/users→ machine userswarm-bot(noreply email, strong password stored in Ben's password manager,must_change_password: false).swarm-botas write collaborator onMatou/ourcloudandMatou/matou-app(PUT /repos/{owner}/{repo}/collaborators/swarm-botwith{"permission":"write"}).swarm-bot(basic auth):POST /api/v1/users/swarm-bot/tokenswith scopeswrite:repository, write:issue— the minimum the workers use (branch push, issue close/comment/labels).SWARM_FORGEJO_TOKENto the new token (covers both repos' workflows). Update host-side manual-run residue where present (.sandcastle/secrets/forgejo_tokenis materialized from env per run; workstation/elitebook crontab env if any).agent-workingPUT, branch push, close-report).Rollback: the old PAT stays valid until step 6, so a red at step 5 = set the secret back and diagnose.
Escalation posture this buys (Q4): without
admin/org scope a worker cannot mint tokens, reach other repos, or widen itself — enforced by the credential, not by prompt. Seedocs/architecture/07-secrets-architecture.md(#449 rulings entry).Relabelled
ready-for-sessionunder ADR 0174: steps 0–5 are executable by a session holding the admin PAT (mintswarm-bot, collaborator grants, scoped token, org-secret rotation, green-cycle proof) and are reversible while the old PAT stays valid. The Ben residue — storing the generated password in his password manager and step 6 (rotating his personal PAT) — is one-way-door and rides the next digest.Triage: added the missing category label; state (
ready-for-session, already reasoned in this thread) left as-is.Session-runner pass under ADR 0174 (
docs/adr/0174-two-way-door-rulings-default-to-the-agent.md). Findings, then the routing.Step 0 (confirm the org secret) — partially done, read-only.
GET /api/v1/orgs/Matou/actions/secretsshowsSWARM_FORGEJO_TOKENexists,created_at: 2026-07-23T07:23:26Z, never rotated since (Forgejo's secrets API is write-only — no value readback, onlycreated_at). Consistent with the ticket's expectation that it still holds the original admin PAT; can't be fully confirmed byte-for-byte without a human comparing it against wherever that PAT is recorded, since neither the API nor this session can read a secret's value.Steps 1–3 (mint
swarm-bot) — blocked, needs Ben, both technically and by policy.FORGEJO_TOKENresolves toben,is_admin: true— butGET /api/v1/admin/users403s withtoken does not have at least one of required scope(s): [read:admin]. The account is admin; the token isn't scoped for the admin user-management API.POST /api/v1/admin/users(step 1) needs a credential withadmintoken scope, which nothing in this session's standing carries. This isn't a policy choice to route around — no token available to the swarm or this session can mint a forge user.swarm-botto exist, then its password for the basic-auth token mint), so they inherit the same block.Step 6 (rotate Ben's personal PAT) — one-way door by name. ADR 0174's list: "Ben's own PAT/tokens" — explicit, no ambiguity.
Steps 4–5 are genuinely two-way (org-secret rotation while the old credential stays valid is named directly in ADR 0174 as agent-executable; the claim→work→push→close proof is provable by the existing swarm cycle) but are sequentially gated behind 1–3 — there's no
swarm-bottoken yet to rotate in or prove against. Nothing to land this session.Why human
Ben's hands + a one-way-door ruling: mint
swarm-botvia the forge admin UI (or a session token he holds that actually carriesadminscope) and its noreply-email/strong-password per step 1, store the password in his password manager, add it as write collaborator on both repos (step 2), mint itswrite:repository, write:issuetoken (step 3) — then either finish steps 4–6 himself, or drop the new token as a host-only secret (per this session's own secrets rule) so a follow-upready-for-sessionpass can execute step 4 (org secret rotation) and step 5 (proof dispatch) as two-way doors, leaving only step 6 (his personal PAT rotation) for him.Leaving this
ready-for-human; relabelling now. Ruled by agent under ADR 0174 — veto anytime.Steps 1–3 done (Ben's session, 2026-08-19):
swarm-botmachine user created (private, noreply email, password in Ben's manager), write collaborator onMatou/ourcloud+Matou/matou-app, scoped token minted (write:issue,write:repositoryonly). Proven: push=true on both repos,/api/v1/admin/*= 403.Remaining: step 4 (rotate org Actions secret
SWARM_FORGEJO_TOKENto the swarm-bot token — awaiting Ben's go in-session), step 5 (watch the next swarm run go green on the new credential; rollback = set the secret back), step 6 (afterwards, Ben rotates his personal admin PAT).Step 5 PROVEN (2026-08-19 ~19:00–20:10Z): org secret rotated to the swarm-bot token in-session; subsequent swarm runs all green and issue actions now authored by
swarm-bot(first proof: the 19:06 swarm-claim comment on #594). Remaining: step 6 — Ben rotates his personal admin PAT (it rode in worker sandboxes since the pool went live). Note for the rotation: the dev laptop's.sandcastle/secrets/forgejo_tokenholds that PAT and must be updated with the re-minted one.Step 6 done, 2026-08-25 (interactive session) — the swap is complete end to end.
Ben regenerated the admin PAT in the Forgejo UI (regeneration invalidates the old value — the token that rode readable in every worker sandbox since the pool went live is now dead), and both laptop homes were updated in the same sitting:
~/.git-credentialsand.sandcastle/secrets/forgejo_token(.sandcastle/.envcarried noFORGEJO_TOKEN=line to update). Verified live:GET /userwith the new credential answers asben(admin), and git fetch auth againstoriginworks.Recap of the whole ticket: workers carry the scoped
swarm-botmachine token via the org Actions secret (steps 1–5, proven 2026-08-19 — issue actions author asswarm-bot); the exposed admin credential is retired (step 6, today). No worker sandbox holds forge-admin anything.