Public: anyone can read this; the crew can change it.

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:2d966d9058 is past its budget: trevato/forge: "the crew, with a stand-in Claude Code: a stalled brief > a review that stalls before its agent is ended… #16539

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I fixed the flaky test "a review that stalls before its agent is ended at its budget" (#16196) in test/crew-review-stall.test.ts. The test never actually stalled, so its result depended on the machine's speed. Cause.

Notes

shipped production is serving it deploy 3256dd5

opened this

I fixed the flaky test "a review that stalls before its agent is ended at its budget" (#16196) in test/crew-review-stall.test.ts. The test never actually stalled, so its result depended on the machine's speed.

Cause. The test commits package.json but no lockfile. The crew only runs the install when there is a lockfile (src/crew/workdir.ts:282), so the install that was meant to stall was skipped. The review ran on to the stand-in Claude Code and raced the 300 ms budget:

  • Slow brief: the run ended at the budget before the reviewer started. Its summary then said "before its reviewer started", and the test's check for "a review run took" failed.
  • Fast stand-in: it finished before the budget and the run ended with "reviewed: no verdict". No run ever matched "budget:", so the wait failed with "agent run did not settle", which is the failure the sentinel kept seeing.
  • In between: the budget fell while the stand-in was running, and the test passed.

Fix. The test now:

  • commits a bun.lock, so the install runs and stalls;
  • expects "budget: a review run, before its reviewer started, took …", the only summary now possible;
  • checks that the stand-in Claude Code was never run (its prompt file is never written).

Under heavy load the budget sometimes runs out during the clone, before the install is reached. That still ends the run before its reviewer starts, so the result is the same either way.

No code outside the test changed: the crew's budget handling was right.

Checks run:

  • 9 passes in a row, 6 of them with four CPU-burning processes running alongside.
  • With the lockfile removed again, the new check fails every time ("Expected: false, Received: true").
  • bun scripts/gate.ts --fix changed nothing, bun x tsc --noEmit is clean, and the 126 test files scripts/fast.ts picked pass (2012 pass, 0 fail).

To try it: bun test test/crew-review-stall.test.ts. To see the old failure, delete the bun.lock line and run it again.

🤖 Generated with Claude Code

Closes #16196

commented

I fixed the flaky test "a review that stalls before its agent is ended at its budget" (#16196) in test/crew-review-stall.test.ts. The test never actually stalled, so its result depended on the machine's speed.

Cause. The test commits package.json but no lockfile. The crew only runs the install when there is a lockfile (src/crew/workdir.ts:282), so the install that was meant to stall was skipped. The review ran on to the stand-in Claude Code and raced the 300 ms budget:

  • Slow brief: the run ended at the budget before the reviewer started. Its summary then said "before its reviewer started", and the test's check for "a review run took" failed.
  • Fast stand-in: it finished before the budget and the run ended with "reviewed: no verdict". No run ever matched "budget:", so the wait failed with "agent run did not settle", which is the failure the sentinel kept seeing.
  • In between: the budget fell while the stand-in was running, and the test passed.

Fix. The test now:

  • commits a bun.lock, so the install runs and stalls;
  • expects "budget: a review run, before its reviewer started, took …", the only summary now possible;
  • checks that the stand-in Claude Code was never run (its prompt file is never written).

Under heavy load the budget sometimes runs out during the clone, before the install is reached. That still ends the run before its reviewer starts, so the result is the same either way.

No code outside the test changed: the crew's budget handling was right.

Checks run:

  • 9 passes in a row, 6 of them with four CPU-burning processes running alongside.
  • With the lockfile removed again, the new check fails every time ("Expected: false, Received: true").
  • bun scripts/gate.ts --fix changed nothing, bun x tsc --noEmit is clean, and the 126 test files scripts/fast.ts picked pass (2012 pass, 0 fail).

To try it: bun test test/crew-review-stall.test.ts. To see the old failure, delete the bun.lock line and run it again.

🤖 Generated with Claude Code

Approved

The diagnosis holds up. workdir.ts skips the install unless a lockfile sits beside package.json, so the stall never happened and the test raced the budget. Adding bun.lock makes the install run. The new assertions are correct: review.ts:239-240 produces the "before its reviewer started" wording, and a missing promptFile proves the stand-in Claude Code never ran. This is a test-only change with no new dependencies, and no page, README or docs change is involved.

Two things I would do next:

  1. Keep the existsSync check. It is what would fail if the lockfile were dropped again, so do not loosen it to a regex alone.
  2. Check whether other stand-in crew tests commit a package.json without a lockfile and rely on an install stall. They have the same latent race.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs