Skip to content

fix(ci): set job timeouts from the measured run times - #4892

Merged
dan-petty merged 3 commits into
mainfrom
fix/4677-job-timeouts
Nov 12, 2026
Merged

dan-petty merged 3 commits into
mainfrom
fix/4677-job-timeouts

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Each job limit of ci.yml and service-image-test.yml is now about two times the longest run of the job, and 5 minutes at least. The old limits were up to 129 times the longest run, so a hung job held one of the 20 runners for 30 to 60 minutes. Now it holds a runner for 20 minutes or less. Changed-Test Independence goes to 15 minutes, as #4509 merged.

The gate and test steps get a limit under the limit of their job (3 of 6, 17 of 20, 14 of 20 minutes). A hung step then fails with a message that names it, and the job keeps time for the steps after it. The test steps outlast the 600 s bound of one test. Contract tests hold the limits.

Closes #4677

Change: openspec/changes/archive/2026-11-12-4677-set-job-timeouts-from-the-measured/

Each job limit of ci.yml and service-image-test.yml is now about two
times the longest run of the job, and 5 minutes at least. A hung job
gives its runner back after 20 minutes or less, not 30 to 60 minutes.

The steps that run the gate or the tests get a limit under the limit of
their job. A hung step then fails with a message that names it, and the
job keeps time for the steps after it. The test steps last longer than
the 600 s hang bound of one test, so one test < its step < its job.

Contract tests hold the limits, and hold each step limit under its job
limit in every workflow.
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners labels Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Measurements

Source: the Actions API, 4,774 jobs of the ci.yml runs of 2026-11-07 to 2026-11-11 (actions/runs/<id>/jobs). Run time is completed_at minus started_at of the job; queue time is not counted. A green run takes the same time before and after this change: the change sets only limits.

Job Jobs measured Longest run Limit before Limit after
Static Analysis 196 176 s 15 min 6 min
Tests & Coverage (shard) 717 641 s 30 min 20 min
Tests & Coverage 168 63 s 15 min 5 min
Test Job Duration 24 125 s 10 min 5 min
DevContainer Image 169 416 s 60 min 20 min
Service Image 167 308 s 30 min 12 min
Runner Image 167 297 s 30 min 12 min
MCP Server Image 132 331 s 30 min 12 min
Dependency Freshness 12 scheduled runs 33 s 15 min 5 min
Changed-Test Independence 23 runs after #4509 174 s (797 s before #4509) 30 min 15 min
Rule Pack Tests 3 runs that tested rules (2026-10-17) 35 s 15 min 5 min
Docs Site Build 95 builds 35 s 10 min 5 min
Image Pins 31 checks 74 s 10 min 5 min
Third-Party Image Scan 1 scan (2026-11-07) 47 s 15 min 5 min
Service Image Tests (shard) 461 678 s 30 min 20 min

Step limits, with the sum of the longest runs of the steps before and after the step:

Step Longest run Before it After it Step limit Job limit
Static Analysis Quality Gate 108 s 71 s 42 s 3 min 6 min
Tests & Coverage Quality Gate 610 s 66 s 6 s 17 min 20 min
Run Test Suite in Service Image 527 s 244 s 40 s 14 min 20 min

The longest time that a hung job holds a runner: 60 min before, 20 min after. No job of the window had the conclusion timed_out.

The acceptance check: no job of these workflows has the conclusion timed_out in the 2 weeks after the merge.

Owner steps: none. The change alters no repository setting and no required check name.

@dan-petty

Copy link
Copy Markdown
Owner Author

Fail-to-pass

uv run devops ci fail-to-pass --base origin/main on the branch:

  failed on base: tests.invariants.test_workflow_contracts::test_the_step_that_runs_the_suite_stops_before_its_job
  failed on base: tests.invariants.test_workflow_contracts::test_a_pull_request_that_changes_the_site_builds_it_with_the_pages_builder
  failed on base: tests.invariants.test_workflow_contracts::test_a_pull_request_that_changes_an_image_pin_resolves_each_pinned_image
  failed on base: tests.invariants.test_workflow_contracts::test_each_job_limit_is_about_two_times_its_longest_run
4 failed on base (4 failed and 117 passed in tests/invariants/test_workflow_contracts.py; 0 errored).

On the head, uv run devops ci test tests/invariants/test_workflow_contracts.py gives 122 passed. uv run devops ci --only actionlint,zizmor passes.

@dan-petty

Copy link
Copy Markdown
Owner Author

Service Image Tests (shard 3 of 6) fails: #4891, not this change

This pull request changes service-image-test.yml, so its paths filter starts the in-image suite. Shard 3 failed after 124 s in the test step, not at a limit:

FAILED tests/invariants/test_hermetic_floor.py::test_a_support_helper_called_outside_pytest_writes_nothing
  ... tests/support/home_write_guard.py, line 45: import pytest
  ModuleNotFoundError: No module named 'pytest'
1 failed, 3593 passed, 2 skipped in 114.90s

#4857 added this test on main. In the image, the child python -I ignores PYTHONPATH, so it does not load the test site-packages, and the import of pytest fails before the guard message. #4891 tracks it. The five other shards passed in 285 to 339 s, under the new limit of 20 minutes. Every required check passed.

The pull request stays a draft until #4891 merges and this check passes.

@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 04:04
@dan-petty
dan-petty merged commit e26dde5 into main Nov 12, 2026
32 checks passed
@dan-petty
dan-petty deleted the fix/4677-job-timeouts branch November 12, 2026 04:05
dan-petty pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.116.0](v0.115.0...v0.116.0)
(2026-11-12)


### Features

* **gh:** name the gh groups issue, run, label and secret
([#4923](#4923))
([2dd4c97](2dd4c97))


### Bug Fixes

* **ci:** set job timeouts from the measured run times
([#4892](#4892))
([e26dde5](e26dde5))
* **design:** check the design test bound and source hex values
([#4922](#4922))
([e2c1a5a](e2c1a5a))
* **k8s:** check the credential sync context as a kubeconfig name
([#4916](#4916))
([8797c88](8797c88))
* **roadmap:** bound the stage gate returns and start no return in a
drain ([#4925](#4925))
([77eed38](77eed38))
* **roadmap:** count each implement outcome once with its repo
([#4903](#4903))
([c17f71f](c17f71f))
* **roadmap:** refine looks again at a wait that older rules set
([#4919](#4919))
([e6f7cb9](e6f7cb9))


### Performance Improvements

* **k8s:** put the dependencies in their own image layers
([#4872](#4872))
([48dc866](48dc866))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ci): set job timeouts from the measured run times

1 participant