Multihost swarm plan: review against the credential-boundary pattern before it lands #449

Closed
opened 2026-08-11 22:16:26 +00:00 by ben · 1 comment
Owner

Context

Learning L7 of docs/research/2026-08-11-software-factory-learnings.md: Factory-in-a-Box scales by giving each run a whole
machine, with the blast radius defined by credentials, not files — the
minting credentials never leave the host, each run gets a disposable
prefix-named capped key revoked at teardown, and the prefix is the entire
safety model for reaping orphans. Our multihost plan
(docs/superpowers/plans/2026-08-11-multihost-swarm.md, claim layer in
progress — see .sandcastle/claim-lib.sh) is the right moment to design this
in; retrofitting a credential boundary onto a running fleet is far more
expensive. Meanwhile the org-level token has bitten twice: the stale-org-token
"spend limit" incident and the 2026-07-11 docker inspect exposure.

What to review (human ruling requested — Ben)

Walk the multihost plan against these questions before it merges:

  1. Per-run scoped credentials. Can each worker run receive a Forgejo
    token scoped to the one repo (and minted per run or per host, not
    org-wide)? What is the minimum scope the worker actually needs
    (push branch, close issue, comment, labels)?
  2. Mint/revoke lifecycle. Who mints (the driving host), when is it
    revoked (run end / teardown), and does a crash leak a live credential?
  3. Recognisable prefix + reaper. Are per-run credentials/artifacts named
    with a prefix so an orphan sweeper can safely reap them (the sbx-
    pattern) without ever touching a human's credential?
  4. Nesting/escalation. Is "a worker cannot mint credentials / claim work
    / spawn siblings" enforced by what credentials enter the sandbox, rather
    than by prompt or convention?
  5. Claude auth. The OAuth subscription token cannot be capped per-run —
    record explicitly what the residual exposure is on each pool host, and
    whether API-billed capped keys are warranted for pool hosts specifically.
  6. Spend attribution. Do per-run credentials give us per-run spend
    naming (ties into the swarm.db spend table)? If not, what does?

Output: rulings recorded on this issue; if the plan changes, the plan doc is
amended in the same commit as the ruling notes; any resulting build work gets
its own tickets.

References

  • docs/research/2026-08-11-software-factory-learnings.md (L7)
  • docs/superpowers/plans/2026-08-11-multihost-swarm.md
  • Factory-in-a-Box README "Tier 3: the sandbox" + credential boundary diagram
    in disler/inkwell-agent-sandboxes-and-software-factory
## Context Learning L7 of `docs/research/2026-08-11-software-factory-learnings.md`: Factory-in-a-Box scales by giving each run a whole machine, with the blast radius defined by **credentials, not files** — the minting credentials never leave the host, each run gets a disposable prefix-named capped key revoked at teardown, and the prefix is the entire safety model for reaping orphans. Our multihost plan (`docs/superpowers/plans/2026-08-11-multihost-swarm.md`, claim layer in progress — see `.sandcastle/claim-lib.sh`) is the right moment to design this in; retrofitting a credential boundary onto a running fleet is far more expensive. Meanwhile the org-level token has bitten twice: the stale-org-token "spend limit" incident and the 2026-07-11 `docker inspect` exposure. ## What to review (human ruling requested — Ben) Walk the multihost plan against these questions before it merges: 1. **Per-run scoped credentials.** Can each worker run receive a Forgejo token scoped to the one repo (and minted per run or per host, not org-wide)? What is the minimum scope the worker actually needs (push branch, close issue, comment, labels)? 2. **Mint/revoke lifecycle.** Who mints (the driving host), when is it revoked (run end / teardown), and does a crash leak a live credential? 3. **Recognisable prefix + reaper.** Are per-run credentials/artifacts named with a prefix so an orphan sweeper can safely reap them (the `sbx-` pattern) without ever touching a human's credential? 4. **Nesting/escalation.** Is "a worker cannot mint credentials / claim work / spawn siblings" enforced by what credentials enter the sandbox, rather than by prompt or convention? 5. **Claude auth.** The OAuth subscription token cannot be capped per-run — record explicitly what the residual exposure is on each pool host, and whether API-billed capped keys are warranted for pool hosts specifically. 6. **Spend attribution.** Do per-run credentials give us per-run spend naming (ties into the swarm.db `spend` table)? If not, what does? Output: rulings recorded on this issue; if the plan changes, the plan doc is amended in the same commit as the ruling notes; any resulting build work gets its own tickets. ## References - `docs/research/2026-08-11-software-factory-learnings.md` (L7) - `docs/superpowers/plans/2026-08-11-multihost-swarm.md` - Factory-in-a-Box README "Tier 3: the sandbox" + credential boundary diagram in `disler/inkwell-agent-sandboxes-and-software-factory`
Author
Owner

All six questions ruled — Ben, 2026-08-13 (session walk). Ground truth verified first: Forgejo 15 tokens scope by category on a user, never per-repo (so the per-repo boundary is a machine user as two-repo collaborator); the token in the swarm swap path is ben, is_admin=true — workers have been carrying a full forge-admin credential; swarm.db already attributes spend by run_id+issue; the Claude OAuth token ships via .env as docker run -e (docker-inspect-visible), the secrets README's one standing exception.

  1. Per-run scoped credentials (Q1): YES, via machine user. swarm-bot, write collaborator on Matou/ourcloud+Matou/matou-app only, token scoped write:repository, write:issue (the verified minimum: branch push, close, comment, labels). Swap ticket: #506.
  2. Mint/revoke lifecycle (Q2): DEFERRED with the per-run machinery (see 3).
  3. Prefix + reaper (Q3): DEFERRED with criteria. Per-run minted tokens + sbx--style prefix reaping are real machinery for marginal gain at a two-trusted-host pool. Revisit triggers, recorded in the architecture doc: an untrusted host joins the pool; a third repo joins the swarm; any credential incident.
  4. Nesting/escalation (Q4): enforced by credential, free with the swap. A write:repository+write:issue token cannot mint tokens, reach other repos, or widen itself — no reliance on prompt or convention. (Workers legitimately claim ONE ticket via claim-lib; that is the designed claim, not escalation.)
  5. Claude auth (Q5): residual ACCEPTED + documented. Both pool hosts hold the uncappable subscription OAuth token (file + docker-inspect-visible env). Bounded by host trust and docker-group membership. Flip-trigger: any not-fully-trusted pool host moves to API-billed capped keys, that host only. Recorded in docs/architecture/07-secrets-architecture.md.
  6. Spend attribution (Q6): SUFFICIENT as is. Per-run/per-ticket via spend(run_id, issue); subscription billing has no per-key axis; per-credential naming only becomes meaningful if per-run tokens are ever built.

Doc amendments in the same commit as this ruling: docs/architecture/07-secrets-architecture.md (new #449 decisions entry) + the plan's SWARM_FORGEJO_TOKEN annotation. Build work: #506. Closing.

**All six questions ruled — Ben, 2026-08-13 (session walk).** Ground truth verified first: Forgejo 15 tokens scope by *category on a user*, never per-repo (so the per-repo boundary is a machine user as two-repo collaborator); the token in the swarm swap path is `ben`, `is_admin=true` — workers have been carrying a full forge-admin credential; `swarm.db` already attributes spend by `run_id`+`issue`; the Claude OAuth token ships via `.env` as `docker run -e` (docker-inspect-visible), the secrets README's one standing exception. 1. **Per-run scoped credentials (Q1): YES, via machine user.** `swarm-bot`, write collaborator on `Matou/ourcloud`+`Matou/matou-app` only, token scoped `write:repository, write:issue` (the verified minimum: branch push, close, comment, labels). Swap ticket: #506. 2. **Mint/revoke lifecycle (Q2): DEFERRED with the per-run machinery** (see 3). 3. **Prefix + reaper (Q3): DEFERRED with criteria.** Per-run minted tokens + `sbx-`-style prefix reaping are real machinery for marginal gain at a two-trusted-host pool. Revisit triggers, recorded in the architecture doc: an untrusted host joins the pool; a third repo joins the swarm; any credential incident. 4. **Nesting/escalation (Q4): enforced by credential, free with the swap.** A `write:repository+write:issue` token cannot mint tokens, reach other repos, or widen itself — no reliance on prompt or convention. (Workers legitimately claim ONE ticket via claim-lib; that is the designed claim, not escalation.) 5. **Claude auth (Q5): residual ACCEPTED + documented.** Both pool hosts hold the uncappable subscription OAuth token (file + docker-inspect-visible env). Bounded by host trust and docker-group membership. Flip-trigger: any not-fully-trusted pool host moves to API-billed capped keys, that host only. Recorded in `docs/architecture/07-secrets-architecture.md`. 6. **Spend attribution (Q6): SUFFICIENT as is.** Per-run/per-ticket via `spend(run_id, issue)`; subscription billing has no per-key axis; per-credential naming only becomes meaningful if per-run tokens are ever built. Doc amendments in the same commit as this ruling: `docs/architecture/07-secrets-architecture.md` (new #449 decisions entry) + the plan's `SWARM_FORGEJO_TOKEN` annotation. Build work: #506. Closing.
ben closed this issue 2026-08-14 02:53:10 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#449
No description provided.