Repository navigation
Fix Pi child-exit and workflow wake test flakes - #8084
Merged
Merged
Conversation
…a frozen clock The Pi harness took a child's exit from a line the fake wrote in its SIGTERM/EOF handler. On Windows kill() force-terminates the tree with taskkill /F, which can land before the handler runs, so a dead child looked alive. readProcessLog().exited now comes from the tracked ChildProcess exit, and the catalog refresh test checks the tracker the same way. The workflow wake test gave the queued run 20 ms of real time to finish while each check advanced the fake clock 1 ms. The checks now leave the fake clock where it is, so a polling tick still never fires, and wait up to 5 s of real time. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/fix-plugin-test-flakes-thr_nqp9hafw5g
branch
from
November 24, 2026 05:12
0c1e18e to
2bc12bc
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.
Human comments
What was wrong
Three CI flakes from the last week, each caused by its test rather than the product. The third one is already fixed on main by #8068, which landed the same settle change while this PR was open, so this PR now carries the first two.
Pi bridge:
a child whose extension never reports ready is a construction error, not a hung tool call(Windows plugins-1, main 4d2fccc, run 44840631240). The harness decided a fake Pi child had exited only when the fake wrote anexit:line from its SIGTERM or stdin-EOF handler. On Windows,kill()closes stdin and then runstaskkill /T /Fstraight away. If the forced kill lands before the child handles EOF, the child dies without writing the line, so the test waits 10 s and fails withexpected false to be true(12 040 ms in the failing log; passing runs take 1.9–3.1 s). The same self-reported exit backs the transient-login, catalog-eviction and catalog-close assertions inbridge.round2/bridge.lifecycle, and the refresh test incatalog.test.ts. All of them go throughkill().Workflows:
wakes queued runs when settings frees capacity(ubuntu plugins-2, e1f97e4; attempt 2 passed on the same SHA). The test used fake timers and gave the queued runvi.waitFor({ timeout: 20, interval: 1 })to reachsucceeded. That is 20 ms of real time for an in-process QuickJS + SQLite run. Each check also advanced the fake clock by 1 ms, so the tight timeout was what kept the fake clock short of a polling tick. I measured the real time from freeing capacity tosucceeded: p50 2–3 ms, but 5–16% of iterations take over 20 ms, up to 318 ms.Render invariants:
typing an Ask User Question answer renders nothing outside the question form(11-17 018f74a,expected [ …(41) ] to deeply equal []; the next push on that branch passed).settle()only waited for 1 s with no React commits. It did not check whether the page still had requests in flight. On a freshly seeded server under load, the requests the page sends at load (/system/providers,/system/execution-options,/system/providers?environmentId=…,/hosts/…/provider-clis/status) were still pending 6.5–7.5 s after load, whenreset()ran. They finished about 1 s into the typing window, and their commits re-rendered the hidden follow-up composer (Send options, Prompt actions), a timeline row's menu and sidebar footer items. That only happens on the first page against a fresh server, which is why only the first test intyping.test.tsfailed.What changed
plugins/provider-pi/src/bridge/test-support.ts:readProcessLog().exitednow lists the tracked fake-PiChildProcesses that have exited, fromexperimental_trackChildProcesses. It no longer reads the fake's self-writtenexit:lines, so it is right however the child died.spawnedstill comes from the log. This fixes every caller at once.plugins/provider-pi/src/bridge/catalog.test.ts: the refresh-replacement test checks that only the second child is still running, instead of looking for anexit:line from the first.plugins/workflows/src/service-policy.test.ts: both waits in the wake test use{ timeout: 5_000, interval: 0 }. With interval 0 each check advances the fake clock by 0 ms, so no polling tick can fire and the run can only finish because of the wake. The real-time limit is only there to bound a failure.tests/render-invariants/src/render-session.ts: no change here any more. Graduate six early adopter experiments #8068 madesettle()wait for pending requests as well as React quiet, which is the fix for the root cause above, so I dropped my version of it when rebasing.Not changed: the 11-18 render-invariants failure (run 44414918194:
push.testandtyping.testboth timed out inwaitForSelector('[data-timeline-row-id]')before any settle, with the first row never visible within 30 s). It happened once, in two files at the same moment, the next push on that branch passed, and it has not come back in about 130 Render invariants jobs since 11-19. I did not see it in about 15 local parallel runs, so I am leaving it alone.How you verified
FAKE_PI_HANG_ON_CLOSE=1), so it is killed without running its handler, the same as a Windows forced kill. The old harness then fails the test with the CI assertion (expected false to be true, 14 s), and the new harness passes. The touched files (bridge.round2,catalog,bridge.lifecycle, 31 tests) passed 10 of 10 loops under 16 CPU burners.turbo run test --filter=bb-plugin-provider-pipasses: 371 passed, 5 skipped.wakeWorker()removed fromupdateSettings, the fixed test fails withexpected 'queued' to be 'succeeded', so it still catches a wake that is missing. I measured real and fake time tosucceededover 100 repeats per variant, idle and under 48 burners. Fake time consumed is ≤2 ms with the old interval and 0 ms with the new one. The fixed test passed 600 of 600 repeats (100 × 3 variants × 2 runs) under 48 burners.turbo run typecheck lintpasses forbb-plugin-provider-piandbb-plugin-workflowsafter the rebase onto 22a9366 (Pi 371 passed, workflows 284 passed), and oxfmt is clean.🤖 Generated with Claude Code