Skip to content

fix(ci): bound every workflow job with a timeout-minutes (#531) - #534

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/531-job-timeouts
Sep 18, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
fix/531-job-timeouts

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Closes #531.

What was wrong

Not one job in any of the five workflows declared timeout-minutes, so all 24 inherited GitHub's
default of 360 minutes. Nothing here takes anything like that — the whole CI gate is under five
minutes of wall clock, and the longest job anywhere is docker-build-push at 917 seconds.

So a job that reaches the default has not run long, it has hung: a test deadlocked on a channel, an
apt-get waiting on a prompt that will never come, a curl to a host that stopped answering. And
while it hangs it holds this repository's required checks. cancel-in-progress does not rescue it,
because a new push cancels the run rather than the wait, and then starts its own six-hour clock.

Sizing

A generous multiple of each job's worst observed run, floor 10 minutes so ordinary runner variance
never trips one. The aim is that a hang fails in minutes and a slow day never fails at all.

workflow job observed max bound
ci.yml test 250s 15
ci.yml packaging 210s 20
ci.yml coverage 119s 15
ci.yml lint 90s 15
ci.yml install-script 152s (opensuse cell) 15
ci.yml fuzz-smoke 191s 10
ci.yml cross-build 91s 10
ci.yml build-tags 88s 10
ci.yml sdk-metrics 81s 10
ci.yml modulefiles 37s 10
ci.yml labels 27s 10
ci.yml deploy-manifests 22s 10
ci.yml docs-site 19s 10
ci.yml config-examples 17s 10
ci.yml systemd-unit 15s 10
security.yml security 206s 20
pages.yml build / deploy 38s / 9s 15 / 10
dependabot-automerge.yml dependabot seconds 10
release.yml docker-build-push 917s 45
release.yml publish 388s 20
release.yml artifacts 194s 20
release.yml security-scan 25s 15

The one job that cannot have one

release.yml's gate is uses: ./.github/workflows/ci.yml, and Actions rejects
timeout-minutes beside uses:. The allowed set is name, uses, with, secrets, needs, if
and permissions; an eighth key fails the whole file before any job starts, so there would be no job
and no log. Verified with actionlint against a mutated copy rather than recalled:

release.yml:69:5: when a reusable workflow is called with "uses", "timeout-minutes" is not available.
only following keys are allowed: "name", "uses", "with", "secrets", "needs", "if", and "permissions"
in job "gate" [syntax-check]

The exemption is not an unbounded hole — the gate is ci.yml's jobs, and every one of them is
bounded here. The reason is recorded at the job itself so the next person does not "fix" it and break
the whole file.

The test

internal/config/job_timeouts_test.go walks .github/workflows rather than naming files, on the
same reasoning as TestNoPullRequestTriggerFiltersItsBaseBranch next to it: a list checks the jobs
that existed when it was written, and the job that arrives without a timeout is by definition one
nobody thought to add to a list.

Two details that are the point rather than polish:

  • It bounds the value at 1..60, not just presence. timeout-minutes: 360 passes a presence check
    while bounding nothing — it is the default this change exists to displace. The ceiling is three
    times the longest job in the repo; raising it should come with the measurement.
  • The uses: exemption is checked, not assumed: a caller has uses: and no steps:. A job with
    both is not a caller and does not get out of the rule.

Verification

Mutation, six ways — each produced its own specific diagnosis rather than a generic failure:

mutation result
delete test's timeout ci.yml: job test has no timeout-minutes
set it to 360 outside 1..60
write it as a ${{ }} expression not a literal integer
add one to gate calls a reusable workflow with uses: and also sets timeout-minutes
give a stepped job a uses: key still reported missing — the exemption does not swallow it
break the jobs: lookup hit the non-vacuity floor: checked 0 jobs ... expected at least 20

Also: actionlint clean on all five files (only pre-existing shellcheck info notes),
go test ./internal/config/ green, GOOS=linux golangci-lint run ./internal/config/ → 0 issues.

No job in any of the five workflows declared `timeout-minutes`, so all 24
inherited GitHub's default of 360 minutes. Nothing in this repository takes
anything like that: the whole gate is under five minutes of wall clock and the
longest job anywhere is `docker-build-push` at 917 seconds. So a job that
reaches the default has not run long, it has hung — a test deadlocked on a
channel, an apt-get waiting on a prompt that will never come, a curl to a host
that stopped answering — and while it does it holds this repository's required
checks. `cancel-in-progress` does not rescue it: a new push cancels the run
rather than the wait, and starts its own six-hour clock.

Each of the 23 eligible jobs now carries a bound sized from its worst observed
run, with a floor of 10 minutes so ordinary runner variance never trips one —
`test` 15, `packaging` 20, `coverage`/`lint`/`install-script` 15, 10 for the
rest of ci.yml; `security` 20; pages 15/10; dependabot 10; and on the release
path `artifacts` 20, `docker-build-push` 45, `security-scan` 15, `publish` 20.

The 24th job cannot have one. `release.yml`'s `gate` is `uses:
./.github/workflows/ci.yml`, and Actions rejects `timeout-minutes` beside
`uses:` — the allowed set is name, uses, with, secrets, needs, if and
permissions, and an eighth key fails the whole file before any job starts, so
there is no log and nothing runs. Verified with actionlint rather than recalled.
The exemption is not a hole: the gate is the sum of ci.yml's own jobs, every one
of which is bounded here.

`TestEveryWorkflowJobHasATimeout` walks `.github/workflows` instead of naming
files, on the same reasoning as `TestNoPullRequestTriggerFiltersItsBaseBranch` —
the job that arrives without a timeout is by definition one nobody thought to
add to a list. It also bounds the value at 1..60 rather than only checking
presence, because `timeout-minutes: 360` passes a presence check while bounding
nothing, and it checks the `uses:` exemption is a caller with no `steps:` rather
than a blanket skip.

Verified by mutation, six ways: deleting one job's timeout, setting one to 360,
writing one as an expression instead of a literal, adding one to `gate`, giving
a stepped job a `uses:` key to see whether the exemption swallows it, and
breaking the `jobs:` lookup. Each produced its own specific diagnosis, and the
last one hit the non-vacuity floor rather than passing on zero jobs.
@scttfrdmn scttfrdmn added type: ci-cd Continuous integration or deployment improvements priority: medium Important but not urgent effort: small Small effort - 2-4 hours area: ci-cd CI workflows, gates, and release automation labels Sep 18, 2026
…l bound

Two corrections to the one job that cannot carry `timeout-minutes`.

The exemption was sound for the wrong reason. It covered any `uses:` job, and a
job calling `owner/repo/.github/workflows/x.yml@ref` has the same shape as
`release.yml`'s `gate` while being bounded by nothing this repository can see:
the key is still rejected, and the called workflow's jobs live in another repo at
a ref no test here reads. That is a six-hour hole wearing the legitimate
exemption's clothes. The test now requires the target to be a local
`./.github/workflows/*.yml` that exists, and fails on anything else — there is no
way to bound such a job, so the honest outcome is to make someone decide rather
than wave it through.

And the bound was described as the sum of ci.yml's jobs, which would be 155
minutes. `grep -c '^    needs:' .github/workflows/ci.yml` returns 0: all fifteen
jobs are independent, so they run in parallel and the caller's wall clock is the
longest of them, `packaging` at 20. A child that hangs dies at its own bound and
fails the gate. Both the job comment and the test's doc say that now, with the
condition attached — if a `needs:` chain is added to ci.yml the bound becomes the
critical path and the reasoning needs rereading.

Verified by mutation: pointing `gate` at an external workflow and at a
nonexistent local one each fail with their own diagnosis, and the exempt count
stays 1 so neither is silently reclassified.
@scttfrdmn

scttfrdmn commented Sep 18, 2026 •

Copy link
Copy Markdown
Owner Author

Follow-up in addcd33, on the 24th job — the gate that cannot carry timeout-minutes.

Recommendation: leave it uncapped, because there is no lever, and tighten the exemption so it cannot spread. GitHub has no workflow-level timeout — the only knobs are jobs.<id>.timeout-minutes and steps[*].timeout-minutes, and the first is the one Actions rejects here. So nothing can be added to this job, and the alternative — stop calling ci.yml as a reusable workflow — is the drift that shipped v0.14.0 without ever running test or lint.

Two things changed instead:

  • The exemption was sound for the wrong reason. It covered any uses: job. A job calling owner/repo/.github/workflows/x.yml@ref has exactly the same shape as gate and is bounded by nothing this repository can see: the key is still rejected, and the called workflow's jobs live in another repo at a ref no test here reads. That is a six-hour hole wearing the legitimate exemption's clothes. The test now requires a local ./.github/workflows/*.yml target that exists, and fails otherwise — since such a job cannot be bounded, the honest outcome is to make someone decide.
  • I had described the bound as the sum of ci.yml's jobs, which would be 155 minutes. It isn't: grep -c '^ needs:' .github/workflows/ci.yml returns 0, so all fifteen jobs are independent and run in parallel. The caller's wall clock is the longest child, packaging at 20, and a child that hangs dies at its own bound and fails the gate. Both the job comment and the test doc now say that, with the condition attached — add a needs: chain to ci.yml and the bound becomes the critical path through it.

Mutation-checked both ways: pointing gate at an external workflow and at a nonexistent local one each fail with their own diagnosis, and the exempt count stays 1 so neither is silently reclassified.

@scttfrdmn
scttfrdmn merged commit 950e2b9 into main Sep 18, 2026
42 checks passed
@scttfrdmn
scttfrdmn deleted the fix/531-job-timeouts branch September 20, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci-cd CI workflows, gates, and release automation effort: small Small effort - 2-4 hours priority: medium Important but not urgent type: ci-cd Continuous integration or deployment improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No workflow job sets timeout-minutes, so a hung job holds a PR blocked for six hours

1 participant