Host registry: credentials org|host scope so a device can run on its OWN Claude token (Actions legs included) #199

Open
opened 2026-10-15 02:59:05 +00:00 by ben · 1 comment
Owner

Filed from the 2026-10-14 infrastructure review (Claude Code session on Ben's workstation; four parallel read-only review passes over the root harness). Line anchors are against main at 3e50274.

Symptom

Goal: multiple devices, each able to use its own or a shared Claude token. Today:

  • Every Actions step sets CLAUDE_CODE_OAUTH_TOKEN/_B from ORG secrets (swarm.yml:71-72,213-214, triage.yml:40-41,191-192, healer.yml:23-24, templates identical). A step-level env: always sets the variable (an unset secret renders as an empty string), so act_runner envs/env_file cannot override it. A third party's machine registered with the pool label receives every org secret on every job (swarm.yml.tmpl:66-76).
  • The host registry (onboarding/host-state-lib.sh:140-203) has env (host-shared) and repo-env (per repo) directives — so CRON legs (session-runner, backstop) CAN already run on a host owner's token (mechanism verified, use untested) — but no owner/credentials directive, and the host env file is today a synced COPY of the org secret (onboarding/README.md:144-150), not a host credential.
  • The park-wiring guard (park-wiring-lib.sh:39-45, preflight-swarm.sh:280-299) asserts _B is referenced in the WORKFLOW and would fail or mislead for a host-declared standby.

Proposed change

  1. Registry: credentials org|host (default org) and secrets-dir <dir> per host; emitted by host_state_capacity_env into host-capacity.env.
  2. limit-lib.sh claude_select_token: documented precedence — <secrets-dir>/claude_oauth_token[_b] (host) > process env (org). Touch every caller: execute-lib.sh:109, run-triage.sh:273, heal.sh:363, session-runner.sh:562, rehearsal-report.sh:388,720, landing-lib.sh:441 (add), onboard-lib.sh:803 verify-creds.
  3. onboard.sh workflows: for a credentials host host, register its runner under a NON-pool label and render that host's matrix leg WITHOUT the secrets.CLAUDE_CODE_OAUTH_TOKEN* lines (the host file supplies them via #198's provision step).
  4. Park-wiring guard: accept a host-declared standby.
  5. onboard-host claim-probe asserts which bot identity the claim comment carries.

Acceptance

  • A registry with credentials host renders a swarm leg with no Claude org secret references (fixture + onboarding/tests/onboard-lib-test.sh).
  • tests/limit-lib-test.sh pins the precedence order.
  • Docs: onboarding/templates/host-registry.conf.example and install-prompt.md describe both scopes.

depends_on

#198

needs_human_decision

Whether an externally-owned host may ALSO receive the org FORGEJO/Mattermost tokens, or only a per-repo bot token (#201). Proposed default: per-repo bot token only.

_Filed from the 2026-10-14 infrastructure review (Claude Code session on Ben's workstation; four parallel read-only review passes over the root harness). Line anchors are against `main` at 3e50274._ ## Symptom Goal: multiple devices, each able to use its own or a shared Claude token. Today: - Every Actions step sets `CLAUDE_CODE_OAUTH_TOKEN`/`_B` from ORG secrets (`swarm.yml:71-72,213-214`, `triage.yml:40-41,191-192`, `healer.yml:23-24`, templates identical). A step-level `env:` always sets the variable (an unset secret renders as an empty string), so act_runner `envs`/`env_file` cannot override it. A third party's machine registered with the pool label receives every org secret on every job (`swarm.yml.tmpl:66-76`). - The host registry (`onboarding/host-state-lib.sh:140-203`) has `env` (host-shared) and `repo-env` (per repo) directives — so CRON legs (session-runner, backstop) CAN already run on a host owner's token (mechanism verified, use untested) — but no `owner`/`credentials` directive, and the host env file is today a synced COPY of the org secret (`onboarding/README.md:144-150`), not a host credential. - The park-wiring guard (`park-wiring-lib.sh:39-45`, `preflight-swarm.sh:280-299`) asserts `_B` is referenced in the WORKFLOW and would fail or mislead for a host-declared standby. ## Proposed change 1. Registry: `credentials org|host` (default `org`) and `secrets-dir <dir>` per host; emitted by `host_state_capacity_env` into `host-capacity.env`. 2. `limit-lib.sh claude_select_token`: documented precedence — `<secrets-dir>/claude_oauth_token[_b]` (host) > process env (org). Touch every caller: `execute-lib.sh:109`, `run-triage.sh:273`, `heal.sh:363`, `session-runner.sh:562`, `rehearsal-report.sh:388,720`, `landing-lib.sh:441` (add), `onboard-lib.sh:803` verify-creds. 3. `onboard.sh workflows`: for a `credentials host` host, register its runner under a NON-pool label and render that host's matrix leg WITHOUT the `secrets.CLAUDE_CODE_OAUTH_TOKEN*` lines (the host file supplies them via #198's provision step). 4. Park-wiring guard: accept a host-declared standby. 5. `onboard-host claim-probe` asserts which bot identity the claim comment carries. ## Acceptance - A registry with `credentials host` renders a swarm leg with no Claude org secret references (fixture + `onboarding/tests/onboard-lib-test.sh`). - `tests/limit-lib-test.sh` pins the precedence order. - Docs: `onboarding/templates/host-registry.conf.example` and `install-prompt.md` describe both scopes. ## depends_on #198 ## needs_human_decision Whether an externally-owned host may ALSO receive the org FORGEJO/Mattermost tokens, or only a per-repo bot token (#201). Proposed default: per-repo bot token only.

This was generated by AI during triage.

Agent Brief

Category: enhancement

Summary: Add a per-host registry credentials org|host (plus secrets-dir) scope so a device can run the swarm on its own (or a shared) Claude token — including Forgejo Actions legs — with its runner registered under a non-pool label and its workflow rendered without org Claude-secret references.

Current behavior: Every workflow step sets the Claude token from org secrets, so any machine registered with the pool label receives every org secret on every job; a step-level env: always wins over a runner's env_file. The host registry can give cron legs a host/per-repo env file, but has no way to declare that a host owns its credentials, and the park-wiring guard assumes the standby token is referenced in the workflow.

Desired behavior: A registry directive declares a host's credential scope (org default, or host) and a secrets directory; the capacity emitter surfaces it. Token selection gains a documented precedence: host secrets-dir file over process env. For a credentials host host, workflow rendering registers its runner under a non-pool label and omits the org Claude-secret lines (the host supplies them via the #198 file mechanism). The park-wiring guard accepts a host-declared standby, and the claim-probe asserts which bot identity the claim comment carries.

Key interfaces:

  • Registry directive credentials org|host (default org) and secrets-dir <dir>, emitted into the host-capacity env.
  • Token-selection precedence: host secrets-dir file > process env, honored by every CLI caller.
  • Workflow renderer: non-pool label + no org Claude-secret references for a credentials host host.
  • Park-wiring guard recognizes a host-declared standby rather than requiring a workflow reference.

Acceptance criteria:

  • A registry with credentials host renders a swarm leg with no org Claude-secret references (fixture + onboard-lib test).
  • The token-selection precedence order is pinned by the limit-lib test.
  • The host-registry example config and install prompt document both scopes.
  • The park-wiring guard passes a host-declared standby.

Out of scope: Delivering the token as a file (#198, prerequisite); per-token spend fingerprinting (#200); provisioning the actual host/runner and its credentials.

Why human

The one-way residue is the explicit human decision the reporter parked: whether an externally-owned host may ALSO receive the org FORGEJO/Mattermost tokens or only a per-repo bot token (#201), and the act of admitting a non-pool, third-party-owned device into the factory's credential/runner topology. Both are security-posture widenings / host-access grants that a later commit cannot cleanly revert. The proposed default (per-repo bot token only) needs a human ruling before the mechanics land.

> *This was generated by AI during triage.* ## Agent Brief **Category:** enhancement **Summary:** Add a per-host registry `credentials org|host` (plus `secrets-dir`) scope so a device can run the swarm on its own (or a shared) Claude token — including Forgejo Actions legs — with its runner registered under a non-pool label and its workflow rendered without org Claude-secret references. **Current behavior:** Every workflow step sets the Claude token from org secrets, so any machine registered with the pool label receives every org secret on every job; a step-level `env:` always wins over a runner's `env_file`. The host registry can give cron legs a host/per-repo env file, but has no way to declare that a host owns its credentials, and the park-wiring guard assumes the standby token is referenced in the workflow. **Desired behavior:** A registry directive declares a host's credential scope (`org` default, or `host`) and a secrets directory; the capacity emitter surfaces it. Token selection gains a documented precedence: host secrets-dir file over process env. For a `credentials host` host, workflow rendering registers its runner under a non-pool label and omits the org Claude-secret lines (the host supplies them via the #198 file mechanism). The park-wiring guard accepts a host-declared standby, and the claim-probe asserts which bot identity the claim comment carries. **Key interfaces:** - Registry directive `credentials org|host` (default org) and `secrets-dir <dir>`, emitted into the host-capacity env. - Token-selection precedence: host secrets-dir file > process env, honored by every CLI caller. - Workflow renderer: non-pool label + no org Claude-secret references for a `credentials host` host. - Park-wiring guard recognizes a host-declared standby rather than requiring a workflow reference. **Acceptance criteria:** - [ ] A registry with `credentials host` renders a swarm leg with no org Claude-secret references (fixture + onboard-lib test). - [ ] The token-selection precedence order is pinned by the limit-lib test. - [ ] The host-registry example config and install prompt document both scopes. - [ ] The park-wiring guard passes a host-declared standby. **Out of scope:** Delivering the token as a file (#198, prerequisite); per-token spend fingerprinting (#200); provisioning the actual host/runner and its credentials. ## Why human The one-way residue is the explicit human decision the reporter parked: whether an externally-owned host may ALSO receive the org FORGEJO/Mattermost tokens or only a per-repo bot token (#201), and the act of admitting a non-pool, third-party-owned device into the factory's credential/runner topology. Both are security-posture widenings / host-access grants that a later commit cannot cleanly revert. The proposed default (per-repo bot token only) needs a human ruling before the mechanics land.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/dev-factory#199
No description provided.