orca/config
Neil 2548b816c0
Keep the app responsive when security software slows process creation (#12217)
* fix(ports): keep the app responsive when security software slows process creation

Orca ran the workspace port scan's probe commands (lsof/ps on macOS,
netstat + powershell.exe on Windows) directly in the Electron main process.
libuv performs process creation inline on the calling event loop, which in
the main process is the browser UI thread, so an endpoint-security module
hooking CreateProcessW froze the whole window for the length of the spawn.

The same stall also produced a false diagnosis: the 4s command watchdog was
armed before execFile (local-workspace-port-scanner.ts:389 -> :410), so its
deadline had already passed by the time the command started. Every scan on a
hooked host reported a command timeout, tripping the 60s -> 5min backoff and
the "Port scanning is temporarily paused after a command timeout" banner even
though the commands themselves were healthy.

Probe commands now run on a lazily created, unref'd worker thread with FIFO
one-at-a-time dispatch, and the watchdog is armed after execFile returns so it
measures the command rather than the spawn. Node's own execFile timeout kill
(killed: true) is classified as a command timeout, keeping the backoff working
for genuine hangs. A scan that observes a stalled spawn skips its optional
metadata commands for that cycle, capping a hooked-host scan at roughly one
stall instead of three.

Closes #11161

* fix(ports): keep advertised URLs when a stalled spawn skips port metadata

Review follow-up on #11161. The stalled-spawn early return handed
scanWorkspacePorts raw ports with no cwd/commandLine, so every port failed
attribution and reconcileAdvertisedUrls told the watcher each worktree's
listeners had vanished. shouldEvictAfterScan then deleted every cached
advertised URL and broadcast a removal event; those URLs are only ever
captured from live PTY output, so the dev-server link was gone until the
server restarted.

The scanners now report metadataAvailable, and reconciliation is skipped for
a scan that never gathered attribution evidence. The skip is also no longer
self-perpetuating: on an EDR-hooked host every spawn stalls, so gating purely
on the current scan's spawnMs made every port permanently external (Stop
refused with 'Only workspace-owned local processes can be stopped here.').
Metadata is now re-probed on the scan after a skip, matching what the comment
and test name already claimed.

Co-authored-by: Orca <help@stably.ai>

* test(windows): stop a temp-dir lock from failing the CLI launcher smoke test

The native launcher assertions passed on windows-latest, but teardown's
rmSync raced Windows' release of the image handle on the exe the test had
just executed and threw EPERM, failing the job.

Cleanup now retries and, on Windows only, tolerates a residual lock code
instead of reporting it as a launcher regression.

Co-authored-by: Orca <help@stably.ai>

* fix(ports): scope the metadata skip away from attribution-dependent scans

The metadata skip was a process-wide parity flag, so Stop and the
localhost-label allowlist could land on a degraded cycle and reject a
port the panel had just shown as workspace-owned. Give those callers an
explicit requireMetadata option, and carry the previous cycle's listener
metadata forward so a skipped background scan no longer republishes
workspace ports as external.

Also pin the watchdog ordering: the stall in the execution test was
shorter than the watchdog budget, so a watchdog armed before execFile
still passed.

* build: guard worker-thread entries against electron imports (#11161)

Electron's module is not registered on worker threads, so
require("electron") throws "Cannot find module 'electron'" inside a
main-process worker and kills it at startup (verified on Electron 43.1.0).
plain-node-entry-guard covered only forked plain-Node entries, so the five
worker entries relied on hand-written "must stay electron-free" comments.

The port-scan probe worker is one import away from
port-scan-command-client.ts, which deliberately contains require('electron').
A violation there fails closed at runtime while every unit test still passes,
because the client's require is try/caught on the main thread.

Covers stt-worker, warp-theme-parser-worker,
session-scanner-opencode-sqlite-worker-entry, main-thread-hang-watchdog-entry
and port-scan-command-worker-entry. The scan is transitive over the emitted
chunk graph, so a shared chunk that reaches electron is caught too.

Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>

* test(windows): retry teardown for main's duplicate-PATH launcher fixture

Main's new csc-compiled harness runs an exe from the temp tree, which is
exactly the image-handle/AV lock the merged-in removeFixtureTree retry exists
for; its bare rmSync would report a teardown lock as a launcher failure.

Co-authored-by: Orca <help@stably.ai>

* test(ports): pin the packaged-asar worker entry path

resolveWorkerEntryPath's packaged branch never runs in dev or e2e, so the path construction had no coverage. Split the electron read out of it and unit-test both layouts.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
2026-08-04 02:03:40 -07:00
..
docker/headless-pairing Fix headless Linux serve pairing readiness (#9785) 2026-07-21 18:23:20 -07:00
nsis fix(windows): separate updater from orchestration migration (#11405) 2026-07-29 15:23:06 -07:00
oxlint-plugins perf(lint): consolidate code-quality gates into Oxlint (#11117) 2026-07-28 00:21:13 -07:00
patches Fix terminal corruption after restored snapshot replay (#12363) 2026-08-03 20:00:28 -07:00
relay-assets fix(ssh): patch node-pty helper in Windows relay (#9638) 2026-07-20 19:09:18 -07:00
scripts Keep the app responsive when security software slows process creation (#12217) 2026-08-04 02:03:40 -07:00
dev-app-update.yml chore: move dev-app-update.yml into config/ (#1276) 2026-04-30 00:11:14 -07:00
electron-builder.config.cjs feat(updater): add an adhoc release channel for branch builds (#12051) 2026-08-02 01:46:51 -07:00
electron-vite-target.config.ts ci: parallelize PR checks and accelerate Vite builds (#10989) 2026-07-27 13:32:29 -07:00
i18n-translation-source.md docs(i18n): adopt gettext PO as the canonical translation source (#11478) 2026-07-31 11:46:25 -07:00
i18next.config.ts chore: declutter top-level repo layout (#11890) 2026-08-01 00:25:35 -07:00
knip.json Keep the app responsive when security software slows process creation (#12217) 2026-08-04 02:03:40 -07:00
localization-audit.md docs(i18n): adopt gettext PO as the canonical translation source (#11478) 2026-07-31 11:46:25 -07:00
localization-coverage-allowlist.json fix(ci): mirror missing lint steps in PR workflow (#10601) (#10623) 2026-07-27 16:26:43 -07:00
max-lines-baseline.txt chore(mobile): import the shared marine-creature corpus instead of mirroring it (#12090) 2026-08-02 01:44:03 -07:00
oxlint-code-quality-native-plugins.json perf(lint): consolidate code-quality gates into Oxlint (#11117) 2026-07-28 00:21:13 -07:00
oxlint-code-quality-type-aware.json perf(lint): consolidate code-quality gates into Oxlint (#11117) 2026-07-28 00:21:13 -07:00
oxlint-react-doctor.json chore(quality): ratchet Oxlint, React Doctor, and Zustand performance (#11034) 2026-07-27 18:58:36 -07:00
packaged-runtime-node-modules.cjs fix(packaging): prune non-target native binaries (#12174) 2026-08-03 10:54:00 -07:00
reliability-gates.jsonc fix(runtime): open files from sibling workspaces (#11369) 2026-08-03 21:41:58 -07:00
tsconfig.cli.json Fix packaged skills CLI runtime ownership (#11627) 2026-07-30 18:27:16 -07:00
tsconfig.node.json fix(skills): stop calling the updater's own install a modified copy (#11249) 2026-07-28 17:27:26 -07:00
tsconfig.relay.json Support agent status hooks over SSH (#1865) 2026-05-14 16:06:23 -07:00
tsconfig.tc.cli.json refactor to clean up the codebase (#412) 2026-04-08 22:49:16 -07:00
tsconfig.tc.web.json [P1] fix(checks): stop skipped and manual checks reporting as failures (#11700) 2026-07-31 04:58:15 -07:00
tsconfig.web.json chore: enforce exhaustive switch handling 2026-05-30 13:18:12 -07:00
vitest.config.ts test(env): keep happy-dom MutationObserver callbacks alive across GC (#12438) 2026-08-03 23:18:15 -07:00