Repository navigation
fix(ci): name the starved phase in a native discovery timeout receipt (#4149) - #4160
Merged
Merged
Conversation
…#4149) The #4149 confirmation timed out in native Vitest file discovery on a runner whose checkout and install also ran about five times slower than usual. The same two-parent candidate tree discovers in about 5 seconds in the pinned image with two CPUs, so discovery did not regress. The receipt could not show that: it recorded only wall time and the stderr tail. A failure receipt now records the discovery leader's user and system CPU time and involuntary context switches, with the runner's parallelism and load average. CPU near the deadline means slow discovery; CPU far below it means the runner withheld CPU or I/O. Reading the usage cannot replace the discovery failure. The 30-second cap, project selection, file channel, process-group ownership and pipe drains are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Collisions at head |
schlessera
marked this pull request as ready for review
November 17, 2026 09:30
This was referenced Nov 17, 2026
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.
Closes #4149
What changed
Native discovery did not get slower. On the failed confirmation run the whole runner was starved, and the cap caught it. A discovery failure receipt now shows which case a timeout was. Next to wall time it records the discovery leader's user and system CPU time and its involuntary context switches (
cpu), plus the runner's parallelism and load average (host). CPU time near the deadline means discovery itself was slow. CPU time far below it means the runner withheld CPU or I/O. The 30-second cap, project selection, JSON file channel, process-group ownership and both pipe drains are unchanged. The decision record (docs/decisions/ci-utility.md) records the finding beside the #2380 ruling and has its updated citation.Why this shape
The established cause is the runner, so there is no product or discovery regression to fix. The #2380 ruling already says the 30-second margin "does not guarantee completion under arbitrary CPU starvation". The issue rules out raising the cap or narrowing the inventory. What was missing was a receipt that could tell the two cases apart without guessing from stderr text, so this PR adds that. Discovery bundles and executes
vitest.config.ts16 times, once per inlineextends: trueproject. That is real, measurable overhead, but it is not the cause, and removing it would restructure every browser project. Filed as #4159 (p3, no milestone).Established cause (AC 1)
Step durations of the
changesetjob, from the Actions API:Across the 29 non-draft
ci.ymlruns before 09:15 UTC today, the discovery step took 7–14 s. The only exception is the failed run.I reproduced the actual failed candidate locally. I merged head
f62a5f6a6f93aeb664edde38961bda96d3816b72into based974052166f335cbf57b385fddc13875da1b98de(parents base then head), which gives tree3c00feb182fbad2dc87fb2c8b32dcbd18772a0f8, the hosted tree. I installed with--backend=copyfileand ran the samenode ../../node_modules/vitest/vitest.mjs list --filesOnly --json=…frompackages/ui-kitwithCI=true STORYBOOK_DISABLE_TELEMETRY=1, inside the pinnedmcr.microsoft.com/playwright@sha256:eff16c30…image (node v24.20.0) with--network=none --memory=4g:--cpusA complete discovery writes about 70.6 KB of stderr. The hosted child had written 38,826 bytes when it was killed at 30 s, about 55% of the run. That means it ran with less effective CPU than the 0.3-CPU throttle. This is consistent with checkout and install running about 5× slower on the same runner. The Vite native-config/CommonJS warnings appear in every successful run too, so they are not the cause.
A CPU profile of one discovery on two CPUs (5.0 s) breaks down as: Storybook plugin ~0.8 s, rolldown config bundling ~0.66 s, executing the bundled config ~0.62 s, GC ~0.5 s.
Proof
Failing first. I added
native watchdog receipt separates a {waiting,computing} child's CPU time from wall timetotests/browser-inventory-process.test.tsbefore the implementation. Both cases failed onexpect(receipt.cpu).toEqual({ userMs, systemMs, involuntarySwitches })withreceipt.cpuundefined.The first implementation attempt also exposed a runtime trap. Bun 1.4 returns
resourceUsage().cpuTimeas BigInt even though its types saynumber. The throw ("Invalid mix of BigInt and other type in division") replaced the real discovery error in eight existing tests. The read is now converted withNumber()and wrapped, so it can never replace the failure it explains.Mutations, each restored afterwards:
userMs: performance.now() - started): the waiting case fails,Expected: < 501.5, Received: 1008.userMs: 0 * …): the computing case fails,Expected: > 251, Received: 11.After the change:
bun run test tests/browser-inventory-process.test.tspasses 12/12.bun run test tests/cold-browser-discovery.test.tspasses (realbrowserInventoryon a cold, build-free copy, default 30 s cap, 8.1 s).bun scripts/proof-system.ts classify --base origin/main --head HEADreports "not a proof-system change", so the #4145 lane and its off-main qualification do not apply.{"version":1,"kind":"brain-check-pr-receipt","head":"c2315e236dae40f337a3bcfd59ce7bb1b1bb13f8","base":"origin/main","mode":"focused","startedAt":"2026-11-17T09:19:41.115Z","finishedAt":"2026-11-17T09:21:09.066Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12852.021165},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":118.43906200000129},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":129.16476100000182},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":19.736795999997412},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":74816.672256}]}Collisions: see the comment below, from
bun scripts/collisions.ts --json --pr <this PR>.Checklist
ui-react,ui-kit,ui-server,coreunderpackages/.scripts/,tests/anddocs/only, nothing a consumer can see.docs/decisions/ci-utility.mdupdated.Anything left open
changesetmetadata job on a standardubuntu-24.04runner, and that step is skipped for drafts. Heavy feedback does not run it. So the hosted half of AC 2 and AC 5 (complete discovery within 30 s and all selected categories passing, with checkout, parent and tree evidence) arrives with this PR's ordinary exact-candidate confirmation. The original failure is preserved above (run 44035623508, attempt 1).🤖 Generated with Claude Code