Repository navigation
fix(orcad): harden the startup qualification marker (execPath, node-pty load failure) - #35513
Conversation
…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.
|
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. |
[Medium impact] The PR appears safe to merge; the previously reported marker race is fixed. SummaryThe PR adds
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.
|
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. |
|
No actionable comments were generated in the recent review.
|
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
process.execPath. A slot re-pointed at another Node build re-qualifies, even with the same version string.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 failedimport('node-pty')before rethrowing. orcad'smain.tsregistersdiscardBundledOrcadStartupQualification(). That deletes the slot's marker (managed, non-Windows slots only, as with recording) and drops any pending qualification for this launch.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_HOSTSis 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:execPathis in the key; a schema-1 marker never matches.orcad-profile-preflight.test.ts: Windows resolvesfalsewith 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.Status
Ready for one reviewer.
Checklist
N/Afor visuals with reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (CI runs the rest)