Repository navigation
Retry a failed test once in CI, and set flaky tests aside until they are steady, with no token in a test step - #2992
Merged
Conversation
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
mxmzb and
samjulien
as code owners
December 5, 2026 04:31
#2987 gave each test step GH_TOKEN, so its runner could read the open flaky-test issues. On main that broke three things, and #2990 reverted it: - The test shard's step held a value the upstream upgrade cannot run (scripts/integrate-upstream.ts refuses an expression in a step's env). - The tests inherited the token. scripts/ci-run-tests.test.ts runs ci-run-tests.ts, which then asked GitHub through the suite's closed network and timed out at 5 seconds, three times. - api/client-boundary.test.ts did not know the script's fetch() (fixed in the commit before). Now each test job reads the list once, in a `uses` step of its own (.github/actions/flaky-tests-quarantine, `bun scripts/flaky-tests.ts quarantine <file>`), into flaky-tests-quarantine.json in the runner's temporary folder. The test steps read that file and never ask GitHub, and hold no token. The upstream upgrade skips `uses` steps, so it runs the shard's steps as before. Regression tests: a test step with a token in its environment makes no request to GitHub, and every ci.yml job that runs tests reads the list first and has no token in a test step. Both fail on #2987 as it landed, as do the upstream checks and ci-run-tests tests it broke.
…equests Live in openbot-backend, the sweep ran after every run of CI, End to end and Main images. It listed the runs of every workflow, and read the annotations of every job of each one, one request at a time. Its first sweeps ran past their 10 minutes, and spent the requests the repository's token shares with every other workflow. Now it: - runs every 20 minutes, one at a time, from where the last sweep on the timer left off; - lists only the watched workflows' runs; - reads only the jobs JOBS names (the ones that run tests), eight at a time; - never makes more than 400 requests. Past that it keeps the newest runs and says how many older ones it left unread. No `workflow_run` trigger is left, so zizmor's exception for it goes. A test holds JOBS to every ci.yml job that runs tests, and to no other.
davidmckayv
force-pushed
the
ci/flaky-tests-set-aside-reland
branch
from
December 5, 2026 04:45
1ad527e to
0921644
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#2987 (flaky tests retried once and set aside) broke main and was reverted in #2990. This lands it again, fixed at the cause. Main's push run 47477429817 and merge groups 47477444820 / 47477446193 failed in the same three places. I read every failing job's log in those runs: only shards 1 and 5 failed on their own, and
testsandverifyfailed because of them.tests/upstream-upgrade-checks.test.ts: "ci.yml test step 7 env GH_TOKEN is not a literal value". The upstream upgrade runs the test job'srunsteps itself (scripts/integrate-upstream.ts,ciChecks), and it refuses an expression.scripts/ci-run-tests.test.ts, "changed desktop browser tests", 3 times, each timing out at 5 s. The test step heldGH_TOKEN, and the tests inherited it. The test runsci-run-tests.ts, which then asked GitHub through the suite's closed network until it timed out.api/client-boundary.test.ts: the script'sfetch()was not on the allowlist.The fix
usesstep of its own:.github/actions/flaky-tests-quarantine. That step runsbun scripts/flaky-tests.ts quarantine <file>with the job's token and writesflaky-tests-quarantine.jsonto the runner's temporary folder.test-ci.ts,ci-run-tests.tsand the real-browser wrapper read that file and never ask GitHub, so no test they run can either.usessteps, so it runs the shard's steps exactly as before.GITHUB_ENVline, which zizmor flags as dangerous.fix-flaky-tests-allowlist(c29f977), cherry-picked: third-party, likescripts/ci-watch.ts.JOBS), eight at a time, and stops at 400 requests, keeping the newest runs. With noworkflow_runtrigger, zizmor needs no exception for it. A test holdsJOBSto every ci.yml job that runs tests, and no other.Regression tests (each fails on #2987 as it landed, dca88040f, and passes here)
scripts/flaky-tests.test.ts: "a test step never asks GitHub, even with a token in its environment". The fake GitHub receives no request.scripts/flaky-tests.test.ts: "every job that runs tests reads the list first, and no step that runs tests holds a token". It reads ci.yml.tests/upstream-upgrade-checks.test.ts, the threescripts/ci-run-tests.test.tstests andapi/client-boundary.test.ts.All of the above was run locally with CI's environment (
GITHUB_ACTIONS,GITHUB_REPOSITORY,GH_TOKENset): 31 pass. Also passing:Changelog
none