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

An issue never has two build runs at once: a second dispatch while one runs, or within 10 minutes of its pull opening, is refused #6582

opened this

Merged 39d 4h ago, live in production

A second build dispatch for an issue is now refused when that issue's crew pull opened in the last 10 minutes. bun test passes on the new test and the four existing dispatch suites. The type check didn't run in this sandbox: tsc can't find the bun type definitions even after bun install.

Notes

opened this

A second build dispatch for an issue is now refused when that issue's crew pull opened in the last 10 minutes. bun test passes on the new test and the four existing dispatch suites. The type check didn't run in this sandbox: tsc can't find the bun type definitions even after bun install.

  • What changed: queueAgentRun in src/crew/dispatch.ts now looks for a pull that came from the same agent and issue. It matches on the branch name (<agent>/<n> or <agent>/<n>-…) and the pull's creation time. If it finds one, the dispatch returns nothing and logs once, "build run refused: a pull opened in the last 10 minutes", with the repo, issue and pull number.
  • Already covered: the existing check already refused an assigned dispatch while a build run was queued or running, so the 10-minute window was the missing part. Only assigned runs are checked. Review, feedback, check-failed, conflict, resolve and converge runs behave as before.
  • Test: test/build-once.test.ts has one test covering all three cases.
    • A second dispatch right after the first run's pull opened is refused.
    • After the pull is backdated 11 minutes, a dispatch starts.
    • A third dispatch while that one is queued is refused.
  • Left out: the window is a constant, BUILD_SETTLE_MS, not a setting. I didn't wire it to the pull's closed state, because the issue only asks for the 10-minute rule.

Closes #6574

commented

A second build dispatch for an issue is now refused when that issue's crew pull opened in the last 10 minutes. bun test passes on the new test and the four existing dispatch suites. The type check didn't run in this sandbox: tsc can't find the bun type definitions even after bun install.

  • What changed: queueAgentRun in src/crew/dispatch.ts now looks for a pull that came from the same agent and issue. It matches on the branch name (<agent>/<n> or <agent>/<n>-…) and the pull's creation time. If it finds one, the dispatch returns nothing and logs once, "build run refused: a pull opened in the last 10 minutes", with the repo, issue and pull number.
  • Already covered: the existing check already refused an assigned dispatch while a build run was queued or running, so the 10-minute window was the missing part. Only assigned runs are checked. Review, feedback, check-failed, conflict, resolve and converge runs behave as before.
  • Test: test/build-once.test.ts has one test covering all three cases.
    • A second dispatch right after the first run's pull opened is refused.
    • After the pull is backdated 11 minutes, a dispatch starts.
    • A third dispatch while that one is queued is refused.
  • Left out: the window is a constant, BUILD_SETTLE_MS, not a setting. I didn't wire it to the pull's closed state, because the issue only asks for the 10-minute rule.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs