Fix dispatch prelaunch reservation architecture #1188

Closed
opened 2026-07-13 19:04:09 +00:00 by coilyco-ops · 2 comments
Member

Fix the dispatch tracker architecture so prelaunch reservations cannot hard-stop the lane.

Problem:

  • The director surface has now hit repeated hard stops because the dispatch tracker counts ghost prelaunch reservations as active engineers.
  • The biggest offender is the reservation created between director dispatch and the engineer actually completing prelaunch / becoming visible.
  • When that path wedges, repo-level capacity fills with phase: container starting reservations that are not real running workers.
  • --override-reservation does not help because the repo pool ceiling still counts the stale starts.
  • ward agent reap only sees real containers and does not clear broker-side starting reservations, so the normal operator recovery path does not repair the actual blocker.

Concrete live example from the director surface on 2026-07-13:

  • Global pool had room: 9/12 active, 3 slots free.
  • coilyco-flight-deck/agentic-os repo limit was full because #496, #499, and #501 occupied all three repo slots.
  • All three showed phase: container starting, not running.
  • New agentic-os work (#503 and #504) could not be dispatched even with --override-reservation.
  • ward agent dispatch-health reported older stale reservations as safe-to-redispatch, but did not clear the currently capacity-blocking starting reservations.

This is not a one-off cleanup issue. If hard-stop regressions happen several times a week, the feature is not architected correctly.

Required architectural change:

  • Split capacity accounting for prelaunch reservations from capacity accounting for visible/running engineers.
  • A prelaunch reservation must be short-lived and self-releasing if launch visibility is not confirmed.
  • If the broker accepts a launch but cannot confirm engineer visibility, the reservation must either roll back immediately or transition to a recoverable state that does not consume repo capacity indefinitely.
  • Repo pool limits must not be held by container starting records past a small launch-confirmation TTL.
  • ward agent reap and/or ward agent dispatch-health must reconcile broker reservations, docker-visible containers, and issue/launch records. The recovery command needs to clear the blocker it reports.
  • --override-reservation should be able to reclaim stale prelaunch holds, or the stale-prelaunch state should not participate in the pool ceiling that override cannot bypass.
  • The dispatch tracker should make the prelaunch state machine explicit: reserved -> launching -> visible/running or released/failed. Every non-terminal state needs a bounded TTL and a reconciliation path.

Acceptance:

  • A failed or wedged prelaunch cannot consume a repo engineer slot indefinitely.
  • A director can recover from ghost reservations through a supported ward command without host-side manual surgery.
  • ward agent list does not show old container starting records as active capacity after their launch-confirmation TTL expires.
  • Dispatching new work in the same repo succeeds once only stale prelaunch holds remain.
  • Tests cover broker acceptance followed by failed visibility confirmation, docker container never appearing, stale prelaunch TTL expiry, reap/health reconciliation, and repo-capacity counting.
Fix the dispatch tracker architecture so prelaunch reservations cannot hard-stop the lane. Problem: - The director surface has now hit repeated hard stops because the dispatch tracker counts ghost prelaunch reservations as active engineers. - The biggest offender is the reservation created between director dispatch and the engineer actually completing prelaunch / becoming visible. - When that path wedges, repo-level capacity fills with `phase: container starting` reservations that are not real running workers. - `--override-reservation` does not help because the repo pool ceiling still counts the stale starts. - `ward agent reap` only sees real containers and does not clear broker-side starting reservations, so the normal operator recovery path does not repair the actual blocker. Concrete live example from the director surface on 2026-07-13: - Global pool had room: 9/12 active, 3 slots free. - `coilyco-flight-deck/agentic-os` repo limit was full because #496, #499, and #501 occupied all three repo slots. - All three showed `phase: container starting`, not running. - New `agentic-os` work (#503 and #504) could not be dispatched even with `--override-reservation`. - `ward agent dispatch-health` reported older stale reservations as safe-to-redispatch, but did not clear the currently capacity-blocking starting reservations. This is not a one-off cleanup issue. If hard-stop regressions happen several times a week, the feature is not architected correctly. Required architectural change: - Split capacity accounting for prelaunch reservations from capacity accounting for visible/running engineers. - A prelaunch reservation must be short-lived and self-releasing if launch visibility is not confirmed. - If the broker accepts a launch but cannot confirm engineer visibility, the reservation must either roll back immediately or transition to a recoverable state that does not consume repo capacity indefinitely. - Repo pool limits must not be held by `container starting` records past a small launch-confirmation TTL. - `ward agent reap` and/or `ward agent dispatch-health` must reconcile broker reservations, docker-visible containers, and issue/launch records. The recovery command needs to clear the blocker it reports. - `--override-reservation` should be able to reclaim stale prelaunch holds, or the stale-prelaunch state should not participate in the pool ceiling that override cannot bypass. - The dispatch tracker should make the prelaunch state machine explicit: reserved -> launching -> visible/running or released/failed. Every non-terminal state needs a bounded TTL and a reconciliation path. Acceptance: - A failed or wedged prelaunch cannot consume a repo engineer slot indefinitely. - A director can recover from ghost reservations through a supported ward command without host-side manual surgery. - `ward agent list` does not show old `container starting` records as active capacity after their launch-confirmation TTL expires. - Dispatching new work in the same repo succeeds once only stale prelaunch holds remain. - Tests cover broker acceptance followed by failed visibility confirmation, docker container never appearing, stale prelaunch TTL expiry, `reap`/health reconciliation, and repo-capacity counting.
Author
Member

WARD-OUTCOME: submitted

details

workflow: pull-request-and-merge; review summary: review gate intentionally skipped in-container while brokered QA is pending

The implementation felt like a state split, not a cleanup. The prelaunch lease is now bounded, the list view stops treating stale starts as live capacity, and reap can clear the blocker it reports.

Confidence: high. Surprise: the lint budget forced a small helper split in the stale-prelaunch scanner, but the behavior stayed unchanged. Follow-up: watch PR #1189 land cleanly once the director merge lane sees the merged state.

WARD-OUTCOME: submitted <details><summary>details</summary> workflow: pull-request-and-merge; review summary: review gate intentionally skipped in-container while brokered QA is pending The implementation felt like a state split, not a cleanup. The prelaunch lease is now bounded, the list view stops treating stale starts as live capacity, and reap can clear the blocker it reports. Confidence: high. Surprise: the lint budget forced a small helper split in the stale-prelaunch scanner, but the behavior stayed unchanged. Follow-up: watch PR #1189 land cleanly once the director merge lane sees the merged state. </details>
Author
Member

Follow-up from Kai after PR #1189 merged: the TTL work is valid mitigation, but it is not the requested architecture reflow. The missing design change is now tracked as #1191: prelaunch launch intents should not consume the same repo/global capacity token as visible/running engineers, and TTL should not be the primary correctness mechanism.

Follow-up from Kai after PR #1189 merged: the TTL work is valid mitigation, but it is not the requested architecture reflow. The missing design change is now tracked as #1191: prelaunch launch intents should not consume the same repo/global capacity token as visible/running engineers, and TTL should not be the primary correctness mechanism.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/ward#1188
No description provided.