Repository navigation
test(ui-sdk): walk the inherited tree once for the /var socket proof - #2748
Merged
Merged
Conversation
The /var socket test walked the whole visible filesystem in each of three worker profiles, at one directory read at a time. On a hosted runner that is three walks of the runner image, and it sat at about two thirds of its 180 s deadline; runner variance pushed it over (#2674). The fixture now walks its own view once, wherever at least one profile inherits it, with up to 32 directory reads in flight. Each worker compares its /proc/self/mountinfo with the fixture's, reads only the subtrees below mount points whose stack differs, and lstats the baseline's sockets everywhere else. A worker refuses a baseline that skipped a path it inherits. A new control socket, in a directory no worker mount touches, proves the baseline branch in every profile. Closes #2674 Co-Authored-By: Claude Opus 5.5 <[email protected]>
schlessera
marked this pull request as ready for review
October 23, 2026 23:30
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 #2674
What changed
The
/varsocket test ("all worker profiles hide every /var socket while explicit runtime files still execute") no longer walks the whole visible filesystem once per worker profile. The fixture walks its own view once, and only where at least one profile inherits that view unchanged. The walk keeps up to 32 directory reads in flight. Each worker diffs its/proc/self/mountinfoagainst the fixture's, mount point by mount point, comparing device, root, type and source bottom to top. It reads only the subtrees below mount points whose stack differs. Everywhere else itlstats the sockets the baseline found. A worker exits non-zero (WALK_BASELINE_SKIPPED_INHERITED_PATHS) if the baseline skipped any path the worker inherits. A new control socket,/opt/odysseus-var-fixture/inherited/walk-control.sock, sits in a directory no worker mount touches. Every profile must report it (SOCKET_WALK_SEES_INHERITED_CONTROL), which proves the baseline branch. The receipt now records walk sizes and times for each profile and for the baseline. The deadline, the profiles, the/root and the/proc//sysexclusions are unchanged.Cause
#2724's layout did not grow the walk. Workers mask
/home, so the sibling.brain-unit-workers-*copies are invisible. Only the worker's ownnode_modulesandpackagesare bound back, about 70k entries locally, as before. After #2724 the hosted logs show one dependency copy per worker (node_modules). Before it they show two (node_modulesandpackages/ui-kit/node_modules).The test's neighbours did not change either. In both the failing run (
5e6446ae, run 40034416635) and the passing rerun (d7f206d8attempt 2, 118.5 s), the other worker was running the Chromemounted parallel sessionssuite for the whole window. Both runs used the same runner image (20261012.334.1).The walk itself was the problem. Each profile walked the entire runner image, one directory at a time, and three profiles did so at once. Locally that is about 645k entries per profile and about 12.8 s of CPU per test. The walk spends about half its wall time blocked, not computing. Normal hosted runs took 100–118 s, about 65% of the 180 s deadline, so ordinary runner CPU and disk variance crossed it.
Why this shape
The issue ranked the fixes: (1) scan less, (2) bounded and fast, (3) fix the layout. Since the layout was not the cause, this PR does (1) and (2):
Proof
Base
5e6446ae9(origin/main), head2df07a3bc. Draft gates only. Timings are on a shared 32-core WSL2 host.Failing first, with the test's whole cgroup capped at 7% of a CPU (
systemd-run --user --scope -p CPUQuota=7% bun run test packages/ui-sdk/tests/worker-var-sockets.test.ts):(fail) … [180025.78ms] ^ this test timed out after 180000ms.Other timings:
Mutations. Each was applied, run with
bun run test packages/ui-sdk/tests/worker-var-sockets.test.ts, and restored:"/var"removed fromHOST_MASKS, so/varis inherited and goes through the baselinelstatbranch. Failsgoverned: SOCKET_WALK_ONLY_APPROVED_RELAY_AND_PROXYwith+ /var/lib/odysseus-runtime/host.sock,/var/snap/odysseus/host.sock,/var/spool/odysseus/host.sock,/var/tmp/odysseus/host.sock(baseline found 5 sockets; each worker checked 5)./vartmpfs replaced with a self-bind, so/varis a changed mount and goes through the walked branch. Same failure, the same four/varsockets.governed: SOCKET_WALK_SEES_INHERITED_CONTROL(received only the two/run/brain-egresssockets).WALK_BASELINE_SKIPPED_INHERITED_PATHS /boot /etc … /usr /snap /opt.governed: SOCKET_WALK_SEES_INHERITED_CONTROL(received[]).lstatfallback. Still passes, as intended (test(ui-sdk): walk worker filesystems by dirent type and in parallel #2675's receipt).The first
bun run test packages/ui-sdkattempt had one unrelated failure,ROLLBACK_WRITER_READY_TIMEOUTinmaintenance-index-input.test.ts, which is already tracked as #2747. That file then passed 3/3 on its own, and the full rerun above was clean. The host's load average was 12–24 at the time, from other workers.No worker, launcher or sandbox source changed, only the test and its fixture, so the native hosted-app proof was not run.
Checklist
docs/reflect the change, or nothing documented moved.docs/decisions/provider-history.md): the provider-history guard passes, or nothing on a turn's path changed.Anything left open
readdirreports a socket that is bind-mounted onto a file path as a regular file. This predates this PR (test(ui-sdk): walk worker filesystems by dirent type and in parallel #2675) and no current assertion depends on it.VAR_SOCKET_RECEIPTline of the next unit run that selects this test.🤖 Generated with Claude Code