Repository navigation
ci: cut CI waste in tests, deploys and timeouts - #612
Conversation
tests.yml and test.yml were both named "Tests" and both ran Lint, the Python suite, Frontend Tests (including the live-nemar Chrome checks) on every pull request into and push to main. tests.yml now carries the union: workflow_dispatch with the model input, ruff check over the whole repository, Python 3.13 on main-bound runs, the Integration Tests job, the Codecov token, and a pytest selection that equals the union of the two old ones (checked by collecting both: 5,310 node ids). The required check names Lint, Test (3.11) and Test (3.12) are unchanged. test.yml's skip for the strip-dev-suffix commit is dropped: it tested github.actor, which is the CI_ADMIN_TOKEN owner on that push, so it never matched. tests/test_frontend_job_parity.py compared the two copies of the frontend job and has nothing left to compare. Tested: actionlint clean; uv run pytest tests/ -m "not network and not llm" passes locally.
Documentation-only pull requests relied on the skip-ci marker in both the branch commit and the title, so no workflow ran, the required Lint and Test (3.12) never reported, and an admin had to merge them. A new changes job classifies the pull request (its merge commit against the base) or the push (against the previous head). When only documentation changed, Lint and the Test legs still run and report success under their exact names, skipping their steps except test_embed_snippet_hygiene.py, which scans every tracked text file for widget embed snippets. Frontend Tests, not required, skips at job level. The required jobs skip at step level because a matrix job skipped by a job-level if reports as "Test", not "Test (3.12)". Anything the job cannot classify, or a failure of the job, runs everything. Tested: actionlint clean; the classify script run against 14 real and synthetic pushes and merge commits gives the expected outputs.
Every develop merge was followed by auto-bump-dev's "Bump version to" commit, and every release by ensure-stable-version's strip commit; each re-ran the whole Tests workflow (68 of 140 develop push runs in the forensics window were bump commits) on code tested one commit earlier. The changes job now marks a push of that commit alone, identified by author and committer github-actions[bot], the message, and a push diff of exactly src/version.py, so Lint and the Test legs report success without running their steps. github.actor cannot identify these pushes: it is the CI_ADMIN_TOKEN owner. Pull requests are never skipped, so sync-develop's pull request, which ends in a bump commit, still runs. Tested: actionlint clean; classify script cases for a lone bump, a lone strip, a bump pushed with a code commit, a human version-only push and a bump-headed pull request all give the expected outputs.
Tests, the Cloudflare preview deploys, the notebook site check, the Worker CORS check and the preview DNS cleanup had no concurrency, so every push to a pull request left the older runs going: release pull request #562 collected 139 runs from its own synchronize events. Each now groups pull request runs by workflow and pull request number and cancels the older one. Push, schedule and dispatch runs get a group of their own (the run id), so runs on develop and main are never cancelled or queued. docker-build.yml already cancels its pull request runs and keeps its own group. claude.yml is left alone: each review comment there is a separate request, not a newer version of one. Tested: actionlint reports no new findings on the six workflows.
No job had timeout-minutes, apart from one Chrome step, so a hung job ran to the 360-minute limit: nine Tests runs on 09-29 did (36528208246, Test (3.11) stuck in "Run tests"), and 36802838547 and 36802842185 sat for about 24 hours. Each job now gets about twice its p95 duration over its recent successful runs, rounded up, with a floor of 10 minutes. That is 10 everywhere except the Test legs, 21 (3.12 p95 10.2 min, 3.11 8.3), and claude.yml's @claude job, 30: two successful runs are too few to measure, and an agent session should not be cut off mid-change. Tested: actionlint reports no new findings; every job in the 21 workflows parses with a timeout-minutes value.
The 09-29 hang was inside pytest: Test (3.11) of run 36528208246 printed tests/test_core/test_litellm_chat.py::TestTagsBecomeCitations:: test_a_streamed_reply PASSED at 06:05:33 and nothing more until the 6-hour cancel. The job timeout now bounds the job; this bounds the test, so a hang fails that one test with its traceback and the run goes on. pytest-timeout joins the dev dependency group (uv add --dev), with timeout = 300 in [tool.pytest.ini_options]. The slowest passing tests, tests/test_api/test_sync.py's trigger tests, take about 70 s on CI at most (measured from six recent Test job logs) and 4 to 52 s locally. uv 0.13.0, the version CI installs, writes the lockfile as revision 5. Tested: uv run pytest tests/ -m "not network and not llm" passes locally (5,295 passed, 14 skipped) with the timeout active.
A develop merge built and pushed the dev image twice: once for the merge commit, then, seconds later, for auto-bump's version commit, and the development host (auto-update-dev.sh, every 15 minutes) could pull either. After each release, TestPyPI also got two dev versions: the sync merge's X.dev0, then the bump's X.dev1. docker-build.yml and publish-testpypi.yml no longer run on a push to develop. auto-bump-dev.yml gains a deploy job that runs after the bump and dispatches both once: the image from the head of develop (the bump commit), and TestPyPI for the bump commit's sha, so the image and the package carry the version develop ends at. With no bump (skip-bump, no .devN, a lost push race, a failed bump) it dispatches for the pushed commit, so nothing that deployed before goes undeployed. It skips only the bump commit's own push. publish-testpypi.yml takes a sha input and publishes only from develop, as before. The bump commit keeps no skip-ci marker: develop's head is a release pull request's head commit, and GitHub skips a pull request's workflows when its head commit carries the marker. Tested: actionlint clean on both changed workflows (publish-testpypi.yml keeps its 12 pre-existing shellcheck notes); tests/test_latest_tag_ policy.py passes.
docker-build.yml built and smoke-tested the image on every pull request into develop or main, documentation and frontend-only ones included. deploy/Dockerfile copies only src/, pyproject.toml, uv.lock and README.md (the hed-lsp stage clones a pinned commit), so 30 of the 88 develop merges between 09-24 and 10-13 would have built an image identical to the base. The pull_request trigger now has a paths filter on those inputs, the Dockerfile, .dockerignore and the workflow itself. That is safe at trigger level because no job here is a required check. Push, tag, release and dispatch builds are unchanged. Tested: actionlint clean; tests/test_latest_tag_policy.py passes.
Dashboard Preview
This preview will be updated automatically when you push new commits. |
Preview Deployment
This preview will be updated automatically when you push new commits. |
The docs-only path ran the whole embed hygiene file, which holds a network test that fetches jsDelivr. A jsDelivr outage would have failed every docs-only pull request. It now uses the same marker filter as the full run. Tested by running the file with the filter locally.
Test (3.13) is not a required check, but it shares a matrix with the required legs. With the default fail-fast, a 3.13-only failure cancelled Test (3.11) and Test (3.12) and blocked release pull requests. Set fail-fast to false. Tested by parsing the workflow and running actionlint.
The classifier denied a list of code directories and let any other file under docs/, .context/ and .rules/ pass, so a future script there would skip lint. Allow only Markdown in those directories, root-level Markdown and LICENSE; any other path runs everything. Tested with 15 sample paths, including nested, renamed-type and new-directory cases.
Under bash -e a failed image dispatch skipped the TestPyPI dispatch. Try both and fail at the end. Also correct the comment: the build uses the head of develop when it is dispatched, not when it starts. Tested with actionlint; the dispatch itself cannot run before merge.
The ref check covered the dispatch ref but not the sha input, so a commit from another branch could publish. Require the sha to be identical to or behind develop, and say in the input description that a sha is needed to republish an older version. Tested the compare call on real commits: identical, behind and ahead.
GitHub reads the skip-ci marker from a pull request's head commit, so a documentation merge that left it as the head of develop would make the next release pull request run no checks. Tell authors to put skip-bump in the title instead and state the cost.
test.yml was merged into tests.yml, and only the final commit of each develop merge now gets a sha image tag. Update the comments, the notebook README, the ADR sentence and the rollback instructions to match. Documentation and comments only.
Review recordRound 1 (full) ran as two Sonnet reviewers with separate lenses: the deploy and publish chain, and test gating with required checks.
Round 2 does not run: no accepted Critical, about 35 changed non-test, non-doc lines, no public contract change, and the approach was patched, not replaced. CI on the final head 88aa792: Not verifiable before merge, to watch on the first merge into |
Cuts CI waste found in 3,000 Actions runs between 2026-09-24 and 2026-10-13: duplicate test workflows, re-runs on bot version commits, two dev deploys per merge, no timeouts, no pull request cancellation, and Docker builds of unchanged images. Every required check still reports on every pull request and push it reports on today, under the same name. Nothing changes what is deployed or published, or where; the only timing changes are that develop deploys once per merge (from the final, bumped commit) and that the post-release X.dev0 no longer reaches TestPyPI or the dev host, since develop ends at X.dev1 either way.
One commit per item; each commit message has the evidence and what was tested.
Required-check inventory
Verified with
gh api repos/OpenScience-Collective/osa/rulesets/<id>andgh api repos/OpenScience-Collective/osa/rules/branches/<branch>on 2026-10-13. All three contexts come from GitHub Actions (integration_id15368), with strict status checks on, and the Admin role exempt.developprotect-dev(12110632)Lint,Test (3.12)tests.ymljobslintandtestmainprotect-main(12110625)Lint,Test (3.11),Test (3.12)tests.ymljobslintandtestLintand theTestlegs now always run (unless the whole run is cancelled) and skip their steps when there is nothing to check, so they conclude success under their own names. A trigger-level path filter would leave them "expected", and a matrix job skipped by a job-levelif:reports asTest, notTest (3.12), so neither is used.Test (3.13)is a new, non-required check on runs bound formain(it wasUnit Tests (Python 3.13)intest.yml).Changes
f992021)tests.ymlandtest.ymlboth ran Lint, the Python suite, Frontend Tests and the live-NEMAR Chrome checks on every pull request into and push tomain: 36 pull request and 10 push runs oftest.ymlin the window..rules/ci_cd.mdcalled it "unreconciled duplication".tests.ymlas the union: its triggers plusworkflow_dispatchwith themodelinput,ruff check ., Python 3.13 on main-bound runs, the Integration Tests job, the Codecov token, and a pytest selection equal to the union of the two old ones (5,310 node ids, checked by collecting both). Deletedtest.ymlandtests/test_frontend_job_parity.py, which only compared the two copies.tests/test_integrationthat onlytest.ymlran (offline, about 2 s) now run on every pull request.test.yml's skip for the strip commit is gone, but it testedgithub.actor, which is the token owner on that push, so it never matched.74c5efa)LintandTest (3.12)never reported. 6 of 88 develop merges in the window were documentation only.changesjob classifies the pull request (merge commit against its base) or push (against the previous head). Documentation only:Lintand theTestlegs report success, running onlytest_embed_snippet_hygiene.py, which scans every tracked text file, docs included. Frontend Tests skips. Anything unclassifiable, or a failure of the job, runs everything.src/,frontend/,notebook/,workers/,dashboard/,deploy/,scripts/,tests/and.github/, plusdocs/,.context/,.rules/andLICENSE.67401ae)mainran both Tests workflows.changesjob marks a push of the bot's version commit alone (author and committergithub-actions[bot], messageBump version toorchore: strip dev suffix for stable release, push diff exactlysrc/version.py); every step skips andLint/Testreport success. Never applied to pull requests, so the sync-develop pull request, which ends in a bump commit, is fully tested.21e5715)tests.yml,deploy-pages.yml,deploy-dashboard.yml,notebook-site-check.yml,sync-worker-cors.ymlandcleanup-preview-dns.ymlgroup pull request runs by pull request number and cancel the older one. Push, schedule and dispatch runs get a group of their own, so develop and main pushes are never cancelled or queued.docker-build.ymlalready did this.9994d9e)timeout-minutes. 9 Tests runs on 09-29 hit the 360-minute limit (36528208246:Test (3.11)stuck in "Run tests"); 36802838547 and 36802842185 ran about 24 hours withTest (3.12)never finishing.Testlegs get 21 (3.12 p95 10.2 min, 3.11 8.3); everything else 10, except the@claudejob, 30 (only 2 successful runs to measure, and an agent session should not be cut off mid-change).a1015b7)test_litellm_chat.py::TestTagsBecomeCitations::test_a_streamed_reply PASSED.pytest-timeoutin the dev dependency group (uv add --dev),timeout = 300in[tool.pytest.ini_options].test_sync.py's trigger tests) take up to about 70 s on CI, from six recent job logs. uv 0.13.0, the version CI installs, writesuv.lockas revision 5.fdf6c61)34f383f) and its bump (4be7afb) each built and pushed:dev; after v0.8.18 the sync merge (2014ed4) and its bump (d124a24) each pushed:devand each published to TestPyPI (0.8.19.dev0, then 0.8.19.dev1).docker-build.ymlandpublish-testpypi.ymlno longer run on push to develop.auto-bump-dev.ymlgets adeployjob after the bump that dispatches both once: the image from the head of develop (the bump commit), TestPyPI for the bump commit's sha. With no bump (skip-bump, no.devN, a lost push race, a failed bump) it dispatches for the pushed commit, so nothing that deployed before goes undeployed.publish-testpypi.ymltakes ashainput and still publishes only from develop.auto-bump-dev.ymlrunning; its deploy job runs even when the bump fails.sha-<merge commit>image tags are no longer created (sha-<bump commit>still is). Dispatched runs showworkflow_dispatchas their event.a8d3bb0)docker-build.ymlbuilt on every pull request, documentation and frontend-only included: 196 pull request runs.deploy/Dockerfilecopies onlysrc/,pyproject.toml,uv.lockandREADME.md; 30 of 88 develop merges touched none of them.pathsfilter on thepull_requesttrigger: those inputs, the Dockerfile,.dockerignoreand the workflow itself. Not a required check, so a trigger-level filter is safe. Push, tag, release and dispatch builds are unchanged.COPY) would not trigger pull request builds until the list is updated; push builds still catch it.Automated commits
auto-bump-dev.yml"Bump version to X.devN" (pushed withCI_ADMIN_TOKEN)develop:dev,:develop,sha-), TestPyPI publish, Auto Bump Dev (job skipped)LintandTest (3.12)report success), Auto Bump Dev (both jobs skipped). The image and the TestPyPI release are dispatched once by the run that made the bump.ensure-stable-version.yml"chore: strip dev suffix for stable release" (CI_ADMIN_TOKEN)main:main,sha-), Tag and Release (tag, then the GitHub release, whose event runs the:latest/X.Y.Z/X.Ybuild, PyPI and the release notes), Notify Docs, Ensure Stable Version (job skipped)main, so tagging, the release, PyPI,:latestand:mainmust run on it.sync-develop.ymlmerge ofmainplus "Bump version to X.dev0" (CI_ADMIN_TOKEN)chore/sync-develop-after-vX, then a pull request intodevelop:devat X.dev0), TestPyPI X.dev0, Auto Bump Dev, then the bump row above (:devand TestPyPI again at X.dev1)mainmust be tested). Its merge on develop: Tests, Auto Bump Dev, which bumps to X.dev1 and deploys once: one:devand one TestPyPI release, X.dev1sync-worker-cors.yml"chore: sync worker CORS from community configs" (CI_ADMIN_TOKEN)main,developtag-release.ymltag pushvX(GITHUB_TOKEN)GITHUB_TOKENpushes start no workflowtag-release.ymlgh release create(CI_ADMIN_TOKEN):latest,X.Y.Z,X.Y), Publish to PyPI, Create GitHub ReleaseWhy the bump and sync commits do not carry the skip-ci marker, although nothing downstream needs their push any more: GitHub reads the marker from a pull request's head commit, not only from a push. The head of
developis almost always an auto-bump commit, so a marker there would stop every release pull request (developtomain) from runningLint,Test (3.11)andTest (3.12), and the sync-develop pull request, whose head is its bump commit, could not auto-merge. The workflows that would re-run on them skip them at job or step level instead, and the one publish that needs the bumped version (TestPyPI), with the dev image, is dispatched explicitly by the bump workflow. The strip commit cannot carry it either:tag-release.ymlruns on its push.Deploys and publishes per environment
Traced from the runs of merge #609 and release v0.8.18 (
6818c5amerge,a6d483bstrip, release event, sync pull request #608,2014ed4sync merge,d124a24bump).:dev/:develop(development host, polled every 15 min):latest,X.Y.Z,X.Y:mainimagenotify-docs.yml)main, 2 on the develop syncmain, same on developProposals not implemented
:mainbuild and one docs dispatch per release. Production (:latest, PyPI) already runs once per release, from the release event on the strip commit; what runs twice is:mainand the docs dispatch, once for the release merge and once for the strip commit 11 seconds later. The fix has the same shape as develop: makeensure-stable-version.ymlrun on every push tomainand dispatchdocker-build.ymlandnotify-docs.ymlafter the strip (or for the pushed commit when there is nothing to strip), and drop theirpush: maintriggers. Not implemented because it rewires the release pipeline, which cannot be exercised before a real release, and because:mainhas no consumer (DEPLOYMENT_ARCHITECTURE.md: "following a branch head deliberately"), so which tag counts as production onmainis the owner's call. Saves 1 image build and 1 docs rebuild per release.GIT_COMMIT_SHA, so skipping a documentation-only push tomainwould leave:mainreporting an older commit, and every push to develop is bumped, so its image always changes anyway.widget-route-health.ymlcron. 1,427 scheduled runs in the window, 45% of all runs, about 74 a day (GitHub dropped about a fifth of the 96 a 15-minute cron asks for), each two jobs of about 5 seconds. It is cheap on a public repository; the cost is noise in the Actions list. Recommendation: every hour at an off-peak minute (7 * * * *), which cuts runs by 75% (about 357 in the same window) and moves worst-case detection from about 15 to about 60 minutes, plus GitHub's schedule delay; if a partner-pinned host needs faster detection than that, an external uptime monitor fits better than Actions cron.mcp.nemar.orgout of the required checks.widget_e2e.py, which the--serveChrome checks (light and dark, first paint, pop-out) start, fetcheshttps://mcp.nemar.org/mcpat startup, inside the requiredTest (3.12)leg. Of the 8 develop push failures in the window, 5 were Chrome steps, 4 of them inTest (3.12)(first paint, pop-out twice, launcher geometry), and 3 of those in the--servechecks. Recommendation: givewidget_e2e.pya recorded NEMAR response for CI (or run those three checks in a separate, non-required job, plus the existing schedules), which takes about 1.3 minutes (p95) and a third-party outage out of every merge gate. Not implemented: it changes what gates a merge, and needs test changes.[skip-bump]in the title avoids that; the cost is one identical dev image build per documentation merge.publish-testpypi.yml(12),tag-release.yml(7),release.yml(5),ensure-stable-version.yml,sync-worker-cors.yml,deploy-pages.yml,deploy-dashboard.yml(3 each) andcleanup-preview-dns.yml(2), includinggithub.head_refused directly inrun:scripts indeploy-pages.yml,deploy-dashboard.ymlandcleanup-preview-dns.yml, a script-injection pattern worth fixing on its own. Left alone because they sit in release and deploy scripts outside this change.Testing
actionlint1.7.12 on all 21 changed workflows: no new findings (38 pre-existing, listed above)git diff --checkuv run ruff check .anduv run ruff format --check src testsuv run pytest tests/ -m "not network and not llm"with the new timeout: 5,295 passed, 14 skippedtests/test_latest_tag_policy.pyandtests/test_frontend/test_embed_snippet_hygiene.py, which read workflowschangesclassifier run against 14 real and synthetic cases: the lone bump4be7afband stripa6d483bskip; a bump pushed with a code commit, a human version-only push, a bump-headed pull request, a new branch, an unreachable previous head and dispatch run everything; docs-only pull requests run the documentation test; Markdown underfrontend/or.github/counts as codeClassify changesran everything (workflow files changed);Lint,Test (3.11)andTest (3.12)reported under their exact names and passed, with Frontend Tests, All Tests Passed, the Docker pull request build, the notebook site check and both preview deploys; Integration Tests, Build and Push to GHCR and Track the issue skipped as designedNot testable before merge: the docs-only and bump-commit paths on GitHub itself, and the develop deploy dispatch, which runs from develop's copy of
auto-bump-dev.yml. After merging, the first develop merge should show oneDeploy developjob dispatching one Docker and one TestPyPI run, and its bump commit a Tests run whoseLintandTestlegs pass with skipped steps.This pull request touches
deploy-pages.ymlanddeploy-dashboard.yml, so their pull request preview deploys run for it, as for any change to those files.