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

Pulls waiting for the disk stay with the forge that parked them: one forge's recheck never drops another's #6293

Merged opened this

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

Merged

`recheckForDisk(app)` now reads and clears only its own forge's disk-waiting pulls, so one forge's recheck no longer drops another's. The type check is clean. I ran only `test/checks-disk-red.test.ts` (5 pass), not the whole `bun test`, and the new test fails against the old code.

shipped production is serving it deploy d5b2fe2

opened this

recheckForDisk(app) now reads and clears only its own forge's disk-waiting pulls, so one forge's recheck no longer drops another's. The type check is clean. I ran only test/checks-disk-red.test.ts (5 pass), not the whole bun test, and the new test fails against the old code.

  • Change: in src/crew/dispatch.ts, waitingOnDisk is now a WeakMap keyed by app.db instead of a global map keyed by repository. The same key is used where a pull is parked, so each forge keeps its own list. Entries go away with the database, and waitingOnMain is untouched.
  • Test: in test/checks-disk-red.test.ts, a pull is parked on forge A's disk wait. Forge B (a second in-process forge) runs recheckForDisk with the disk recovered, and neither forge requests a check. When A's recheck runs, the pull is re-requested.
  • Not done: nothing else was changed, and the other disk-wait tests are unchanged.

Closes #6289

commented

recheckForDisk(app) now reads and clears only its own forge's disk-waiting pulls, so one forge's recheck no longer drops another's. The type check is clean. I ran only test/checks-disk-red.test.ts (5 pass), not the whole bun test, and the new test fails against the old code.

  • Change: in src/crew/dispatch.ts, waitingOnDisk is now a WeakMap keyed by app.db instead of a global map keyed by repository. The same key is used where a pull is parked, so each forge keeps its own list. Entries go away with the database, and waitingOnMain is untouched.
  • Test: in test/checks-disk-red.test.ts, a pull is parked on forge A's disk wait. Forge B (a second in-process forge) runs recheckForDisk with the disk recovered, and neither forge requests a check. When A's recheck runs, the pull is re-requested.
  • Not done: nothing else was changed, and the other disk-wait tests are unchanged.
Approved

Scoped correctly: waitingOnDisk is now a WeakMap keyed by app.db, set and read with the same key, and recheckForDisk deletes only its own forge entry. The new test parks a pull on forge A, rechecks forge B with the disk recovered and sees no request, then rechecks A and sees one. It would fail on the old global map. No UI, input or security surface changed. Two things I would do next: (1) the in-memory park is still lost on restart, so consider rebuilding it from the failed-run record at boot; (2) waitingOnMain has the same shape, so check whether it needs the same per-forge keying.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs