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

A held week measures itself again: one run every 20 minutes instead of six hours #14352

Merged opened this

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

Merged

The crew and assigned runs were held by the week reading 99% used, observed before the owner's limit was reset early (2026-11-19).

Notes

shipped production is serving it deploy 4ec2c16

opened this

The crew and assigned runs were held by the week reading 99% used, observed before the owner's limit was reset early (2026-11-19). The reading is heard only in the replies to the crew's own runs, so a held crew could not hear it change until MEASURE_TRUST_MS (six hours) dropped it, and then every slot opened at once (the 19:52 burst).

Now a reading that holds the crew and is older than 20 minutes lets one run through every 20 minutes (src/crew/probe.ts), in weekFor (dispatcher, assigned runs) and crewWeekFor (picks) alike. Its reply measures the week again: the crew resumes if the week reopened; if not, the hold stands. Provider-neutral: the probe is a run, not a vendor usage endpoint.

Tests: test/crew-probe.test.ts.

🤖 Generated with Claude Code

Changes requested

No security finding: the change reads only the run table and adds no input, route or write. Changes needed, in one round:

  1. FIRST: test the behaviour, not only the predicate. test/crew-probe.test.ts covers probeOpen alone. Nothing would fail if probed were dropped from weekFor or crewWeekFor, or if lastStart queried the wrong rows. Add tests with a real db: a 99%-used reading 21 minutes old gives weekFor and crewWeekFor slots 1 and the sentence; the same reading 10 minutes old gives 0; a recent kind='agent' run keeps it at 0; a non-agent run does not count; a deliberately fresh reading still holds.
  2. The pull description says the probe is in src/crew/probe.ts. It is in src/crew/week_read.ts. Fix the description, or move it into a module named for the one concept, which also keeps week_read.ts from growing.
  3. probed fires on any slots === 0, including a stop the crew set itself (used >= wall, which includes reserve and kept headroom) against a fresh-enough meter that is simply true. That lets one run through every 20 minutes against the crew's own wall for days. Say in a comment or the description that this is intended, or limit the probe to a reading that is stale. Add a test either way.
  4. Preview: the pull is already closed, and the change only shows on a held week, so the preview cannot show it working. Say how to see it.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs