Repository navigation
Fix Fargate worker lease failures and stop-timeout storms - #12
Merged
cursor[bot] merged 1 commit intoSep 29, 2026
Merged
Conversation
…rovision A half-open worker socket stayed open and swallowed failed heartbeats, so the server lease expired and failed the run, and a replaced server never saw the worker dial back. Ping the peer and drop the socket when the pong or the heartbeat write fails. Stop verification treated DEPROVISIONING as a missed stop every 60s. Poll an accepted stop until the task is STOPPED, and report a stuck task once with the status ECS returned. Fixes CONDUIT-N Fixes CONDUIT-T Fixes CONDUIT-S Fixes CONDUIT-R Fixes CONDUIT-Y Co-authored-by: Doug Rathbone <dougrathbone@users.noreply.github.com>
dougrathbone
marked this pull request as ready for review
September 29, 2026 10:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Production Conduit errors over the last week are one failure chain, plus one user credential warning.
Sentry (project Conduit, unresolved): issue list. Datadog has no Conduit service logs; the narrative is in Sentry breadcrumbs.
fargate-d23f292f-922c-478f-a55c-19d347cac0eewent silent. The server was idle (memory and disk checks only) until the 75s lease expired, then the run was failed withexit signaland last linelost contact (lease expired).fargate-f0d6629f-6b1b-4eb1-b285-84025b5a503bnever dialed back. The orphan timer fired at exactly 300000ms. Breadcrumbs show no worker connection in that window.7f5db4ff…, rund23f292f…) was described against ECS every ~2s for about nine minutes and never reachedSTOPPED. Each 60s slice was reported (waitUntilStopped), then "giving up after 3 attempts". The same pattern repeats across several runs since mid-September. ECSStopTaskhad already been accepted; Fargate stays inDEACTIVATING/DEPROVISIONINGfor minutes while the ENI detaches, and a 60s cap false-fails that wait.The provided API key is invalid. That is a bad stored credential, not a worker bug. Left as a warning.A half-open control-plane socket keeps
readyStateOPEN and never emitsclose. Heartbeat write failures were swallowed, so the worker did not reconnect before the server lease (or the post-restart adoption window) failed the run.Changes
desiredStatus STOPPED, orDEACTIVATING/STOPPING/DEPROVISIONING), poll untilSTOPPEDfor up to 10 minutes. A task that staysRUNNINGis still retried. Sentry is notified once, and the message includes the status ECS returned. Shutdown still aborts the wait at its own deadline.Fixes CONDUIT-N
Fixes CONDUIT-T
Fixes CONDUIT-S
Fixes CONDUIT-R
Fixes CONDUIT-Y
Test
npm run build— Vite renderer plustscserver/worker output. Source-map upload skipped (no Sentry upload credentials).npx vitest run src/server/workers/fargateWorker.test.ts src/worker/liveness.test.ts(51 passed)npx tsc --noEmit --project tsconfig.server.jsonnpm run e2e:fargate— 50 driver checks, 9 server-replacement restart checks, shutdown cleanup, and 11 reconnect-expiry checks, all passed. Covers task stop, SIGKILL of the server with the worker reconnecting, graceful SIGTERM stopping every simulated task, and the reconnect-timeout diagnostic.