Skip to content

fix(orcad): harden the startup qualification marker (execPath, node-pty load failure) - #35513

Merged
nwparker merged 2 commits into
mainfrom
nwparker/orcad-qualification-hardening
Oct 29, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/orcad-qualification-hardening

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​90 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​88
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​40

ELI5

#35064 and #35484 let orcad skip two startup self-checks on a host where nothing changed since a clean start. This tightens what "nothing changed" means, and makes orcad forget that proof the moment its terminal library actually fails to load. The next start then re-checks and reports why.

What Changed

  • The startup qualification key now includes process.execPath. A slot re-pointed at another Node build re-qualifies, even with the same version string.
  • New src/main/providers/node-pty-load-failure.ts: a tiny listener registry. loadLocalPtyRuntimeSpawn, which is orcad's in-process node-pty load for degraded local PTY routing, reports a failed import('node-pty') before rethrowing. orcad's main.ts registers discardBundledOrcadStartupQualification(). That deletes the slot's marker (managed, non-Windows slots only, as with recording) and drops any pending qualification for this launch.
  • Tests from e9's review of perf(orcad): skip the node-pty probe child for a slot qualified on an unchanged host #35484: a marker written under schema 1 never matches, and a Windows slot is never qualified by a matching marker.

Why

This is review follow-up from #35484, by e9 and fix-reviewer. Without the discard, a slot whose node-pty broke without any change the key sees would keep skipping the probe, and only fail at each spawn without the probe's diagnosis.

Known gap: only node-pty loads in the orcad process report this. The terminal daemon loads node-pty in its own process (daemon/pty-subprocess/native-pty-spawn.ts), and a load failure there doesn't reach orcad's listener. Wiring that needs a daemon-to-orcad signal, which I'd do separately if wanted.

SSH effect: SSH-managed Linux and macOS slots re-qualify once, because the key gained a field. After that they behave as before. Windows is unchanged.
Flag-off: this applies whether or not ORCA_INTERNAL_WSL_HOSTS is set; it is orcad qualification code.
User-risk: low. Every slot pays the startup check once more after this lands. A node-pty failure in orcad makes the next launch run the full probe.

Linked Issue

Follow-up to #35064 and #35484 (D3 cold start, option (d)).

Visual Proof

N/A: no UI.

Testing

  • orcad-startup-qualification.test.ts: execPath is in the key; a schema-1 marker never matches.
  • orcad-profile-preflight.test.ts: Windows resolves false with a matching marker; a node-pty failure discards the marker and records nothing; Windows and unmanaged slots touch no marker.
  • local-pty-runtime-spawn.test.ts (new): a failed node-pty import is reported, then rethrown.
  • main-preflight-order.test.ts: a later node-pty load failure discards the qualification.
  • pnpm tc, typecheck:ci, code-quality, anti-slop and ast-grep pass.
  • Automated tests added/updated

Status

Ready for one reviewer.

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; one re-qualification elsewhere)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (CI runs the rest)

…ty load failure)

- The key includes process.execPath, so a slot re-pointed at another Node build re-qualifies.
- A node-pty load failure in orcad (degraded local PTY routing) discards the slot's marker, so
  the next launch re-probes node-pty and reports the cause; reported through a small listener so
  the shared provider stays free of orcad imports.
- Tests: a schema-1 marker never matches; a Windows slot is never qualified by a matching marker.
@nwparker

Copy link
Copy Markdown
Contributor Author

STATUS: ready for one reviewer. Head e1b23dd.

Checks run: pnpm tc, typecheck:ci, code-quality:changed, anti-slop, oxlint, ast-grep. Suites run per file: profile-preflight 32/32, startup-qualification 14/14, main-preflight-order 17/17, local-pty-runtime-spawn 1/1, native-preflight 8/8.

Known gap (also in the body): node-pty load failures inside the daemon process aren't reported to orcad.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previously reported marker race is fixed.

Summary

The PR adds process.execPath to the startup key and clears qualification after an in-process node-pty load failure.

  • Startup markers now distinguish which Node executable ran.
  • An Orcad-process node-pty load failure clears the startup marker.

Reviews (2) · Last reviewed commit: "fix(orcad): discard the startup marker o..." · Reviewed by Greptile

… lands

A node-pty failure right after readiness could unlink the marker before the confirm's write
renamed it into place, recreating it. The discard now waits for the last marker write first.
@nwparker

Copy link
Copy Markdown
Contributor Author

STATUS: e9's P3 is fixed. Head 8b62466.

discardBundledOrcadStartupQualification now waits for the last marker write (markerRecording), so it can't unlink before an in-flight record renames the marker into place and recreates it.

New test: the discard happens strictly after the in-flight record. It fails on e1b23dd and passes now; profile-preflight is 33/33.

Checks run: pnpm tc, typecheck:ci, code-quality:changed, anti-slop, oxlint, ast-grep. main-preflight-order 17/17, startup-qualification 14/14.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: a1de0cdc-f4cf-4429-91ec-0dab218c6636
Commits

Reviewing files that changed from the base of the PR and between e6a2708 and 8b62466.

Files selected for processing: 9
  • src/main/orcad/main-preflight-order.test.ts
  • src/main/orcad/main.ts
  • src/main/orcad/orcad-profile-preflight.test.ts
  • src/main/orcad/orcad-profile-preflight.ts
  • src/main/orcad/orcad-startup-qualification.test.ts
  • src/main/orcad/orcad-startup-qualification.ts
  • src/main/providers/local-pty-runtime-spawn.test.ts
  • src/main/providers/local-pty-runtime-spawn.ts
  • src/main/providers/node-pty-load-failure.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.

Walkthrough

The startup qualification key now includes the Node executable path. The node-pty loader reports import failures to registered listeners before rethrowing the error. Startup registers a listener that discards bundled startup qualification after a failure. The discard operation waits for any in-progress marker write and applies only to eligible non-Windows slots. Tests cover key matching, failure reporting, discard behavior, and write ordering.

Priority: Low

Merge Risk: Minimal · up to 8b624

The change adds executable-path qualification and marker cleanup. No merge-blocking regression was established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 60.00% 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 summarizes both main changes: stronger startup qualification keys and marker invalidation after node-pty load failures.
Description check Passed The description is detailed and covers the change, rationale, linked issues, testing, visual proof, known gap, and platform impact. Some optional template sections are omitted, and several full valida…
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 is detailed and covers the change, rationale, linked issues, testing, visual proof, known gap, and platform impact. Some optional template sections are omitted, and several full validation commands remain unchecked because CI will run them.

Full details: Docstring Coverage

Explanation

Docstring coverage is 60.00% 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 5 functions across 9 files.

Resolution

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

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • 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 a33b40f 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