Public: anyone can read this; the crew can change it.
A file that is red in the full suite and green when run alone is filed as flaky under load, not as red #12302
Merged 21d 7h ago, live in production
After a full-suite verification fails, the service now runs each failing file once more on its own. A file that passes alone is marked flakyUnderLoad on the run's detail; a file that fails alone stays a plain red.
-
Reviews
Changes requested — before the latest pushThe classifier in rerun.ts is clean and its unit tests are good, but the service wiring, which is the behaviour the issue is about, has no test. Two other things need changing.
- (Fix first) Add a test that drives the red-verification path in src/checks/service.ts. A failing verification with one file that is green alone and one that is red alone should leave
flakyUnderLoadon the run detail with only the green one, and write thererun:lines to the log. A killed or aborted step, or a cluster Job, should write norerun:lines. Today deleting the whole service.ts block leaves every test green, so the wiring is unguarded. - A pass that overran the budget is recorded as alone="red", and the log then reads
rerun: x red alone in N sfor a file that passed. That log line is false. Give it its own outcome, such as "timeout" or "over budget", with its own log line. It must still not count as flaky. Test the log line. - The re-runs can add up to 5 minutes (10 files) to every red verification, and they run on the gate's critical path. The direction is faster pipeline and a per-test/file time budget (#1242). Cut RERUN_BUDGET_MS to a figure you can justify, for example 60 s. Say in the pull how long a typical re-run takes and why that is the right bound.
The rest is fine: the paths are validated by a regex before reaching the shell, there are no new dependencies, and no UI or TUI surface is involved.
ApprovedClean. Failing paths are regex-validated (no quote, space or $) and single-quoted before reaching the shell. Re-runs share a 60 s budget and are capped at 10 files. A pass that overran the budget gets its own outcome,
over, and a true log line. The service wiring has an end-to-end test (green alone, red alone, killed step). Jobs, aborted runs and killed steps are skipped. No dependency, no README change and no UI surface. I did not run the suite or fetch the preview; the pull is green. - (Fix first) Add a test that drives the red-verification path in src/checks/service.ts. A failing verification with one file that is green alone and one that is red alone should leave
-
Checks
shipped production is serving it deploy f698c54
-
History
- Merge main into scout/12296: keep #12295's failure excerpts and shards beside #12296's flakyUnderLoad cc383b9
- A full-suite red report quotes the failing assertion and the lines around it, and says how to reproduce it (#12304) c1f25a9
- A contrib pull's check runs in the outside lane and nothing from its branch is previewed before an approval (#12240) 180b837
- A git process that cannot start is an error on one request, never the end of… (#12259) 9725453
- An origin you connect is followed like a parent: take updates, converge and p… (#12118) 96492c1
- "How is my forge?" has one answer everywhere: the same needs-you stack as the… (#12186) 47e6991
- When checks are scarce, they go to the work that matters most: the check queu… (#12231) 9f16946
- Test the red-verification re-run through the service; over-budget passes are their own outcome; budget one minute (#12296) 5633466
- Vitals raise a broken need on a crash loop (#12294) ee63e4f
- A reader of a fork who may not read its parent is held to what the fork's own refs reach, at git and at every read the forge makes for them 24f2911
- Appending a cost-ledger entry reads only the file's tail, so the finish path stays fast at month's end (#12280) e2a191c
- A full disk makes the forge read-only with one plain sentence; it never exits… (#12147) f9c1fcc
- Cost ledger: snapshots append an entry too (#12291) f0961d3
- An agent run keeps its tokens in and out, and its cost-ledger entry carries them (#12274) 119f4d2
- A pull's green is the merge's green: checks run on the merge with its base, a conflict is said first, and a stale green never reads as ready (#12235) 8c46a8d
- Main is red on five stale tests: fix them in one pull (#12299) ad44386
- A person sent to sign in by an app comes back to the app, whether they sign i… (#12177) e1f0f37
- Wrap rerun.ts's log-line comment to 100 columns, as the gate holds (#12296) ea2370c
- Redeploy the preview: the last deploy failed with the app up and /healthz green (#12296) e52e049
- The repository front page reads its week's figures, its governor line and its milestone lines once per five seconds, a branch tip from the repository's own files and the pulls landed in an hour or a week by merge time: on the stage rig's copy of production /trevato/forge goes from 150-190 ms warm to 43-60 ms (render 70 ms to 20, governor 21 to 0, decisions 15 to 0, adapter 12-25 to 1), and 145-150 ms on the one load in five seconds that reads them again caaa084
3 earlier comments
After a full-suite verification fails, the service now runs each failing file once more on its own. A file that passes alone is marked flakyUnderLoad on the run's detail; a file that fails alone stays a plain red.
src/checks/rerun.ts(new):rerunAlone(files, runner, { budgetMs, now })runs the files one at a time and returns, for each, whether it was green alone, red alone, or skipped, plus how long it took. All re-runs share one 5-minute budget, and each run is only given what is left of it. A pass that finishes over the budget counts as red. A file the budget doesn't reach, any file past the tenth, and any path that isn't a plain test path are skipped and stay plain red. The module also builds the log lines (rerun: test/x.test.ts green alone in 3.1 s), the quotedbun test './file'command, andwithFlaky, which only names files that were actually in the failing list.src/core/runs.ts:CheckDetailgets an optionalflakyUnderLoad?: string[]. It is plain data;report.tsis untouched, as the issue asked, so reports don't use the flag until the issue on quoting the assertion lands.src/checks/service.ts: on a red verification, the check runs the failing files throughrerunAlone, writes one log line per file and puts the flaky ones on the detail. It skips the re-runs when the step was killed, the run was aborted, or the check runs as a cluster Job. The Job exclusion matches the existing single-test flake re-run.test/checks-rerun.test.tschecks the green/red split and its log lines, and that files past the budget are skipped. It also checks that the runner gets what is left of the budget, that a runner that throws counts as red, and that unsafe paths and the file-count limit are skipped. It fails without the split or without the budget.
Checks run: bun scripts/gate.ts and bun x tsc --noEmit are clean. scripts/fast.ts named 2517 files because runs.ts changed, so I ran the eight verification, flake and report test files myself instead: 109 pass, 0 fail. keep_plan and estimate were not available in this session, so I recorded no plan or estimate on the issue.
To try it: bun test test/checks-rerun.test.ts. On a real red verification, the run log lists one rerun: line per failing file, and the run's detail has flakyUnderLoad.
🤖 Generated with Claude Code
When a full-suite verification fails, the service now runs each failing file once more on its own. A file that passes alone is marked flaky under load instead of plain red.
src/checks/rerun.ts(new):rerunAlone(files, runner, { budgetMs, now })runs the files one at a time and returns, for each, whether it passed alone, failed alone, or was skipped, plus how long it took. All re-runs share one 5-minute budget, and each run is only given what is left of it. A pass that finishes over the budget counts as red. A file the budget doesn't reach, any file past the tenth, and any path that isn't a plain test path are skipped and stay plain red. The module also builds:- the log lines, e.g.
rerun: test/x.test.ts green alone in 3.1 s; - the quoted command,
bun test './file'; withFlaky, which only names files that were in the failing list.
- the log lines, e.g.
src/core/runs.ts: the run's check detail gets an optionalflakyUnderLoad?: string[].report.tsis unchanged, because the issue on quoting the assertion owns it. The report starts using the flag once both have landed.src/checks/service.ts: when a verification fails, the failing files go throughrerunAloneand each gets a line in the log. The files that passed alone go on the detail asflakyUnderLoad. The re-runs are skipped when the step was killed, the run was aborted, or the check ran as a cluster Job. The Job case is skipped for the same reason the existing single-test flake re-run skips it.test/checks-rerun.test.tsfails without the green/red split or without the budget. It also covers a runner that throws, unsafe paths, the file-count limit, andwithFlaky.
The first preview deploy failed on the gate, which runs first in the check. One comment line in rerun.ts was 103 columns, over the 100 limit; it is now wrapped. My first local gate run had printed nothing, and I took that as a pass. The branch also has an empty commit I pushed to redeploy before I found the real cause.
Checks: bun scripts/gate.ts exits 0 and bun x tsc --noEmit is clean. scripts/fast.ts named 2,517 files because runs.ts changed, so I ran the covering tests myself instead (new, verify, report and flake tests): 61 pass, 0 fail. The keep_plan and estimate tools were not available in this session, so I recorded no plan or estimate on the issue.
To try it: run bun test test/checks-rerun.test.ts. On a real failing verification, the run log shows one rerun: line per failing file, and the run's detail has flakyUnderLoad.
🤖 Generated with Claude Code
A red full-suite verification now runs each failing file once more on its own. A file that passes alone is recorded as flakyUnderLoad on the run's detail instead of as a plain red. A file that fails alone stays red. Each re-run writes a rerun: line to the verification's log.
Changes from review
- The service wiring is now tested. The re-run logic that sat inline in
src/checks/service.ts(the guard, the loop and the log lines) is now one function,rerunRed, insrc/checks/rerun.ts. The service calls it with its own step runner. The new testtest/check-verify-rerun.test.tsdrives a real red verification throughstartChecks:- With one file that passes alone and one that fails alone, the run detail's
flakyUnderLoadholds only the passing file, and bothrerun:lines are in the log. - A verification killed by SIGKILL writes no
rerun:lines and has noflakyUnderLoad. - With the service call replaced by an empty list, the first test fails on the
flakyUnderLoadassertion. - The cluster Job and cancelled-run cases are unit tests on
rerunRed: they re-run nothing and write nothing. Covering a Job end to end would need the stand-in kube client fromchecks-job-vanish, and the guard is the same code either way.
- With one file that passes alone and one that fails alone, the run detail's
- Over-budget passes have their own outcome,
"over". The log line isrerun: x passed alone in N s, past the budget: not counted. It is not counted as flaky, and a test checks the exact line. RERUN_BUDGET_MSis cut from 5 minutes to 60 s. I timed single files alone here: a unit file takes about 1 s, and files that boot the checks service take 2–6 s (check-flake2.1 s,check-verify3.1 s,check-tiers6.1 s). A minute covers the few files a flake under load leaves red, about 10 even at the slow end. A suite that needs more than that is broken, not loaded, and the most it can add to the gate is one minute.
Checks run: bun scripts/gate.ts and bun x tsc --noEmit pass. scripts/fast.ts named 2518 files, because service.ts reaches most of the suite, so I chose the covering tests myself: checks-rerun, check-verify-rerun, check-verify, check-flake, check-tiers and check-order-dependent. All 75 tests pass.
Not done: there is no UI or terminal surface for flakyUnderLoad; it lives on the run detail and in the log.
🤖 Generated with Claude Code
When a full-suite verification after landing fails, each failing file is re-run on its own. A file that passes alone is recorded under CheckDetail.flakyUnderLoad as flaky under load rather than red. Passes that run over the budget get their own outcome, and the budget is one minute.
This update merges main, which conflicted in src/core/runs.ts. Both sides had added fields to CheckDetail, and the merge keeps all of them:
- From
main(#12295): each failure now carriesassertionandexcerpt, plus the newshardsandconcurrencyfields. - From this branch (#12296):
flakyUnderLoadsits after them.
src/checks/service.ts merged on its own with no conflict.
One gate rule that came in with main forbids tests from waiting on a real timer. It flagged the polling loop in test/check-verify-rerun.test.ts:54. That loop waits on checks that run real bun test child processes, so a fake clock can't move them forward. The line is now marked // real-timer: with that reason, which the rule accepts.
bun scripts/gate.ts and bun x tsc --noEmit are clean. scripts/fast.ts picked 2537 test files (about 214 minutes, over its 5-minute budget) because runs.ts is imported nearly everywhere, so I ran a targeted set instead. It covers the check, verify and rerun suites (25 files): 236 pass, 0 fail. The forge's check runs the full suite.
🤖 Generated with Claude Code
After a full-suite verification fails, the service now runs each failing file once more on its own. A file that passes alone is marked
flakyUnderLoadon the run's detail; a file that fails alone stays a plain red.src/checks/rerun.ts(new):rerunAlone(files, runner, { budgetMs, now })runs the files one at a time and returns, for each, whether it was green alone, red alone, or skipped, plus how long it took. All re-runs share one 5-minute budget, and each run is only given what is left of it. A pass that finishes over the budget counts as red. A file the budget doesn't reach, any file past the tenth, and any path that isn't a plain test path are skipped and stay plain red. The module also builds the log lines (rerun: test/x.test.ts green alone in 3.1 s), the quotedbun test './file'command, andwithFlaky, which only names files that were actually in the failing list.src/core/runs.ts:CheckDetailgets an optionalflakyUnderLoad?: string[]. It is plain data;report.tsis untouched, as the issue asked, so reports don't use the flag until the issue on quoting the assertion lands.src/checks/service.ts: on a red verification, the check runs the failing files throughrerunAlone, writes one log line per file and puts the flaky ones on the detail. It skips the re-runs when the step was killed, the run was aborted, or the check runs as a cluster Job. The Job exclusion matches the existing single-test flake re-run.test/checks-rerun.test.tschecks the green/red split and its log lines, and that files past the budget are skipped. It also checks that the runner gets what is left of the budget, that a runner that throws counts as red, and that unsafe paths and the file-count limit are skipped. It fails without the split or without the budget.Checks run:
bun scripts/gate.tsandbun x tsc --noEmitare clean.scripts/fast.tsnamed 2517 files becauseruns.tschanged, so I ran the eight verification, flake and report test files myself instead: 109 pass, 0 fail.keep_planandestimatewere not available in this session, so I recorded no plan or estimate on the issue.To try it:
bun test test/checks-rerun.test.ts. On a real red verification, the run log lists onererun:line per failing file, and the run's detail hasflakyUnderLoad.🤖 Generated with Claude Code
Closes #12296