fix(bad): make pre-continuation checks mandatory and surface missing session state

- Mark pre-continuation checks as mandatory (never skip, even with parallel
  stories) in the Phase 2 after-each-step note and as explicit Rule #12
- gate-pre-continuation.md now warns when bad-session-state.json is missing
  or rate_limits data is absent, instead of silently skipping — prevents
  usage thresholds being bypassed when the session-state hook isn't installed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
stephenleo
2026-04-12 19:56:49 +08:00
parent 8695e5fa73
commit 5200672209
2 changed files with 5 additions and 2 deletions

View File

@@ -207,7 +207,7 @@ Launch all stories' Step 1 subagents **in a single message** (parallel). Each st
| `review` | Step 4 | Steps 13 |
| `done` | — | all |
**After each step:** run **Pre-Continuation Checks** (see `references/coordinator/gate-pre-continuation.md`) and 📣 **Notify** the step result before spawning the next subagent.
**After each step:** run **Pre-Continuation Checks** (see `references/coordinator/gate-pre-continuation.md`) — **this is mandatory; never skip it, even when stories run in parallel** — and 📣 **Notify** the step result before spawning the next subagent.
📣 **Notify per step** as each step completes:
- Success: `✅ Story {number}: Step {N} — {step name}`
@@ -569,3 +569,4 @@ Read `references/coordinator/pattern-gh-curl-fallback.md` when any `gh` command
9. **sprint-status.yaml is updated by step subagents** — each step subagent writes to the repo root copy. The coordinator never does this directly.
10. **On failure** — report the error, halt that story. No auto-retry. **Exception:** rate/usage limit failures → run Pre-Continuation Checks (auto-pauses until reset) then retry.
11. **Issue all Step 1 subagent calls in one response** when Phase 2 begins. After each story's Step 1 completes, issue that story's Step 2 — never wait for all stories' Step 1 to finish before issuing any Step 2. This rolling-start rule applies to all sequential steps within a story.
12. **Pre-Continuation Checks are mandatory at every gate** — run `references/coordinator/gate-pre-continuation.md` between every step spawn, after each Phase 3 merge, and before every Phase 0 re-entry. Never skip or defer these checks, even when handling multiple parallel story completions simultaneously.

View File

@@ -22,7 +22,9 @@ Parse the output as JSON. The relevant fields:
- `rate_limits.seven_day.used_percentage` — 0100 (Claude Code only)
- `rate_limits.seven_day.resets_at` — Unix epoch seconds when the 7-day window resets
Each field may be independently absent. If the file does not exist or a field is absent, skip the corresponding check.
**If the file does not exist** — print `"⚠️ Pre-Continuation: session state unavailable (bad-session-state.json missing — check that the session-state hook is installed via /bad setup Step 3). Skipping rate limit checks."` and proceed.
**If a specific field is absent** — silently skip only that check. If the file exists but `rate_limits` is entirely absent, print `"⚠️ Pre-Continuation: rate limit data not in session state — skipping usage checks."` once (not on every gate).
---