Repository navigation
test(wsl): break the WSL host restart into phases in the lane receipt - #35005
Conversation
|
No actionable comments were generated in the recent review.
|
The real-distro lane now times each restart's ensure by phase (first exec and boot, holder, pre-launch checks, launch, orcad startup, post-readiness, bridge, pairing) from wrapper marks and guest-command start times. orcad logs its own startup phases to its slot log only when the lane's launch env sets ORCA_E2E_ORCAD_STARTUP_TIMING; the lane reads that line into the receipt.
cc977a1 to
a7e4bdd
Compare
|
STATUS: measurement in. Head a7e4bdd. WSL2 lane run 40676281327 passed on all 3 families. Medians of 3 restarts, ubuntu / debian / fedora:
Checks run: pnpm tc, typecheck:ci, touched tests, code-quality:changed, anti-slop, ast-grep. Open question: whether orcad's load time is mostly disk reads or compile time. The next step is to measure Node's compile cache in the lane. |
ELI5
After a WSL distro is restarted, the WSL host takes 4–6 s before a terminal can print anything. The old path takes under 1 s. This PR splits that wait into named pieces in the real-WSL test's receipt, so we know which part to speed up. Users see no change.
Builds on #34864, which is merged.
What Changed
Lane receipt phases (test-only). For each measured restart, the real-distro idle-release lane wraps the host connect's holder, deploy, bridge listen and pairing-identity calls. It also logs the start time of every guest command. A new pure helper,
wsl-orcad-ensure-phase-trace.ts, turns these into:gateMsfirstExecAndBootMs(the firstuname -r, which boots the distro)holderMspreLaunchChecksMsandpreLaunchCommandslaunchMsorcadStartupMs(on-host readiness wait)postReadinessMsandpostReadinessCommandsbridgeMs,pairingMsandunattributedMsPer-run values and per-phase medians go to
distroRestartToFirstOutput.host[i].phasesandmedianHostPhases.orcad startup timing (inert in production).
orcad-startup-timing.tstimes a few existing startup awaits inorcad-entry.ts: CLI launcher, secret store, profile, login-env wait, daemon, orchestration, terminal reconcile and RPC start. orcad writes one[orcad] startup timing {...}line to its slot log at readiness, and only whenORCA_E2E_ORCAD_STARTUP_TIMING=1. Only the lane sets that, through its own transport'sorcadLaunchEnv. The lane copies the line into the receipt asorcadStartup.Why
From #34864's receipts,
ensurecosts 3.3–4.8 s. About 57% of that is one on-host readiness wait while orcad starts. The rest is the distro boot, the holder, and about 39 serial guest commands. A command log alone can't see inside orcad's startup, and it can't separate the holder from the boot. Wrapping injected dependencies keeps production connect code untouched;wsl-orcad-deploy.tsandwsl-orcad-connection.tsare already at the line cap. Inside orcad, wrapping existing awaits inline adds no new control flow.Flag-off: no change. The phase trace exists only in the lane test. The orcad timing is a no-op unless
ORCA_E2E_ORCAD_STARTUP_TIMING=1is in orcad's launch env, and nothing in the product sets it.User-risk: none expected. With the variable unset,
timed()just returns the awaited call. The timing line goes to stderr (the slot log), never to the readiness stdout. SSH launches never set the variable.Linked Issue
Internal WSL-via-orcad tracker, D3 bar (restart → first usable prompt).
Visual Proof
N/A: measurement only, no UI.
Testing
wsl-orcad-ensure-phase-trace.test.ts(launch, repeated readiness waits, already serving, missing marks, failed spans, medians) andorcad-startup-timing.test.ts(silent when unset, one line when set, failed phases recorded).orcad-forked-child-pathsfails on macOS from the/private/tmprealpath, which this PR doesn't touch.Status
Pushed. Waiting for the WSL2 lane receipts. The phase breakdown will be posted as a STATUS comment.
Checklist
N/Afor visuals with reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (pnpm tc,typecheck:ci, touched tests, code-quality, anti-slop and ast-grep pass locally; CI runs the rest)