Skip to content

fix(ci): alarm at 360 s, one P0 issue, shards by recorded time - #5377

Merged
dan-petty merged 7 commits into
mainfrom
fix/5247-ci-duration-alarm
Nov 13, 2026
Merged

dan-petty merged 7 commits into
mainfrom
fix/5247-ci-duration-alarm

Conversation

@dan-petty

@dan-petty dan-petty commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

devops ci job-time now fails only when the mean of the last 20 runs of Tests & Coverage on main is over 360 s: the 300 s target of AGENTS.md rule 5 and the 60 s of tolerance that the owner allowed on 2026-10-23. With --file-issue, the daily Test Job Duration job comments on the open alarm issue of the check, or files one with the Status New and the priority P0.

The mean was 316 s because the split by lines put a short module with slow tests in one shard. The split now weighs each test module by its seconds in tests/module_durations.json, which the new devops ci durations writes from the JUnit reports of the shards. This builds the shard weights that #4250 asks for. The unused pytest-split pin goes.

A fixture of #5362 keeps the inherited PYTHONPATH, which gives pytest in the Service image.

Closes #5247

Change: openspec/changes/archive/2026-11-13-5247-the-duration-alarm-fires-at-360/

Plan the alarm limit of 360 s, one P0 issue for each breach, and
the split of the test shards by recorded seconds.
devops ci job-time fails above 360 s by default: the 300 s target of
AGENTS.md rule 5 and the 60 s of tolerance of the owner (2026-10-23).
With --file-issue it comments on the open issue that holds the alarm
line of the check, or files one with priority/p0-critical. The
scheduled job runs with the option and issues: write.

The test shards weigh each module by its recorded seconds in
tests/module_durations.json, and a module without a record weighs its
lines at the recorded rate. devops ci durations writes the record from
the JUnit reports of the shards of the last 20 runs of main. A replay
of those runs gives a mean of 284 s, against 316 s with the split by
lines.
No command or workflow uses pytest-split: each shard passes its own
test files to pytest, and the split reads tests/module_durations.json.
AGENTS.md rule 5 and docs/TESTING.md state the 1 minute of tolerance
of the owner. TESTING.md tells how the alarm files its issue, how the
split weighs the modules, and when to write the record again.
The alarm issue holds a Priority, so intake does not place it, and
refine reads only the items with the Status New or Ready. The job now
sets status/new, as intake does for a new item, so the P0 issue enters
the roadmap. AGENTS.md rule 5 gives the unit of the tolerance, and
docs/SDLC.md describes the split by recorded seconds.
@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 13, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Checks and proof

fail-to-pass (builder run, uv run devops ci fail-to-pass --base origin/main): satisfied, exit 0. 8 tests failed on the base and passed on the head in tests/ci/test_ci_durations.py, tests/commands/test_ci_shard.py and tests/github/test_ci_job_time.py. 2 modules could not be collected on the base, because they import the new modules.

Scoped tests (review, after the fix): uv run devops ci test tests/github/test_ci_job_time.py tests/commands/test_ci_shard.py tests/ci/test_ci_durations.py tests/ci/test_fail_to_pass.py tests/commands/test_ci.py tests/invariants: 1,096 passed.

Static rows (uv run devops ci --skip test,outdated, mypy included): 23 rows pass. The row git fails on the transcript review_window.json with git 2.55.0. It fails the same way on a clean origin/main (#4865). This branch does not change it.

Other checks: uv run devops openspec check passed. uv run devops docs generate --check passed. uv run devops ci --only docs,lockfile,uv-check passed. AGENTS.md has 6,499 of 6,500 characters, and tests/invariants/test_agents_md.py passes. The pre-push hook passed.

Expected new mean (builder replay of the last 20 runs of main, runs 43343656489 to 43368466673, 80 shard JUnit reports): each shard keeps the setup time and the residual of its own runner. The split of each run gives 316.0 s, the same as job-time. The split by lines of the current tree gives about 298 s. The split by recorded seconds, with the weights of each run from the other 19 runs, gives 284.2 s. The committed record gives 283.2 s. A perfect balance gives about 274 s. The expected mean is about 284 s, under 300 s. This value comes from a model, not a measurement: the next 20 runs of main after the merge measure it. The current mean of 316 s is inside the new limit of 360 s.

Render diff

The branch changes no path under k8s/ and no chart values. So there is no kustomize or helm render diff, and no pod restarts. The only workflow change is in .github/workflows/ci.yml: the job job-time gets issues: write and runs devops ci job-time with --file-issue, and the comments change.

Review fixes

  • The alarm issue also gets status/new. It holds a Priority, so intake does not place it, and refine reads only the items with the Status New or Ready. Without a Status, the P0 issue stays outside the roadmap.
  • AGENTS.md rule 5 now gives the unit of the tolerance: "averages over 5 min + 1 min tolerance".
  • docs/SDLC.md describes the split by recorded seconds and devops ci durations, not the old split by lines.

For the owner

The fixture of the #5362 test set PYTHONPATH to the src/ of the
checkout only. In the Service image, the sitecustomize of the inherited
PYTHONPATH gives the gate row pytest, so the row failed with "No module
named 'pytest'" on both trees. The fixture now puts the src/ of the
checkout first and keeps the inherited PYTHONPATH after it, as
tests/commands/test_ci.py does.
@dan-petty
dan-petty force-pushed the fix/5247-ci-duration-alarm branch from 67491ff to ce34ef0 Compare November 13, 2026 06:43
@dan-petty

Copy link
Copy Markdown
Owner Author

Second push: Service Image Tests (shard 2 of 6)

The first run failed tests/ci/test_fail_to_pass.py::test_a_gate_row_on_the_base_tree_imports_the_source_of_the_base_tree in the Service image (run 43379596448) with assert (False, "The ...med 'pytest'") == (True, ...). #5362 added the test. Its fixture set PYTHONPATH to the src/ of the checkout only. In the image, the sitecustomize under PYTHONPATH=/opt/service-test/boot gives pytest (service-image-test.yml), so the gate row could not import pytest on either tree. Service Image Tests run on this pull request only because it changes pyproject.toml and uv.lock. No image run has occurred on main since #5362, so the daily run of 2026-11-14 would also fail without this fix.

Fix (commit 47bc55f): the fixture puts the src/ of the checkout first and keeps the inherited PYTHONPATH after it, as tests/commands/test_ci.py does. Local proof: uv run devops ci test tests/ci/test_fail_to_pass.py: 57 passed. The test also passes with PYTHONPATH=/nonexistent-boot. This push re-runs the image proof.

@dan-petty
dan-petty marked this pull request as ready for review November 13, 2026 06:52
@dan-petty
dan-petty merged commit 2abd6ff into main Nov 13, 2026
35 checks passed
@dan-petty
dan-petty deleted the fix/5247-ci-duration-alarm branch November 13, 2026 11:31
dan-petty pushed a commit that referenced this pull request Nov 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.127.1](v0.127.0...v0.127.1)
(2026-11-13)


### Bug Fixes

* **ci:** alarm at 360 s, one P0 issue, shards by recorded time
([#5377](#5377))
([2abd6ff](2abd6ff))
* **github:** read the plan diff and the release files from the merge
base ([#5401](#5401))
([c54e14c](c54e14c))
* **infra:** turn off the Ansible color of every playbook run
([#5381](#5381))
([5bafb1a](5bafb1a)),
closes [#5352](#5352)
* install-tools --check passes an older openspec binary
([#5355](#5355))
([625c89d](625c89d))
* **k8s:** allow only the Ingress origins in Open WebUI
([#5357](#5357))
([fdab229](fdab229))
* **pr:** count only the latest run of each check
([#5393](#5393))
([634dc91](634dc91))
* **review:** drop the fixed gateway URL of the review dry run
([#5399](#5399))
([0666d3d](0666d3d))
* **review:** review a pull request at the merge base of its base branch
([#5387](#5387))
([351ba2a](351ba2a)),
closes [#5346](#5346)
* **roadmap:** end fix-plan at a time budget with a result line
([#5380](#5380))
([20468f4](20468f4)),
closes [#5363](#5363)
* **roadmap:** refine skips an item that changed during the write
([#5392](#5392))
([a863dda](a863dda))
* **roadmap:** stage writes RENAMED and REMOVED spec deltas
([#5367](#5367))
([4abbbd2](4abbbd2))
* **roadmap:** title the delivery by the summary of its plan
([#5376](#5376))
([10e1069](10e1069))

---
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): the duration alarm fires at 360 s and files a P0 issue

1 participant