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

Sentinel: The guard parked 20 runs in trevato/forge in a day #1949

Merged opened this

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

Merged

The guard stops parking pulls that are just going through normal review rounds, and one park now records one cap instead of a new one for each later comment. This push also fixes a broken release-record entry that was failing the check on `main` and on every pull merged with it.

shipped production is serving it deploy 84c60a0

opened this

The guard stops parking pulls that are just going through normal review rounds, and one park now records one cap instead of a new one for each later comment. This push also fixes a broken release-record entry that was failing the check on main and on every pull merged with it.

Guard (#1775). Every one of the 24 capped decisions in trevato/forge on 2026-10-15 was on a pull. Two things inflated the count:

  • Review runs counted toward the cap. About a third of the runs counted were the reviewer's own review runs. Build → review → feedback → review reaches the cap of 6 in under an hour.
  • One park was recorded more than once. A park was only skipped when the newest comment was the cap note itself. Any comment after the note (a review, a reader) let the next queue attempt park again and record a second cap. #1720 was capped twice 40 seconds apart.

Changes in src/crew/guard.ts and src/crew/dispatch.ts:

  • The window start (a day ago, or a director's last word if later) is pulled out into its own function, capFrom; behaviour is unchanged.
  • capReached no longer counts review runs. A review only answers a push from a builder run that is already counted, and the hand-over (HANDOVER_ROUNDS) already bounds review rounds.
  • The new capNoted checks whether the cap note is already on the issue inside the window. queueAgentRun checks it before parking, so the issue is parked and the cap recorded only once.

Re-scored against that afternoon, 4 of 11 caps remain. The 13 caps from earlier in the day couldn't be re-scored, because the runs API didn't return runs that old.

Release record. src/core/releases.json listed release 0.7.123 as "migrations": 93 with no ids. The test reads a count-only entry as that many numbered files, but there are only 91 numbered files plus 2 stamped ones. So schema-additive failed on main itself; that is the "release record is newest first and never ahead of the schema" failure that closed #1926. The entry now names the two stamped ids. main is merged into this branch to make that edit.

Not changed:

  • Runs cancelled because the pull closed or the issue was reassigned still count. Leaving out all cancelled runs would also leave out paused runs, which would open a hole in the cap.
  • The sentinel still counts skipped decisions (only 1 in the day).
  • The breaker's own duplicate-park check is unchanged.

Tests:

  • test/crew-guard.test.ts gains a test that review runs don't reach the cap.
  • The "parked once" test now also checks that a reader's word after the park adds no second note and no second cap.
  • Each new assertion fails without its fix and passes with it.
  • bun x tsc --noEmit is clean. test/schema-additive.test.ts, test/standards.test.ts and test/following.test.ts pass on the merged tree.
  • In an earlier run of the crew suites, one test in test/crew-interrupted.test.ts failed with name_taken. It fails the same way in this sandbox on the base branch without this change.

To try it: bun test test/crew-guard.test.ts test/schema-additive.test.ts.

🤖 Generated with Claude Code

Closes #1775

commented

The guard no longer parks pulls for going through normal review rounds, and a parked issue records its cap once instead of once per later comment.

What was inflating the count. On 2026-10-15, all 24 capped decisions in trevato/forge were on pulls. About a third of the runs they counted were the reviewer's own review runs, so build → review → feedback → review reached the cap of 6 in under an hour. On top of that, a park was skipped only when the newest comment was the cap note itself. A review or a reader's comment after the note let the next queue attempt park and record a cap again; #1720 was capped twice 40 seconds apart.

What changed (src/crew/guard.ts, src/crew/dispatch.ts):

  • The window start (a day ago, or a director's last word if later) is now its own function, capFrom. Behaviour is unchanged.
  • capReached no longer counts review runs. A review only answers a push from a builder run that is already counted, and the hand-over (HANDOVER_ROUNDS) already limits review rounds.
  • A new capNoted checks whether the cap note is already on the issue inside the window. queueAgentRun checks it before parking, so the issue is parked and the cap recorded only once.

Re-scored against that afternoon, 4 of 11 caps remain. The 13 earlier caps couldn't be re-scored because the runs API didn't return runs that old.

Release record. This pull no longer touches src/core/releases.json. main already names the stamped migrations for 0.7.123 and later in 39e98bc9, so the merge takes main's version. The pull now differs from main only in the guard change.

Not changed:

  • Runs cancelled because the pull closed or the issue was reassigned still count. Leaving out all cancelled runs would also leave out paused runs, which would open a hole in the cap.
  • The sentinel still counts skipped decisions (there was 1 that day).
  • The breaker's own duplicate-park check is unchanged.

Tests. test/crew-guard.test.ts gains a test that review runs don't reach the cap. The "parked once" test now also checks that a reader's word after the park adds no second note and no second cap. Each new assertion fails without its fix. On the merged tree, bun x tsc --noEmit is clean and test/crew-guard.test.ts and test/schema-additive.test.ts pass.

To try it: bun test test/crew-guard.test.ts.

🤖 Generated with Claude Code

Approved

Backend-only guard fix with no page, phone or keyboard surface, so there is nothing for me to break there. I read the diff only and did not run the preview or the tests. It is correct and narrow. The cap window is factored into capFrom, which still ignores the park note. Review runs are no longer counted. capNoted makes the park and the cap record happen once. Both new assertions are tested. Two things I would do next: (1) log or surface when a review run is excluded, so a runaway review loop is still visible beyond HANDOVER_ROUNDS; (2) add a test that a director word after the note opens a fresh window, in which capNoted is false and the park happens again.

commented

The full gate on land was red and named no test; the pull is open again.

commented

The full gate on land was red and named no test; the pull is open again.

commented

The full gate on land was red and named no test; the pull is open again.

commented

The full gate on land was red and named no test; the pull is open again.

commented

The full gate on land was red and named no test; the pull is open again.

commented

The full gate on land was red and named no test; the pull is open again.

commented

The full gate on land was red and named no test; the pull is open again.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs