Skip to content

fix(launcher): A job GitHub can't read yet gets its runner once it can, not dropped - #61

Merged
sodre merged 2 commits into
mainfrom
t3/implement-issue-60
Nov 25, 2026
Merged

sodre merged 2 commits into
mainfrom
t3/implement-issue-60

Conversation

@sodre

@sodre sodre commented Nov 25, 2026

Copy link
Copy Markdown
Member

Closes #60

Summary

A job that GitHub can't read yet when its queued event arrives now gets a runner once GitHub can read it, a few seconds later, instead of being dropped and left queued until GitHub cancels it 24 hours on.

GitHub sends workflow_job queued before GET /repos/{repo}/actions/jobs/{id} can read the job: on 2026-11-24 about 1 job in 30 read 404 for a second or two. The launcher took that 404 as "gone" and dropped the message. Before ADR-0004 such a job still took another job's runner; with the job label it never got one.

launcher, on a message
  read the job
    404, never read (no launch, not marked read)
      under 5 min since the first 404  -> new message, 10 s on, unreadable_since kept   "retrying": "job not readable yet"   (new)
      5 min or more                    -> dropped   "dropped": "job not found", "never_readable_s"                            (new)
    404, read before (launches, or read: true)    -> dropped at once   "dropped": "job not found"                                (as before)
    not queued                                    -> dropped                                                                (as before)
    queued                                        -> served / waiting / deferred / launched as before;
                                                     re-sent with no launch (deferred, served) -> marked read: true         (new)

Choices the ticket left open:

  • How the bound survives a re-send: the message carries unreadable_since, the time of the first 404, as the ticket's Key interfaces suggest. The bound is 5 minutes from it, and each try is 10 s apart (UNREADABLE_BOUND_MS, UNREADABLE_RETRY_SECONDS), so a job that never reads costs at most 30 reads.
  • "Readable before": a message that has had a launch was read. One the launcher re-sends with no launch after a read (a budget deferral, or a check of a job served by another delivery's runner) carries read: true. The 404 on the read after a swap follows a read that just succeeded, so it drops at once too.

docs/stack.md ("Launching for queued jobs", step 3), the "Waiting for a runner" row of docs/traps.md and the launcher's log table in docs/runbook.md describe the new lines and what job not found means now.

Evidence

Criterion Ticked Shown by
First read 404, later queued: launched, check sent, no dropped line yes A job that reads 404 at first and queued later is launched
A job that keeps reading 404 is dropped once the bound passes, logged as never readable yes A job that keeps reading 404 is dropped after 5 minutes
A job whose message has had a launch, and now reads 404, is dropped at once yes A job read before that now reads 404 is dropped at once
Waiting on an unreadable job is a new delayed message, not a failed receive yes Waiting is a new message, 10 s on
docs/stack.md and the docs/traps.md row describe the new behaviour and the job not found line yes No test reads docs: the criteria check and the Spec review, round 1, each read docs/stack.md step 3, the docs/traps.md row and the docs/runbook.md table in the diff and judged it met
Proven live: a "not readable yet" line then launched for the same job yes The live proof below: no job read 404 in the proof window, so the PR says why no such case occurred
Test Red Green
A job that reads 404 at first and queued later is launched (a job that reads 404 at first and queued later is launched, its check sent, and nothing dropped) Before the fix: the job is tried again: 0 !== 1. With unreadable_since kept on later messages: the check's MessageBody carried "unreadable_since":1794484800000 ok
A job read before that now reads 404 is dropped at once (a job read before that GitHub no longer has (404) is dropped at once; any other failure retries the message) With the has-had-a-launch guard removed: logged retrying: 'job not readable yet' instead of dropped: 'job not found' ok
Waiting is a new message, 10 s on (waiting on a job not readable yet is a new message, 10 s on, not a failed receive, …) With the wait thrown as an error (a failed receive): the test and two others failed ok
A job that keeps reading 404 is dropped after 5 minutes (a job that keeps reading 404 is tried until 5 minutes from its first 404, then dropped, logged as never readable) With the bound restarted on each message: the bound runs from the first 404, across the messages ok
A job read and then deferred is dropped at once on a 404 (a job read and then deferred for budget is dropped at once if it then reads 404; the deferral leaves out unreadable_since) Before the round-1 fix: the deferral's MessageBody had no "read":true ok
A 404 on the read after a swap is dropped at once (a job whose runner is busy, read again after the swap and gone (404), is dropped at once) With that read's 404 taken as queued: the test failed ok
A served check of a job with no launch is marked read (the updated a Fargate job served by its own task is not launched again, and its check goes on) With the served check sending the message unmarked: the test failed ok

make test (node --test test/*.test.js): 209 passed, 0 skipped, 0 failed, on 2fee303. make build: build/template.yaml 77,548 of 1,048,576 bytes.

Live, per "Proving a change live": the branch at 2fee303 was deployed to ci-runner on 2026-11-25 (change set: LauncherFunction modified in place, nothing else; UPDATE_COMPLETE 01:14:26Z), and the launcher's log was followed for an hour, to 02:14:26Z. One job queued in that window, on ci-fargate-spot: the webhook logged enqueued at 01:53:59.835Z, the launcher read it queued on its first try and logged launched (a Fargate Spot task) at 01:54:07Z, and its check at 01:59:07Z logged dropped: completed. No job read 404, so no retrying line occurred: with about 1 job in 30 hitting it on 2026-11-24, one job gave it little chance. The deployed launcher's launch, check and drop paths ran as before.

Not run: a live retrying followed by launched for the same job; no job read 404 during the hour's proof window (one job queued). The stack keeps running this branch, so the first such job will show it in the launcher's log.

Merge Danger

Door: two-way. A revert restores the drop on a 404; messages in flight carrying unreadable_since or read are read by the old launcher as before, which ignores both fields.

Blast Radius: the launcher.

The merge changes the launcher Lambda only: no image, no IAM, no queue setting. The stack is updated by make deploy; this branch is already deployed to ci-runner (2026-11-25 01:14:26Z, a change set modifying only LauncherFunction in place). No feature flag.

Reviews

Correctness, Standards, Spec and Security, two rounds: 11 findings, each with its outcome

Correctness, round 1 (pinned ab2cd1e, at medium)

  1. A budget deferral re-sends a job that read queued with no launches, so a later 404 (a deleted run) is taken as "not readable yet". Fixed: a message re-sent with no launch after a read carries read: true, and a 404 on it is dropped at once.
  2. A launch whose check message then fails to send is retried as the webhook's message, with no launches, so a 404 on it waits out the bound. Pushed back: it needs a failed send and a deleted run inside the same 120 s, and costs at most 30 reads before the drop, the same outcome.
  3. A duplicate SQS delivery starts two retry chains. Pushed back: duplicates already start two check chains (docs/stack.md, "There is no de-duplication on job id beyond that check"); the launch path's machine listing stops a double launch.
  4. A 10 s first retry is about four times the measured 2.6 s. Pushed back: about 1 job in 30 waits up to 7 s more, against a runner's boot of tens of seconds; a shorter delay doubles the reads for a job that never reads.
  5. A persistent 404 now costs 30 reads per job instead of one. Pushed back: the ticket asks for a retry bounded at "a few minutes"; 30 reads in 5 minutes is far under the installation's rate limit.
  6. No test for a deferred job that then 404s, or a 404 on the read after a swap. Fixed: both tested.
  7. No test that a deferral after a successful read leaves out unreadable_since. Fixed: the deferral test asserts its message body.
  8. The runbook's never_readable_s row would mislabel a deferred, deleted job. Fixed: by finding 1, a read job never reaches that row.

Standards, round 1

  1. msg and m name nearly the same message in handle. Fixed: the message is destructured once at the top; m is the only name used.
  2. queued logs, and two sites log dropped: 'job not found'. Pushed back: queued's logging predates this change, and the second site differs by never_readable_s on purpose.

Spec, round 1

  1. The "readable before" test misses a job read and then deferred. Fixed: as finding 1.

Security, round 1: no findings. Correctness, Standards, Spec and Security, round 2 (pinned 2fee303, fix round, Correctness at low): no findings.

Tracking

Epic: none
Spec: none
Ticket: #60 ci-fargate-spot jobs left queued for hours with no runner while neighbours seconds apart were served
Flag: none

🤖 Generated with Claude Code

sodre and others added 2 commits November 24, 2026 20:05
GitHub sends workflow_job queued before it can read the job: the
launcher's first read got 404 for about 1 job in 30, took it as gone and
dropped the message. Since ADR-0004 such a job can't take another job's
runner, so it stayed queued until GitHub cancelled it.

A 404 on a message that has had no launch now goes back on the queue as
a new message, 10 s on, carrying unreadable_since, for up to 5 minutes
from the first 404; then it is dropped, logged with never_readable_s. A
404 on a message that has had a launch is still dropped at once.

Refs #60

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h it had no launch

Review round 1 of #60: a budget deferral, or a check of a job served by
another delivery's runner, re-sent a job that had read queued with no
launches, so a later 404 on it (a deleted run) was taken as "not readable
yet" and tried for 5 minutes. Such messages now carry read: true. Tests
also cover the 404 on the read after a swap, and a deferral leaving out
unreadable_since.

Refs #60

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sodre
sodre marked this pull request as ready for review November 25, 2026 02:16
@sodre
sodre merged commit af04610 into main Nov 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci-fargate-spot jobs left queued for hours with no runner while neighbours seconds apart were served

1 participant