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

Archive, part 2c: a run queued before Archive is cancelled with the archived line instead of starting #2488

Merged opened this

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

Merged

A fresh agent run (attempt 0) that was queued before Archive is now cancelled when the crew picks it up, and never starts. The cancelled run's reason and the first line of its log are the `ARCHIVED_WHY` line.

shipped production is serving it deploy 0b2906d

opened this

A fresh agent run (attempt 0) that was queued before Archive is now cancelled when the crew picks it up, and never starts. The cancelled run's reason and the first line of its log are the ARCHIVED_WHY line.

What changed

  • Gate in the runner: pump in src/crew/dispatch.ts runs the check before slot and concurrency accounting, so a cancelled run takes no slot. The run is announced as cancelled like any other.
  • Carry-on runs: a run with attempt > 0, which is one carrying on after a pause or restart, is left alone and finishes.
  • Wake: nothing needed here. A cancelled run stays cancelled, and a new assignment after Wake is accepted.

Test: one new test in test/crew.test.ts covers the flow.

  • Cancelled: a fresh run is queued and the repository is archived before the crew's next pick. The run ends cancelled with the archived line, and its log is that one line, so nothing was spawned.
  • Carry-on: an attempt-1 run on another issue, queued in the same moment, is not cancelled for the archive.
  • After Wake: the cancelled run stays cancelled, and a new assignment is accepted and settles.

Checks run: bun x tsc --noEmit exited 0 with no output. bun test test/crew.test.ts gave 4 pass, 0 fail.

Left out: I did not change the queue-time gate from #2466. I did not add anything for check or deploy runs, because only agent runs go through pump.

To try: queue a run, archive the repository before the next 5-second tick, and the run shows as cancelled with the archived line.

Closes #2478

commented

A fresh agent run (attempt 0) that was queued before Archive is now cancelled when the crew picks it up, and never starts. The cancelled run's reason and the first line of its log are the ARCHIVED_WHY line.

What changed

  • Gate in the runner: pump in src/crew/dispatch.ts runs the check before slot and concurrency accounting, so a cancelled run takes no slot. The run is announced as cancelled like any other.
  • Carry-on runs: a run with attempt > 0, which is one carrying on after a pause or restart, is left alone and finishes.
  • Wake: nothing needed here. A cancelled run stays cancelled, and a new assignment after Wake is accepted.

Test: one new test in test/crew.test.ts covers the flow.

  • Cancelled: a fresh run is queued and the repository is archived before the crew's next pick. The run ends cancelled with the archived line, and its log is that one line, so nothing was spawned.
  • Carry-on: an attempt-1 run on another issue, queued in the same moment, is not cancelled for the archive.
  • After Wake: the cancelled run stays cancelled, and a new assignment is accepted and settles.

Checks run: bun x tsc --noEmit exited 0 with no output. bun test test/crew.test.ts gave 4 pass, 0 fail.

Left out: I did not change the queue-time gate from #2466. I did not add anything for check or deploy runs, because only agent runs go through pump.

To try: queue a run, archive the repository before the next 5-second tick, and the run shows as cancelled with the archived line.

Approved

Approved. The gate is small, sits before slot and account accounting so a cancelled run takes no slot, announces the cancel like any other, and leaves attempt>0 carry-on runs alone. The test covers fresh vs carry-on and Wake. There is no UI surface in this change; I could not reach the preview from my sandbox, so this is judged from source. Two things I would do next: (1) the test sleeps a fixed 6s to prove Wake does not revive the run; poll for a pump tick or expose a hook so it is not time-based and does not slow the suite. (2) A fresh run skipped by runningIssues.has(issueId) stays queued and is only cancelled on a later tick; move the archive check above that continue so it is cancelled at once.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs