Repository navigation
Fix Windows package test and smoke flakes from slow runners and test races - #8079
Merged
ymichael merged 2 commits intoNov 24, 2026
Merged
Conversation
…races - workload-priority: lower the child only after it reports ready, so its Node bootstrap runs at normal priority; tear down with stop(). - runtime.process-lifecycle: await the stalled bridge's stderr signal instead of polling a marker file with a 1 s budget. - local-open-targets: walk the JetBrains Toolbox tree once per runtime instead of once per JetBrains product. - tool-call-parsing-performance: bound the early-exit ratio at 3x, between the healthy 6.5-12x and the regressed ~1x. - server-moved: flush the manual scheduler inside waitFor so a recheck scheduled by the in-flight initial read runs. - smoke-tarball: wait for 'close' before reading a failed command's output. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e-test-and-smoke-flakes-thr_78y5udaykn # Conflicts: # packages/process-utils/test/workload-priority.test.ts
ymichael
deleted the
bb/fix-windows-package-test-and-smoke-flakes-thr_78y5udaykn
branch
November 24, 2026 05:02
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
Each of these tests failed on CI in the past week, then passed on a rerun of the same SHA, or failed on
mainwith no relevant change. I checked every failing job log and traced the cause. Most are the same class as #7745: real work charged against a fixed deadline on a loaded Windows runner. In each case the expensive step was not what the test is about.process-utilsworkload-priority.test.ts› lowers a running process so the processes it starts later inherit the priority (Windows, 5 s)main(job); passing runs 2.8–4.9 sspawn, so its whole Node bootstrap ran at below-normal priority. It then needed a second lowered wake-up ("done") to kill the grandchild and exit. On a saturated Windows runner a below-normal thread can wait about 4 s for the anti-starvation boost, once for each burst.agent-runtimeruntime.process-lifecycle.test.ts› does not wait for stalled replacement initialization during full shutdown (Windows)Timed out after 1000ms waiting for the replacement bridge to begin initialization, twice (job)local-open-targetsworkspace-open-targets.test.ts› discovers and opens JetBrains Toolbox applications through bundled executables (Windows, 5 s)thread-viewtool-call-parsing-performance.test.ts› bounds intent parsing work after a script's disqualifying write (Windows)expected 4.80 to be less than 4.77onmain(job), plus 2 more/ 8bound sits on the healthy ratio. Both commands pay the same O(n) cost to build, hash and cache the command string, so a correct early exit is only 6.5–8× cheaper on Windows (10–12× on an M-series Mac). The regression the test guards, scanning on after the write, gives a ratio of about 1.desktopserver-moved.test.ts› closes the watcher and polls after a watch error (Linux)expected "vi.fn()" to be called once(job)flush()starts the initial lock read. If that read is still in flight when the secondflush()fires the poll, the poll only marks a recheck. The in-flight read then sees no lock and schedules a debounced check on the manual scheduler, which the test never flushed again.main:bb plugin list failed with 1/bb-app SDK status failed with 1, with no output (run, run)waitForProcessExitresolved on'exit', which Node fires before the child's stdio is drained. The SDK step is anode -escript, and one that exits 1 always writes a stack trace to stderr, yet both failure messages were empty. Why the commands exited 1 is still unknown. This change makes the next occurrence show it.Looked at and left alone:
tool-call-parsing-performance› scans long quoted thread messages in chunks: all 4 failures were on SHAs without Stabilize desktop, Git, and parser CI tests #7680, which moved these benchmarks to thread CPU time. No failure since.plugin-sdkvendor-plugin-roots.test.ts(Windows, 5 s, 3 failures): a victim of runner saturation, not of its own work. The resolver does 14–39 fs ops per test, none redundant. In the failing jobs every test in the file slowed from 5–100 ms to 2–6 s during one window, whileshared-declaration-emit(9–16 s),runtime-entries(5–16 s) andapi-index(5.7 s) were running too. In the last 19mainruns it reached 50% of its limit once. A larger timeout would only move the deadline. The real fix is Windows-shard oversubscription (unboundedVITEST_MAX_WORKERS× turbo concurrency on 8 vCPUs), which belongs in its own change.scriptsci-performance.test.mjs› ENOTEMPTY removing the fixture's.git(Linux, once): I found no concurrent writer. Eachgit commitdoes leave a detachedgit maintenance run --autobehind. An strace (git 2.56) shows it only unlinksobjects/maintenance.lock, and it creates nothing in.gitaftercommitreturns. 750 Linux iterations of the exact fixture sequence, under CPU contention, produced no failure. A retry would only hide whatever caused it.What changed
packages/process-utils/test/workload-priority.test.ts: the child printsreadyafter booting at normal priority, and only then is it lowered. The lowered work is now one wake-up and onespawn, the minimum the claim needs. The test reads the grandchild's priority, andstop()tears down the tree at normal priority (taskkill /T, or the process group). The child no longer has to be scheduled again to exit. The test gets a 15 s budget. That one wake-up can still wait about 4 s for Windows' anti-starvation boost on a saturated runner, and the inherent worst case of about 4 s + about 1 s bootstrap + taskkill is above 5 s.packages/agent-runtime/src/runtime.process-lifecycle.test.ts: the stalled bridge writes a line to stderr when it receivesinitialize, and the test awaits it through the manager'sonStderr. There is no polling budget. The real assertion is unchanged: shutdown completes within 1 s instead of waiting for the bridge's 3 s stall.packages/local-open-targets/src/index.ts: the Toolboxappstree is walked once per runtime, and each JetBrains adapter matches its prefixes against the collected bundles. Traversal order, depth limit and the executable check are unchanged, so results are the same. The daemon builds a new runtime for every request (apps/host-daemon/src/local-api.ts), so the walk is never stale across requests. In this test: 54 readdirs down to 12, 6 for the listing and 6 for the open.packages/thread-view/test/tool-call-parsing-performance.test.ts: the bound isreadOnly / 3. It sits between the healthy ratio (6.5–12×) and the regressed ratio (about 1×), with more than 2× margin on each side.apps/desktop/test/server-moved.test.ts: thewaitForflushes the manual scheduler on each attempt, so a recheck that the in-flight initial read schedules also runs.packages/bb-app/scripts/smoke-tarball.mjs:runCommandand the bridgemodel/liststep wait for'close'(newwaitForProcessOutput), after the process has exited and its stdio has closed, so a failing command's stdout and stderr reach the error. The forked plugin-host worker keepswaitForProcessExit('exit'). Node never emits'close'once the parent disconnects the IPC channel, which I checked with a minimal fork/disconnect script, and the first local smoke run with'close'everywhere hung at that step.No wire, CLI or doc changes.
How you verified
All local numbers are from an M-series Mac. Other agents' suites were running on the same machine, with load averages of 100–700.
origin/main)workload-priority, with the lowered child also put in macOS background QoS (taskpolicy -b -p) and 32 CPU burners, to model Windows' strict below-normal schedulingstop()about 105 ms (16 timed runs). macOS background QoS can starve a process indefinitely, which Windows does not: in a 50-run batch under this model a few runs still waited 30 s or more for that one burst.workload-priority, unmodified, 30 repeatsstop()polls the process group at normal priority. No leaked grandchildren afterwards.runtime.process-lifecyclestalled-replacement test, with a preload that delays every child Node start by 1 s to model Windows spawn costTimed out after 1000ms waiting for the replacement bridge to begin initializationfs/promisesexpected 57.0 to be less than 18.5, still caught.server-movedwatch-error test, with the first lock read delayed by 200 msexpected "vi.fn()" to be called once with argumentsschedulePoll()removed from the watch-error fallback it still fails.waitForProcessExit'exit'-before-stdio ordering shows up on Windows IOCP).turbo run smoke:tarball --filter=bb-app: every step passes, including full stack, daemon join and plugin host workerpnpm exec turbo run lint typecheck --filter=@bb/process-utils --filter=@bb/thread-view --filter=@bb/agent-runtime --filter=@bb/local-open-targets --filter=@bb/desktop --filter=bb-apppasses.pnpm exec turbo run testfor the same packages passes exceptprocess-utilsprocess-tree.test.ts› finds and kills processes whose cwd is inside a directory. That file is untouched and also fails alone on this machine, which had about 1,020 processes running at the time.🤖 Generated with Claude Code