Skip to content

perf(orcad): skip the node-pty probe child for a slot qualified on an unchanged host - #35484

Merged
nwparker merged 2 commits into
mainfrom
nwparker/orcad-pty-probe-qualified
Oct 29, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/orcad-pty-probe-qualified

Conversation

@nwparker

@nwparker nwparker commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​76 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​70
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​36 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25

ELI5

Before orcad starts, it launches a small separate Node process to check that the terminal library (node-pty) loads. That costs about 0.1 s on every start. #35064 already lets a slot skip its other startup self-check after a clean start on an unchanged host. This lets the same proof skip the node-pty check too.

What Changed

  • preflightBundledOrcadStartup now returns whether the slot was qualified from its marker: same artifact bytes, runtime, glibc, kernel and launch env, and the last launch reached readiness.
  • runOrcadNativePreflightVerdict({ qualified }) skips the probe child for a qualified slot. It clears any stale terminal degradation, exactly as a passing probe does, and returns 'ok'. Otherwise it runs the probe as before and returns its verdict. runOrcadNativePreflight keeps its boolean API.
  • main.ts: if the verdict isn't 'ok' (degraded or unverifiable), forgetBundledOrcadStartupQualification() drops the pending qualification. So a marker is recorded only by a launch whose node-pty probe passed cleanly, and a launch that skips the probe always does so on that proof.
  • The qualification key's schema goes 1 → 2. Markers written before this change didn't promise a clean probe, so each slot re-qualifies once.

Why

This is option (d) from the cold-start memo. The full startup profile on lane run 40766470551 shows the node-pty probe as a synchronous spawnSync of a Node child, ≈70–100 ms of blocked main thread before startup. The probe exists because a native loader crash can't be caught in-process. On a slot qualified as unchanged, the same bytes, runtime, libc and kernel already loaded node-pty cleanly on the last launch.

SSH effect: the same saving on Linux and macOS SSH-managed slots. Windows slots always run the full preflight (#35064), so they're unchanged.
Flag-off: this applies whether or not ORCA_INTERNAL_WSL_HOSTS is set; this is orcad-wide qualification code.
User-risk: low. The first launch of a slot on a host, and any launch after a changed byte, runtime, libc, kernel or launch env, still runs the probe. A host where the probe is degraded never skips it. If node-pty broke without any of those changing (bit rot), terminals fail at first use instead of at startup, the same trade-off #35064 accepted for the startup preflight.

Linked Issue

Internal WSL-via-orcad tracker, D3 cold start, option (d).

Visual Proof

N/A: no UI.

Testing

  • orcad-native-preflight.test.ts: a qualified slot skips check and clears degradation; a degraded probe reports degraded.
  • orcad-profile-preflight.test.ts: the qualified/not-qualified return value; a forgotten qualification records nothing.
  • main-preflight-order.test.ts: a qualified slot passes qualified to the native preflight; a non-ok verdict forgets the qualification before main(); the existing ordering cases still pass.
  • pnpm tc, typecheck:ci, code-quality, anti-slop and ast-grep pass.
  • Lane re-measure: this PR's WSL2 run. The ~0.1 s probe gap before cli-launcher should disappear from the restart runs. I'll post it here.
  • Automated tests added/updated

Status

Ready for two reviewers (startup order). Waiting for the lane re-measure.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • N/A for visuals with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote impact considered (Windows unchanged; SSH Linux/macOS gain)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (CI runs the rest)

… unchanged host

A slot whose startup qualification marker matches (same artifacts, runtime, libc, kernel and
launch env, last launch reached readiness) now also skips the synchronous node-pty load probe
child (~0.1 s on the WSL lane). The marker is now recorded only when that launch's probe
passed cleanly; schema 2 so earlier markers, which did not promise that, re-qualify once.
@nwparker

Copy link
Copy Markdown
Contributor Author

STATUS: ready for two reviewers. Head 6642469.

Checks run: pnpm tc, typecheck:ci, code-quality:changed, anti-slop, oxlint, ast-grep. Run per file: native-preflight 8/8, profile-preflight 30/30, main-preflight-order 16/16, startup-qualification 13/13.

The lane re-measure will be posted here when this PR's WSL2 run finishes.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with no blocking issues found.

Summary

The PR skips the node-pty probe child when a managed slot has startup proof for the same files and host.

  • Qualified orcad slots skip the node-pty probe on repeat starts.

No actionable new issues were found. The previous-review merge bases differed, so this review covered the full PR.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Check bundled startup] --> B{Matching schema-2 marker?}
  B -->|Yes: consume marker| C[Skip node-pty probe]
  B -->|No| D[Run startup child and node-pty probe]
  D --> E{Native verdict}
  E -->|Blocked| F[Exit]
  E -->|Degraded or unverifiable| G[Clear pending qualification]
  E -->|OK| H[Start server]
  G --> H
  C --> H
  H --> I{Startup reaches readiness?}
  I -->|Yes| J[Record any pending qualification]
  I -->|No| K[Leave qualification unrecorded]
Loading

Reviews (2) · Last reviewed commit: "Merge branch 'main' into nwparker/orcad-..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 28, 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 12 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: f7764aa3-66ef-4787-ac9d-a3f4cec422b3
Commits

Reviewing files that changed from the base of the PR and between 6642469 and e6cd802.

Files selected for processing: 7
  • src/main/orcad/main-preflight-order.test.ts
  • src/main/orcad/main.ts
  • src/main/orcad/orcad-native-preflight.test.ts
  • src/main/orcad/orcad-native-preflight.ts
  • src/main/orcad/orcad-profile-preflight.test.ts
  • src/main/orcad/orcad-profile-preflight.ts
  • src/main/orcad/orcad-startup-qualification.ts

No actionable comments were generated in the recent review.

Recent 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: 24fc7364-f162-4407-bc17-64104be6623f
Commits

Reviewing files that changed from the base of the PR and between 79dbada and 6642469.

Files selected for processing: 7
  • src/main/orcad/main-preflight-order.test.ts
  • src/main/orcad/main.ts
  • src/main/orcad/orcad-native-preflight.test.ts
  • src/main/orcad/orcad-native-preflight.ts
  • src/main/orcad/orcad-profile-preflight.test.ts
  • src/main/orcad/orcad-profile-preflight.ts
  • src/main/orcad/orcad-startup-qualification.ts

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

Walkthrough

Startup preflight now reports whether it consumed an existing qualification marker. Native preflight accepts that result, skips the probe when qualified, and returns explicit verdict statuses. Startup forgets pending qualification when the verdict is not ok. The qualification key schema changes from 1 to 2. Tests cover qualification consumption, cleanup, verdict handling, and startup ordering.

Priority: Low

Merge Risk: Minimal · previous review 66424

The reported native-binding concern does not apply to supported packaged launches. No identified issue blocks merging after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: skipping the node-pty probe for qualified slots.
Description check Passed The description explains the change, motivation, behavior, risks, testing, platform impact, and visual-proof status. It is mostly complete, although the linked issue is described without an actual iss…
Docstring Coverage Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
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 explains the change, motivation, behavior, risks, testing, platform impact, and visual-proof status. It is mostly complete, although the linked issue is described without an actual issue link and some full validation commands remain unchecked.

Full details: Docstring Coverage

Explanation

Docstring coverage is 80.00% which is sufficient. 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 5 functions across 7 files.

Finishing Touches: 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

@nwparker
nwparker merged commit 017276a into main Oct 29, 2026
56 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