Skip to content

test(wsl): record the restart phase baseline for staged readiness - #35530

Merged
nwparker merged 1 commit into
mainfrom
nwparker/wsl-lane-startup-phase-baseline
Oct 29, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/wsl-lane-startup-phase-baseline

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​88 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​77
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​79 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​79

ELI5

We are about to make the WSL host say "ready" earlier. To know whether that works, the speed test has to show where the restart time goes, both inside the host process and after it is ready. This adds that breakdown to the test's receipt.

What Changed

This PR is stacked on #35526 (one held socket). Review only the second commit.

  • Before: the lane receipt had restart to first output, the host's ensure phases, and one raw orcad startup line per run, with no medians.
  • After:
    • Each restart also records sendToFirstOutputMs, the time from typing the probe to seeing it.
    • Each distro also reports these medians:
      • medianHostTerminalCreatedMs
      • medianHostSendToFirstOutputMs
      • medianOrcadStartup, made of:
        • bootMs: process start to the first timed phase, which is Node boot plus the module graph loaded eagerly
        • each phase's end and duration
        • readyMs
  • A small reader, src/main/orcad/orcad-startup-timing-summary.ts, now parses orcad's startup timing line. It replaces the lane's untyped JSON.parse of that line, and it has unit tests. It lives outside orcad's own bundle, so orcad's start-up does not change.

Why

Staged readiness moves the moment orcad publishes readiness to before daemon, orchestration and terminal reconcile are finished. The baseline must show how much of the restart those phases cover, and how much falls before them (boot) and after readiness (terminal create, shell output). Without that split, any lane number after the change could not say where the time went. Median phase ends make the readiness move readable directly from one receipt.

Flag-off: no product change; test and lane receipt only.
User-risk: none; the new module is imported only by the lane test and its unit test.

Linked Issue

N/A (internal performance work).

Visual Proof

N/A: test-only change with no UI.

Testing

  • pnpm test src/main/orcad/orcad-startup-timing-summary.test.ts passes (5 tests). orcad-startup-timing.test.ts still passes.

  • pnpm tc, pnpm run typecheck:ci, the changed-code quality gate, anti-slop oxlint and oxlint all pass.

  • The lane itself runs on the CI WSL2 lane.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Test-only; no security, SSH, mobile or compatibility impact.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no blocking issues were found.

Summary

Adds a restart timing breakdown to the WSL lane receipt.

  • WSL restart receipts now show where startup time goes.

No actionable issues were found. The previous-review ancestry checks did not pass, so the review covered all supplied PR changes.

Reviews (2) · Last reviewed commit: "test(wsl): record the restart phase base..." · Reviewed by Greptile

@nwparker
nwparker changed the base branch from nwparker/wsl-lane-held-socket to main October 29, 2026 01:15
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0d2e9269-4960-4662-a977-def838f1f37a
Commits

Reviewing files that changed from the base of the PR and between 3b7f46e and 74a1ff9.

Files selected for processing: 3
  • src/main/orcad/orcad-startup-timing-summary.test.ts
  • src/main/orcad/orcad-startup-timing-summary.ts
  • src/main/wsl/wsl-orcad-real-distro-idle-release-lane.test.ts
Walkthrough

The change adds parsing and median aggregation for ORCAD startup-timing reports. The WSL idle-release lane uses one shared control connection for host restart requests, measures terminal creation and send-to-first-output times, and includes median timing results in the baseline receipt.

Priority: Low

Merge Risk: Low · previous review 3b7f4

Retained installation slots can make the new startup baseline inaccurate. Correct the report selection before relying on that baseline.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly describes the main change: adding a restart phase baseline for staged readiness in the WSL test lane.
Description check Passed The description covers the required explanation, changes, rationale, testing, visual proof, scope, and checklist. It identifies the work as internal performance work and reports the relevant automated…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description covers the required explanation, changes, rationale, testing, visual proof, scope, and checklist. It identifies the work as internal performance work and reports the relevant automated checks and CI coverage.

Full details: Docstring Coverage

Explanation

Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 7 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
⚔️ Resolve merge conflicts: 💡
  • Resolve merge conflict in branch nwparker/wsl-lane-startup-phase-baseline
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b5569052-780e-4695-abb5-2e18bdd6e918
Commits

Reviewing files that changed from the base of the PR and between 8b9d277 and 3b7f46e.

Files selected for processing: 3
  • src/main/orcad/orcad-startup-timing-summary.test.ts
  • src/main/orcad/orcad-startup-timing-summary.ts
  • src/main/wsl/wsl-orcad-real-distro-idle-release-lane.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Comment on lines +365 to +378
async function readOrcadStartupTiming() {
const line = await guest(
`grep -hF ${quotePosixShell(ORCAD_STARTUP_TIMING_PREFIX)} "$HOME"/.orca-remote/orcad-*/${ORCAD_LOG_FILENAME} 2>/dev/null | tail -n 1`
)
try {
return JSON.parse(
line.slice(line.indexOf(ORCAD_STARTUP_TIMING_PREFIX) + ORCAD_STARTUP_TIMING_PREFIX.length)
)
} catch {
return null
}
return parseOrcadStartupTimingLine(line)
}

/** (a) WSL host: holder boots the distro, orcad deploys and starts, a terminal spawns and prints. */
async function restartThroughHost(
repoPath: string
): Promise<Receipt & { phases: WslOrcadEnsurePhases | null }> {
async function restartThroughHost(repoPath: string): Promise<
Receipt & {
phases: WslOrcadEnsurePhases | null
orcadStartup: OrcadStartupTimingReport | null
}
> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Supported by static analysis

Script executed:

git diff 43cf7b4b24ff5117adc067b76eab9430b4552867 3b7f46e52589bf31cfddf956ec909d0db9fc6c17 -- src/main/wsl/wsl-orcad-real-distro-idle-release-lane.test.ts
sed -n '340,440p' src/main/wsl/wsl-orcad-real-distro-idle-release-lane.test.ts
rg -n 'startup.timing|startup timing|readOrcadStartupTiming' src/main/orcad src/main/wsl

Repository: stablyai/orca

Length of output: 12990


Script executed:

set -o pipefail
printf '%s\n' '--- startup timing producer ---'
sed -n '1,240p' src/main/orcad/orcad-startup-timing.ts
printf '%s\n' '--- orcad entry and logging references ---'
rg -n -F --glob '*.ts' -e 'ORCAD_LOG_FILENAME' -e 'startup timing' -e 'createWriteStream' -e 'appendFile' -e 'writeFile' -e 'logFile' -e 'logPath' src/main/orcad src/main/wsl src/shared
printf '%s\n' '--- relevant launch/deploy/log lifecycle references ---'
rg -n -F --glob '*.ts' -e '.orca-remote' -e 'orcad.log' -e 'ORCAD_LOG' -e 'terminatePlain' -e 'manager.ensure' src/main/orcad src/main/wsl src/shared
printf '%s\n' '--- changed startup summary implementation ---'
sed -n '1,260p' src/main/orcad/orcad-startup-timing-summary.ts
printf '%s\n' '--- orcad entry context ---'
sed -n '1,180p' src/main/orcad/orcad-entry.ts

Repository: stablyai/orca

Length of output: 42216


Script executed:

set -o pipefail
printf '%s\n' '--- producer ---'
sed -n '1,240p' src/main/orcad/orcad-startup-timing.ts
printf '%s\n' '--- all relevant identifiers ---'
rg -n -F --glob '*.ts' -e 'ORCAD_LOG_FILENAME' -e 'ORCAD_STARTUP_TIMING_PREFIX' -e 'startup timing' -e '.orca-remote' -e 'orcad.log' -e 'ORCAD_LOG' -e 'terminatePlain' -e 'manager.ensure' src/main/orcad src/main/wsl src/shared
printf '%s\n' '--- summary ---'
sed -n '1,260p' src/main/orcad/orcad-startup-timing-summary.ts
printf '%s\n' '--- entry ---'
sed -n '1,180p' src/main/orcad/orcad-entry.ts

Repository: stablyai/orca

Length of output: 26126


Script executed:

sed -n '1,240p' src/main/orcad/orcad-startup-timing.ts; printf '\n--- refs ---\n'; rg -n -F --glob '*.ts' -e 'ORCAD_LOG_FILENAME' -e 'ORCAD_STARTUP_TIMING_PREFIX' -e '.orca-remote' -e 'orcad.log' -e 'ORCAD_LOG' -e 'terminatePlain' -e 'manager.ensure' src/main/orcad src/main/wsl src/shared; printf '\n--- summary ---\n'; sed -n '1,260p' src/main/orcad/orcad-startup-timing-summary.ts; printf '\n--- entry ---\n'; sed -n '1,180p' src/main/orcad/orcad-entry.ts

Repository: stablyai/orca

Length of output: 25952


Script executed:

sed -n '1,240p' src/main/orcad/orcad-startup-timing.ts
rg -n -F --glob '*.ts' -e 'ORCAD_LOG_FILENAME' -e 'ORCAD_STARTUP_TIMING_PREFIX' -e '.orca-remote' -e 'orcad.log' -e 'ORCAD_LOG' -e 'terminatePlain' -e 'manager.ensure' src/main/orcad src/main/wsl src/shared
sed -n '1,260p' src/main/orcad/orcad-startup-timing-summary.ts
sed -n '1,180p' src/main/orcad/orcad-entry.ts

Repository: stablyai/orca

Length of output: 25906


Script executed:

set -o pipefail
printf '%s\n' '--- log filename and managed-server support ---'
sed -n '1,280p' src/main/managed-server/install/orcad-remote-host-support.ts
printf '%s\n' '--- launch/log redirection bindings ---'
rg -n -F --glob '*.{ts,tsx,js,sh}' -e 'ORCAD_LOG_FILENAME' -e 'orcad.log' -e 'stderrPath' -e 'appendFile' -e '>>' -e '2>' -e 'spawn' src/main src/shared
printf '%s\n' '--- retention and slot lifecycle ---'
rg -n -F --glob '*.ts' -e 'orcadSlotDir' -e 'remoteInstallDir' -e 'artifact-cache-retention' -e 'retention' -e 'rm(' -e 'rmSync' src/main/wsl src/main/managed-server src/main/orcad

Repository: stablyai/orca

Length of output: 45668


Script executed:

set -o pipefail
printf '%s\n' '--- runtime control launch bindings ---'
rg -n -F -- 'orcadLaunchRuntimeCommand' src/main
rg -n -F -- 'orcadReadinessWaitCommand' src/main
rg -n -F -- 'ORCAD_LOG_FILENAME' src/main/managed-server src/main/ssh src/shared
printf '%s\n' '--- runtime control source ---'
sed -n '1,230p' src/main/managed-server/install/orcad-remote-runtime-control.ts
printf '%s\n' '--- launch-session source ---'
sed -n '1,230p' src/main/managed-server/lifecycle/orcad-managed-launch-session.ts
printf '%s\n' '--- version GC source ---'
sed -n '1,220p' src/main/managed-server/lifecycle/orcad-managed-version-gc.ts
printf '%s\n' '--- recovery slot definition ---'
sed -n '1,180p' src/main/ssh/orcad-recovery-slot.ts

Repository: stablyai/orca

Length of output: 28297


Script executed:

set -o pipefail
rg -n -F -- 'orcadLaunchRuntimeCommand' src/main
rg -n -F -- 'orcadReadinessWaitCommand' src/main
rg -n -F -- 'ORCAD_LOG_FILENAME' src/main/managed-server src/main/ssh src/shared
sed -n '1,230p' src/main/managed-server/install/orcad-remote-runtime-control.ts
sed -n '1,230p' src/main/managed-server/lifecycle/orcad-managed-launch-session.ts
sed -n '1,220p' src/main/managed-server/lifecycle/orcad-managed-version-gc.ts
sed -n '1,180p' src/main/ssh/orcad-recovery-slot.ts

Repository: stablyai/orca

Length of output: 28137


Script executed:

set -o pipefail
printf '%s\n' '--- POSIX launch command ---'
sed -n '1,190p' src/main/managed-server/install/orcad-remote-launch.ts
printf '%s\n' '--- version GC implementation ---'
sed -n '1,280p' src/main/managed-server/install/orcad-remote-gc.ts
printf '%s\n' '--- GC call sites ---'
rg -n -F -- 'pruneManagedOrcadVersions' src/main/managed-server src/main/wsl

Repository: stablyai/orca

Length of output: 14875


Script executed:

set -o pipefail
printf '%s\n' '--- report call and surrounding startup flow ---'
rg -n -F -- 'reportStartupTiming' src/main/orcad/orcad-entry.ts
nl -ba src/main/orcad/orcad-entry.ts | sed -n '180,360p'
printf '%s\n' '--- numbered launch redirection ---'
nl -ba src/main/managed-server/install/orcad-remote-launch.ts | sed -n '82,155p'
printf '%s\n' '--- numbered reader and restart flow ---'
nl -ba src/main/wsl/wsl-orcad-real-distro-idle-release-lane.test.ts | sed -n '350,425p'
printf '%s\n' '--- numbered GC call and implementation ---'
nl -ba src/main/managed-server/lifecycle/orcad-runtime-deployment.ts | sed -n '190,225p'
nl -ba src/main/managed-server/install/orcad-remote-gc.ts | sed -n '35,105p'

Repository: stablyai/orca

Length of output: 21924


Script executed:

set -o pipefail
printf '%s\n' '--- report call and startup flow ---'
rg -n -F -- 'reportStartupTiming' src/main/orcad/orcad-entry.ts
nl -ba src/main/orcad/orcad-entry.ts | sed -n '180,360p'
printf '%s\n' '--- launch redirection ---'
nl -ba src/main/managed-server/install/orcad-remote-launch.ts | sed -n '82,155p'
printf '%s\n' '--- reader and restart flow ---'
nl -ba src/main/wsl/wsl-orcad-real-distro-idle-release-lane.test.ts | sed -n '350,425p'
printf '%s\n' '--- GC call and implementation ---'
nl -ba src/main/managed-server/lifecycle/orcad-runtime-deployment.ts | sed -n '190,225p'
nl -ba src/main/managed-server/install/orcad-remote-gc.ts | sed -n '35,105p'

Repository: stablyai/orca

Length of output: 21885


Script executed:

rg -n -F -- 'ORCAD_STARTUP_TIMING_ENV' src/main/wsl/wsl-orcad-real-distro-idle-release-lane.test.ts src/main
nl -ba src/main/wsl/wsl-orcad-real-distro-idle-release-lane.test.ts | sed -n '1,150p'

Repository: stablyai/orca

Length of output: 9292


Read startup timing from the active slot only.

Each restart appends stderr to orcad.log. The reader then searches every retained orcad-* slot and applies tail -n 1 to the combined output. tail follows glob order, not report time. If an older retained slot sorts after the active slot, the receipt can use that previous daemon’s timings for the restart median.

Pass the active remoteInstallDir to readOrcadStartupTiming and read only that slot’s log. The current report is appended after readiness, so the older lines in the active slot do not need separate truncation.

Split first output into ensure, terminal create, and send-to-output, and
report orcad's internal startup medians (boot before the first timed phase,
each phase's end and duration, readiness) so moving the readiness publish
earlier can be judged per phase.
@nwparker
nwparker force-pushed the nwparker/wsl-lane-startup-phase-baseline branch from 3b7f46e to 74a1ff9 Compare October 29, 2026 01:59
@nwparker
nwparker merged commit a0969d5 into main Oct 29, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant