Skip to content

fix(ci): run the job-time alarm on the schedule only - #4774

Merged
dan-petty merged 2 commits into
mainfrom
fix/4634-job-time-schedule
Nov 11, 2026
Merged

dan-petty merged 2 commits into
mainfrom
fix/4634-job-time-schedule

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Test Job Duration now runs only on the daily schedule and on a manual run of ci.yml. Before, it ran on each push to main and read almost the same window of 20 runs each time. That mean was over 300 s, so each push run of main failed in this job, and a new failure on main could hide behind it.

devops ci job-time now times a run as the run time of the slowest shard plus the run time of the Tests & Coverage join. The time that the jobs waited for a runner is shown in a column and on its own line, and the 300 s limit does not count it.

The concurrency group of ci.yml now holds the event name, so a merge does not cancel the schedule run.

Closes #4634

Change: openspec/changes/archive/2026-11-11-4634-run-the-job-time-alarm-on/

Test Job Duration ran on each push to main and read almost the same
window of 20 runs each time. The mean was over 300 s, so each push run
of main failed in this job, and main had no green run. The metric also
counted the time that the shards and the join waited for a runner.

The job now runs on the daily schedule and on a manual run only. The
concurrency group of ci.yml holds the event, so a merge does not cancel
the schedule run. devops ci job-time times a run as the run time of the
slowest shard plus the run time of the join, and prints the queue time
on its own line. The limit stays 300 s and does not count the queue.
@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 11, 2026
@dan-petty

dan-petty commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner Author

Fail-to-pass

uv run devops ci fail-to-pass --base origin/main (exit 0): 8 failed on base, 22 passed, 0 errored, in tests/github/test_ci_job_time.py. The tests that fail on base:

  • test_a_run_with_shard_jobs_is_timed_by_its_slowest_shard_and_the_join
  • test_the_time_a_run_waited_for_runners_is_not_counted
  • test_a_shard_without_an_end_is_not_the_slowest_shard
  • test_a_job_with_a_longer_name_does_not_change_the_time_of_the_check
  • test_the_command_checks_the_run_time_and_prints_the_queue_time_on_its_own_line[run-time-inside-the-limit]
  • test_the_command_checks_the_run_time_and_prints_the_queue_time_on_its_own_line[run-time-over-the-limit]
  • test_the_workflow_runs_the_check_on_the_schedule_and_by_hand_and_no_job_waits_for_it
  • test_a_push_to_main_does_not_cancel_the_schedule_run

Before and after (Actions API, 2026-11-11)

devops ci job-time --repo dan-petty/devops-cli, the same 20 completed push runs of main:

Before After
Mean time of Tests & Coverage 584 s 499 s
Mean queue time (not counted) (counted in the mean) 85 s
Run 43018142394 975 s 472 s (queue 503 s)
Run 42952436633 1072 s 573 s (queue 499 s)
Exit code 1 1

The alarm stays red: the mean without the queue is still over 300 s. #4250 and the registry token check of the CI audit work on that time.

Push runs of main:

  • Last 30 completed push runs of ci.yml on main: 21 cancelled, 9 failed, 0 passed. Each of the 9 failed runs failed only in Test Job Duration.
  • Jobs of one push run of main: 18 before, 17 after. Test Job Duration ran 112-151 s in the last 5 runs (mean 129 s), so each merge uses about 2 runner-min less.
  • Schedule run 42963886166 of 2026-11-11 concluded cancelled. Its concurrency group was the same as the group of the pushes to main.

Local checks

  • devops ci --skip test: all checks pass (mypy, ruff, bandit, docs, openspec and the others).
  • devops ci --only actionlint,zizmor: pass.
  • devops ci test tests/github tests/lang: 1173 passed. devops ci test tests/github/test_ci_job_time.py tests/commands/test_ci.py tests/invariants/test_workflow_contracts.py: 272 passed.

Not shown yet

Two acceptance criteria need runs after the merge: a push run of main with no failed test is green, and a merge does not cancel the schedule run of 05:00 UTC. The tests of the workflow file hold both conditions.

Owner steps

None. No repository setting changes, and every required check keeps its name.

@dan-petty

Copy link
Copy Markdown
Owner Author

Measurements

All figures come from the GitHub Actions API on 2026-11-11.

Push runs of main (last 30 completed push runs of ci.yml)

Before After
Runs that hold a Test Job Duration job 30 of 30 0 (the job runs on schedule and workflow_dispatch only)
Mean run time of that job 125 s per push run 0 s per push run
Runner time of that job over the 30 runs 62.5 min 0 min
Runs that passed 0 of 30 (9 failed, 21 cancelled) -
Failed runs where Test Job Duration is the only failed job 9 of 9 -

Thus, after the merge, a push run of main with no other failed job is green.

The metric (devops ci job-time --repo dan-petty/devops-cli, last 20 push runs of main)

Before (origin/main) After (this branch)
Mean that the limit applies to 594 s (queue included) 502 s (queue not included)
Mean queue time, on its own line - 92 s
Exit code 1 1

The alarm stays: the mean without the queue is still over 300 s, so the schedule run fails until the test time goes down.

Run 43018142394 (acceptance criterion: 520 s or less): before 975 s, after 472 s run time and 503 s queue time.

Local checks: devops ci --only actionlint,zizmor passes.

Owner steps: none. The change alters no repository setting and no required check. Test Job Duration is not a required check.

@dan-petty
dan-petty marked this pull request as ready for review November 11, 2026 19:11
@dan-petty
dan-petty merged commit 60c0847 into main Nov 11, 2026
32 checks passed
@dan-petty
dan-petty deleted the fix/4634-job-time-schedule branch November 11, 2026 19:11
@dan-petty

Copy link
Copy Markdown
Owner Author

After the merge

  • Push run 43086170827 of main (commit 4b28980, which holds this change) passed. Its Test Job Duration job was skipped. This is the first green push run of main in the window that the issue measured.
  • Push run 43084942958 (the merge commit) was cancelled by the next merge in the same concurrency group, as before.
  • Push run 43084702686 started before the merge under the old group name, so the new group does not cancel it. This occurs one time only.
  • Not yet seen: a schedule run of ci.yml (05:00 UTC) that a merge does not cancel. The first schedule run after the merge shows it.

dan-petty pushed a commit that referenced this pull request Nov 11, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.113.0](v0.112.3...v0.113.0)
(2026-11-11)


### Features

* **roadmap:** detect merge conflicts on open ready pull requests
([#4766](#4766))
([3f72e76](3f72e76))


### Bug Fixes

* **ci:** run the job-time alarm on the schedule only
([#4774](#4774))
([60c0847](60c0847))


### Performance Improvements

* **roadmap:** parse only the test modules that name the registry
([#4778](#4778))
([4b28980](4b28980))

---
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): run the job-time alarm on the schedule only

1 participant