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

Sentinel: queue:deploy was degraded 60 minutes today: The deploy queue has waited over 30 minutes: 2 queued, 0 running. #16987

Merged opened this

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

Merged

When the forge boots, it now cancels any deploy the previous forge left queued (#16964). Before, such a deploy waited forever and kept queue:deploy degraded. Cause.

Notes

opened this

When the forge boots, it now cancels any deploy the previous forge left queued (#16964). Before, such a deploy waited forever and kept queue:deploy degraded.

Cause. The run list for this repository shows a production merge deploy created at 02:49:33 that is still queued now. A deploy waits on the in-memory chain of the forge process that queued it. The forge restarted at 02:56. A clean stop (AppsRuntime.stop) cancels queued deploys, but this restart left the row behind, so it was most likely a kill rather than a clean stop. Nothing will ever claim that row. At boot, failAbandonedRuns only settles running deploys. So from 03:19 the oldest queued deploy was more than 30 minutes old with none running, and vitals reported queue:deploy. The second queued run in "2 queued" was a production deploy held for its 15-minute batch window, which is normal.

Change.

  • src/core/runs.ts: new cancelQueuedDeploys(db). It cancels every queued deploy through cancelRun, using the STOPPED_SUMMARY that a clean stop writes, so the UI wording that already reads that string is reused.
  • src/apps/runtime.ts: start() calls it next to failAbandonedRuns, before the reconcile that asks for each environment's deploy again. The count goes into the existing "settled abandoned runs" log line.
  • During a rollout the new forge may also cancel a deploy the old forge is still holding. That does no harm: the old forge's claimRun then finds nothing to claim, and the new boot redeploys production at the tip anyway.

Not done.

  • I did not change how vitals counts production deploys held for the batch window. They wait at most every + maxWait (25 minutes by default), which stays under the 30-minute threshold.
  • Nothing settles the row already stuck in production until the next forge boot; this change settles it then.

Tests.

  • test/deploy-orphan-boot.test.ts adds a queued deploy and a queued check, boots AppsRuntime, and checks that the deploy is cancelled with STOPPED_SUMMARY while the check stays queued. It fails without the change in runtime.ts.
  • bun x tsc --noEmit passes and the gate shows no failures.
  • These pass: merge-crash-recovery, runs-lease, apps-runtime-split, app-runtime-root, deploy-hold-runtime, job-slices.
  • hollow.test.ts timed out once at 88 s while it shared the machine with the runtime suites, and passed alone (28 of 28, 18 s).
  • scripts/fast.ts reached 3,633 test files from this diff, so I picked the tests above myself rather than run them all.

How to try it. After this lands and the forge restarts, the merge deploy queued since 02:49:33 reads cancelled with "the forge stopped" (in GET /api/v1/repos/trevato/forge/runs?kind=deploy), and queue:deploy leaves the degraded list on /settings/capacity.

🤖 Generated with Claude Code

Closes #16964

commented

When the forge boots, it now cancels any deploy the previous forge left queued (#16964). Before, such a deploy waited forever and kept queue:deploy degraded.

Cause. The run list for this repository shows a production merge deploy created at 02:49:33 that is still queued now. A deploy waits on the in-memory chain of the forge process that queued it. The forge restarted at 02:56. A clean stop (AppsRuntime.stop) cancels queued deploys, but this restart left the row behind, so it was most likely a kill rather than a clean stop. Nothing will ever claim that row. At boot, failAbandonedRuns only settles running deploys. So from 03:19 the oldest queued deploy was more than 30 minutes old with none running, and vitals reported queue:deploy. The second queued run in "2 queued" was a production deploy held for its 15-minute batch window, which is normal.

Change.

  • src/core/runs.ts: new cancelQueuedDeploys(db). It cancels every queued deploy through cancelRun, using the STOPPED_SUMMARY that a clean stop writes, so the UI wording that already reads that string is reused.
  • src/apps/runtime.ts: start() calls it next to failAbandonedRuns, before the reconcile that asks for each environment's deploy again. The count goes into the existing "settled abandoned runs" log line.
  • During a rollout the new forge may also cancel a deploy the old forge is still holding. That does no harm: the old forge's claimRun then finds nothing to claim, and the new boot redeploys production at the tip anyway.

Not done.

  • I did not change how vitals counts production deploys held for the batch window. They wait at most every + maxWait (25 minutes by default), which stays under the 30-minute threshold.
  • Nothing settles the row already stuck in production until the next forge boot; this change settles it then.

Tests.

  • test/deploy-orphan-boot.test.ts adds a queued deploy and a queued check, boots AppsRuntime, and checks that the deploy is cancelled with STOPPED_SUMMARY while the check stays queued. It fails without the change in runtime.ts.
  • bun x tsc --noEmit passes and the gate shows no failures.
  • These pass: merge-crash-recovery, runs-lease, apps-runtime-split, app-runtime-root, deploy-hold-runtime, job-slices.
  • hollow.test.ts timed out once at 88 s while it shared the machine with the runtime suites, and passed alone (28 of 28, 18 s).
  • scripts/fast.ts reached 3,633 test files from this diff, so I picked the tests above myself rather than run them all.

How to try it. After this lands and the forge restarts, the merge deploy queued since 02:49:33 reads cancelled with "the forge stopped" (in GET /api/v1/repos/trevato/forge/runs?kind=deploy), and queue:deploy leaves the degraded list on /settings/capacity.

🤖 Generated with Claude Code

Sign in to join this conversation.

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

Keyboard shortcuts

Docs