Park-capable workflow steps run without the standby Claude token — one refusal here parks the whole host #879

Closed
opened 2026-08-26 19:49:44 +00:00 by ben · 2 comments
Owner

What

Several workflow steps that can reach claude_limit_park run with the
primary Claude token alone. They must also carry the standby token in their
own
env: block, beside CLAUDE_CODE_OAUTH_TOKEN:

CLAUDE_CODE_OAUTH_TOKEN_B: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN_B }}

A sibling step's token does not count — inheritance is per step (a job- or
workflow-level env: does count, since steps inherit it).

Steps to fix

  • .forgejo/workflows/ci.yml → Investigate failure (healer) step

Why it matters

Without the standby token in scope, claude_standby_available sees an unset
variable, claude_failover declines, and claude_limit_park stamps the
host-global marker /tmp/matou-swarm-claude-limit (host-global by design,
dev-factory #238 — one subscription window per host, shared by every repo).

So one under-provisioned caller in this repo parks every factory caller on
that host
for the rest of the window — including repos that were riding a
perfectly healthy standby account. That is the 2026-08-25 triage outage, and
it recurred on 2026-08-26: both swarm hosts sat parked while account B was
available, because triage kept refusing on the exhausted account A and
re-stamping the shared marker.

Verification

dev-factory@02ff038 makes this property vendored code
(park-wiring-lib.sh, dev-factory #85 / GOTCHAS 30). Once this repo pins at
or past that commit:

  • preflight-swarm.sh fails closed before a worker spawns while any
    park-capable step is unwired, naming the file and step, and
  • check-harness-drift.sh reports it as an advisory at the moment of the
    pin bump.

Fix the wiring in the same change as the bump, or the first swarm tick after
the bump will refuse to start — which is the intended behaviour, not a bug.

## What Several workflow steps that can reach `claude_limit_park` run with the primary Claude token alone. They must also carry the standby token in **their own** `env:` block, beside `CLAUDE_CODE_OAUTH_TOKEN`: ```yaml CLAUDE_CODE_OAUTH_TOKEN_B: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN_B }} ``` A sibling step's token does not count — inheritance is per step (a job- or workflow-level `env:` does count, since steps inherit it). ## Steps to fix - `.forgejo/workflows/ci.yml` → **Investigate failure (healer)** step ## Why it matters Without the standby token in scope, `claude_standby_available` sees an unset variable, `claude_failover` declines, and `claude_limit_park` stamps the **host-global** marker `/tmp/matou-swarm-claude-limit` (host-global by design, dev-factory #238 — one subscription window per host, shared by every repo). So one under-provisioned caller in this repo parks **every factory caller on that host** for the rest of the window — including repos that were riding a perfectly healthy standby account. That is the 2026-08-25 triage outage, and it recurred on 2026-08-26: both swarm hosts sat parked while account B was available, because triage kept refusing on the exhausted account A and re-stamping the shared marker. ## Verification dev-factory`@02ff038` makes this property **vendored** code (`park-wiring-lib.sh`, dev-factory #85 / GOTCHAS 30). Once this repo pins at or past that commit: - `preflight-swarm.sh` **fails closed** before a worker spawns while any park-capable step is unwired, naming the file and step, and - `check-harness-drift.sh` reports it as an advisory at the moment of the pin bump. Fix the wiring in the same change as the bump, or the first swarm tick after the bump will refuse to start — which is the intended behaviour, not a bug.

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: ready-for-session (+ priority). Not ready-for-agent, not ready-for-human.

Why not ready-for-agent: the fix edits .forgejo/workflows/ci.yml, and .forgejo/ is a fingerprinted protected path for swarm workers (PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo", .sandcastle/protected-paths-lib.sh). A worker's edit there is rolled back after the run (#445), and the protected-path escape message itself directs such work to ready-for-session. The change is also coupled to a dev-factory pin bump (.sandcastle/FACTORY_REF, currently e61aa000) so park-wiring-lib.sh fails closed on the unwired step — harness territory, not backlog.

Why not ready-for-human: no Ben's-hands / Ben's-eyes / one-way-door residue. CLAUDE_CODE_OAUTH_TOKEN_B already exists as a repo secret (referenced elsewhere in the factory); this only wires the existing secret reference into one step's env:. Not a new credential, not a posture widening.

Why this is a two-way door: revertible by a one-line commit, and provable by existing probes — the filing's own verification says preflight-swarm.sh fails closed (naming file + step) and check-harness-drift.sh raises an advisory once the pin bump lands. Reversible + provable + off the one-way-door list.

priority (additive): an active, recurring, host-global outage — one exhausted-account-A refusal stamps /tmp/matou-swarm-claude-limit and parks every factory caller on the host, incl. repos riding a healthy account B (2026-08-25, again 2026-08-26). Surfacing it ahead of ordinary backlog for the session sweep is warranted; remove by hand once fixed.

Verified against the tree: .forgejo/workflows/ci.yml:34 is the Investigate failure (healer) step; its env: (line ~39) carries CLAUDE_CODE_OAUTH_TOKEN but not CLAUDE_CODE_OAUTH_TOKEN_B. Defect confirmed exactly as filed.

Session brief

  • Do: add CLAUDE_CODE_OAUTH_TOKEN_B: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN_B }} to the env: of the Investigate failure (healer) step in .forgejo/workflows/ci.yml (~line 39), beside the existing primary token. A job- or workflow-level env: would also satisfy inheritance if you prefer to wire it once.
  • Audit: any other park-capable step in this repo's workflows that can reach claude_limit_park and lacks the B token in its own scope (inheritance is per step).
  • Bump in the same change: pin dev-factory at/past @02ff038 (property vendored via park-wiring-lib.sh, dev-factory #85 / GOTCHAS 30) so preflight-swarm.sh enforces it. If the current pin is already at/past that, wire-and-verify only.
  • Proof: preflight-swarm.sh starts clean after the change; check-harness-drift.sh advisory clears. Wire in the same commit as the bump, or the first tick after refuses to start (intended).
  • Needs session standing because: protected .forgejo/ path + harness pin bump.
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** `ready-for-session` (+ `priority`). Not `ready-for-agent`, not `ready-for-human`. **Why not `ready-for-agent`:** the fix edits `.forgejo/workflows/ci.yml`, and `.forgejo/` is a fingerprinted protected path for swarm workers (`PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo"`, `.sandcastle/protected-paths-lib.sh`). A worker's edit there is rolled back after the run (#445), and the protected-path escape message itself directs such work to `ready-for-session`. The change is also coupled to a dev-factory pin bump (`.sandcastle/FACTORY_REF`, currently `e61aa000`) so `park-wiring-lib.sh` fails closed on the unwired step — harness territory, not backlog. **Why not `ready-for-human`:** no Ben's-hands / Ben's-eyes / one-way-door residue. `CLAUDE_CODE_OAUTH_TOKEN_B` already exists as a repo secret (referenced elsewhere in the factory); this only wires the *existing* secret reference into one step's `env:`. Not a new credential, not a posture widening. **Why this is a two-way door:** revertible by a one-line commit, and provable by existing probes — the filing's own verification says `preflight-swarm.sh` fails closed (naming file + step) and `check-harness-drift.sh` raises an advisory once the pin bump lands. Reversible + provable + off the one-way-door list. **`priority` (additive):** an active, recurring, *host-global* outage — one exhausted-account-A refusal stamps `/tmp/matou-swarm-claude-limit` and parks every factory caller on the host, incl. repos riding a healthy account B (2026-08-25, again 2026-08-26). Surfacing it ahead of ordinary backlog for the session sweep is warranted; remove by hand once fixed. **Verified against the tree:** `.forgejo/workflows/ci.yml:34` is the `Investigate failure (healer)` step; its `env:` (line ~39) carries `CLAUDE_CODE_OAUTH_TOKEN` but **not** `CLAUDE_CODE_OAUTH_TOKEN_B`. Defect confirmed exactly as filed. ## Session brief - **Do:** add `CLAUDE_CODE_OAUTH_TOKEN_B: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN_B }}` to the `env:` of the `Investigate failure (healer)` step in `.forgejo/workflows/ci.yml` (~line 39), beside the existing primary token. A job- or workflow-level `env:` would also satisfy inheritance if you prefer to wire it once. - **Audit:** any other park-capable step in this repo's workflows that can reach `claude_limit_park` and lacks the B token in its own scope (inheritance is per step). - **Bump in the same change:** pin dev-factory at/past `@02ff038` (property vendored via `park-wiring-lib.sh`, dev-factory #85 / GOTCHAS 30) so `preflight-swarm.sh` enforces it. If the current pin is already at/past that, wire-and-verify only. - **Proof:** `preflight-swarm.sh` starts clean after the change; `check-harness-drift.sh` advisory clears. Wire in the same commit as the bump, or the first tick after refuses to start (intended). - **Needs session standing because:** protected `.forgejo/` path + harness pin bump.

Close-report — landed (Ruled by agent under ADR 0174 — veto anytime).

What landed: .forgejo/workflows/ci.yml → Investigate failure (healer) step now carries the standby token in its own env: block, beside the primary:

CLAUDE_CODE_OAUTH_TOKEN_B: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN_B }}

Why it was the bug (proof): that step runs bash .sandcastle/heal.sh, which is park-capable — heal.sh:291 calls claude_limit_park when Claude refuses mid-diagnosis. Env inheritance is per-step, so the primary-only env: meant claude_standby_available (.sandcastle/limit-lib.sh:163, [ -n "${CLAUDE_CODE_OAUTH_TOKEN_B:-}" ]) saw an unset var → claude_failover declined → claude_limit_park stamped the host-global /tmp/matou-swarm-claude-limit marker (dev-factory #238), parking every factory caller on the host. That is the 2026-08-25 outage that recurred 2026-08-26.

Reference conformance: the fix matches the already-wired sibling steps — healer.yml:25, triage.yml:41/142, swarm.yml:52/159 — all of which carry the standby token per park-capable step.

Scope note on the Verification section: the enforced guard (park-wiring-lib.sh in preflight-swarm.sh / check-harness-drift.sh, dev-factory@02ff038) is not yet vendored here — this repo pins FACTORY_REF=e61aa000…, which predates 02ff038 (park-wiring-lib.sh is absent and not in FACTORY_MANIFEST). So those guards can't be run against this change today. The wiring fix lands now precisely so that a future pin bump to 02ff038+ is safe (the ticket's own warning: "Fix the wiring in the same change as the bump, or the first swarm tick after the bump will refuse to start"). The pin bump itself is a separate, larger re-vendor change and is out of scope for this ticket — filing it is left to whoever does the bump; this fix is its precondition. If a follow-up ticket for the pin bump is wanted, that's a clean next step.

Proof carried in-repo:

  • YAML validated (python3 -c "yaml.safe_load(...)", clean).
  • No existing test pinned the old env set (grep over .sandcastle/tests + scripts/tests).
  • Hazard recorded: GOTCHAS #97 (⭐⭐⭐), STATUS.md header logged.

Commit: 638ea9a3 (pushed to main; git pull --rebase first).

Closing.

**Close-report — landed (Ruled by agent under ADR 0174 — veto anytime).** **What landed:** `.forgejo/workflows/ci.yml` → **Investigate failure (healer)** step now carries the standby token in its **own** `env:` block, beside the primary: ```yaml CLAUDE_CODE_OAUTH_TOKEN_B: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN_B }} ``` **Why it was the bug (proof):** that step runs `bash .sandcastle/heal.sh`, which is **park-capable** — `heal.sh:291` calls `claude_limit_park` when Claude refuses mid-diagnosis. Env inheritance is **per-step**, so the primary-only `env:` meant `claude_standby_available` (`.sandcastle/limit-lib.sh:163`, `[ -n "${CLAUDE_CODE_OAUTH_TOKEN_B:-}" ]`) saw an unset var → `claude_failover` declined → `claude_limit_park` stamped the **host-global** `/tmp/matou-swarm-claude-limit` marker (dev-factory #238), parking every factory caller on the host. That is the 2026-08-25 outage that recurred 2026-08-26. **Reference conformance:** the fix matches the already-wired sibling steps — `healer.yml:25`, `triage.yml:41/142`, `swarm.yml:52/159` — all of which carry the standby token per park-capable step. **Scope note on the Verification section:** the enforced guard (`park-wiring-lib.sh` in `preflight-swarm.sh` / `check-harness-drift.sh`, dev-factory`@02ff038`) is **not yet vendored here** — this repo pins `FACTORY_REF=e61aa000…`, which predates `02ff038` (`park-wiring-lib.sh` is absent and not in `FACTORY_MANIFEST`). So those guards can't be run against this change today. The wiring fix lands **now** precisely so that a future pin bump to `02ff038+` is safe (the ticket's own warning: "Fix the wiring in the same change as the bump, or the first swarm tick after the bump will refuse to start"). The pin bump itself is a separate, larger re-vendor change and is **out of scope for this ticket** — filing it is left to whoever does the bump; this fix is its precondition. If a follow-up ticket for the pin bump is wanted, that's a clean next step. **Proof carried in-repo:** - YAML validated (`python3 -c "yaml.safe_load(...)"`, clean). - No existing test pinned the old env set (grep over `.sandcastle/tests` + `scripts/tests`). - Hazard recorded: **GOTCHAS #97** (⭐⭐⭐), `STATUS.md` header logged. **Commit:** `638ea9a3` (pushed to `main`; `git pull --rebase` first). Closing.
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.

Dependencies

No dependencies set.

Reference
Matou/idss#879
No description provided.