Skip to content

feat(orcad): boot the Orca runtime on plain Node - #15968

Merged
nwparker merged 8 commits into
mainfrom
nwparker/orcad-node-runtime
Aug 23, 2026
Merged

nwparker merged 8 commits into
mainfrom
nwparker/orcad-node-runtime

Conversation

@nwparker

@nwparker nwparker commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​90 $\color{#cf222e}{\Huge{\mathbf{−}}}$​22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​68
Prod 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​514 $\color{#cf222e}{\Huge{\mathbf{−}}}$​102 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​412

ELI5

Orca's brain — worktrees, terminals, git, SSH, agents — lives in one big service. Today that service can only start inside Electron, a ~200 MB desktop app that ships an entire web browser. On a remote server there is no screen, so all of that is dead weight.

This PR makes the brain start on plain Node. orcad is a 4.43 MB bundle with zero require("electron") that boots, accepts a pairing code, registers a repo, creates a real git worktree, and runs a real terminal.

Nothing about the desktop app changes. It installs the same facilities as before, just through a named seam instead of a direct import.

What this finishes

The stack below it built the seams and the gate. This PR closes the last two couplings and turns the ratchet to 0:

Module What was predicted What it actually took
speech/model-manager An HttpClient port — net.request is a streaming ClientRequest with byte-range resume, progress events, manual idle timeout No port needed. Only construction pulls Electron in; importing the type is free. Injecting the factory moved the cluster out with the download logic untouched.
ipc/filesystem-watcher Separate the native watcher lifecycle from renderer bookkeeping — 31 WebContents refs interleaved with the six functions the runtime needs No separation needed. Every map entry arrives via an ipcMain handler carrying a renderer sender, so a host with no renderer has nothing to close, restore or forget. An inert default does exactly what the desktop code does against empty maps.

Both earlier estimates were too pessimistic for the same reason: they measured how tangled the code is instead of asking what a headless host actually needs from it.

config/runtime-electron-baseline.txt is now empty, and its test asserts exactly that — strictly stronger than the old "may only shrink" rule.

Proof it works

The acceptance drives both hosts through one code path (--target orcad|electron) and seeds its own git repo, so each must satisfy the same contract — no borrowed global state, runnable on a clean box.

repo add → worktree create → worktree show → terminal create → send a nonce via process.execPath → assert it in the output → remove the worktree → clean shutdown.

Platform Node Result
macOS arm64 24.18 PASS
Ubuntu 24.04 x86_64 26.1 Boots and pairs on a box with no Electron installed at all
Windows 11 24.18 PASS over real ConPTY; byte-identical build output

Wired into PR CI as smoke:orcad-terminal.

What the test caught that the import graph could not

In sequence, against a bundle that already reported zero Electron imports:

  1. orcad booted with no store at all. Every persistence RPC threw runtime_unavailable, while read paths using this.store?.x ?? [] quietly answered "empty" — so a server that paired and listed nothing looked healthy.
  2. registerPtyHandlers called without the store, so every terminal.create died at binding-persistence time.
  3. Missing getLocalProvider, so destructive worktree removal refused to run — correctly, since it could not verify the tree was idle.

None are visible in the import graph. The ratchet proves a property of the build; only this proves the thing runs.

Proof of no regressions

  • Full suite: 57,146 passed / 0 failed — identical to the pre-change baseline
  • pnpm run typecheck, pnpm run lint (incl. --deny-warnings), ratchet: clean
  • Both gates verified to exit 1 on an injected import { app } from 'electron' and exit 0 clean — an empty baseline that failed open would be worse than no gate
  • Windows verified directly on hardware, not emulated

User-facing trade-offs

Zero. The desktop installs every port at process-level bootstrap before anything reads state. No behaviour, timing, or storage-location change.

One repo-facing note: both host ports now anchor to a realm-global symbol, because vi.resetModules() hands the re-imported graph a fresh module copy — so a binding installed before the reset silently read back as uninstalled. That was the root cause of a large test failure wave here.

Native modules: this does NOT affect anyone who ships or runs Orca

The earlier wording here was vague. Concretely:

orcad is not built, not packaged, and not shipped by this PR. It is an opt-in dev script plus one CI check. Verified:

Check Result
Scripts referencing orcad only build:orcad and smoke:orcad-terminal
build:desktop / build:release / build:release:parallel / build:electron-vite none reference orcad
electron-builder config no orcad reference
out/ gitignored

So the native-module question is scoped entirely to a binary nobody ships yet. It cannot reach a user. If node-pty were missing tomorrow, the only thing that breaks is pnpm smoke:orcad-terminal — a CI step and a dev command.

For the record, when someone does ship orcad, it needs two native modules beside it, not the five originally listed:

Module Status Without it
node-pty Hard require.resolve Exits at startup
@parcel/watcher Guarded dynamic import() Boots and serves; watch installs fail
better-sqlite3, keytar, cpu-features Not in the graph at all Nothing — externalized defensively, never validated

Proven by running orcad.js in an otherwise empty directory containing only node_modules/node-pty: it boots, binds and publishes a pairing offer.

Note node-pty ships prebuilds for macOS and Windows but not Linux, which is why the CI step runs ensure-native-runtime --runtime=node first. That is already wired.

Backward compatibility: verified in both directions

No wire change. The only src/shared/ file this entire stack touches is the new app-environment.ts port. protocol-version.ts is untouched, RUNTIME_PROTOCOL_VERSION is still 3, and RUNTIME_CAPABILITIES is unchanged. The RPC method files in the diff are pure import-path swaps — same functions, same payloads.

Tested rather than inferred, by building a client from main and running mixed pairs:

Direction Result
Old client (main) → new server (orcad) Pairs, worktree list ok, status ok — reads desktopWindowStatus: "blocked" correctly
New client (this branch) → old server (main --serve) Pairs, worktree list returns real worktrees, runtime.state: ready, desktopWindowStatus: "openable"

The one behaviour change, and why it cannot reach a fork

protected-secret-persistence.encryptionAvailable() now lets an uninstalled SecretStore throw instead of degrading silently (review fix, landed in #15916). Both host ports throw when uninstalled, so the question is whether any process can read them before installation.

The desktop installs both at process-level bootstrap, src/main/index.ts:884, before anything reads state. For child processes, checked the built bundles directly:

daemon-entry.js                    SecretStore-throw=0  AppEnvironment-throw=0
plugin-host-entry.js               SecretStore-throw=0  AppEnvironment-throw=0
computer-sidecar.js                SecretStore-throw=0  AppEnvironment-throw=0
session-scanner-service-entry.js   SecretStore-throw=0  AppEnvironment-throw=0
parcel-watcher-process-entry.js    SecretStore-throw=0  AppEnvironment-throw=0
port-scan-command-worker-entry.js  SecretStore-throw=0  AppEnvironment-throw=0
session-scanner-worker-entry.js    SecretStore-throw=0  AppEnvironment-throw=0

Neither port is reachable from any fork entry, so neither throw can fire there.

The four fork-reachable modules that previously did require('electron').app inside a try/catch still answer null/false when there is no app root — they use hasAppEnvironment() rather than the throwing getter, and none of them evaluates at module scope.

Platform verification (at this exact commit)

Re-run after the rebase onto main; earlier runs were against a commit that no longer exists.

Host Access Node Result
macOS arm64 local 24.18 Full acceptance PASS
Ubuntu 24.04 x86_64 SSH 26.1 Full acceptance PASS
Windows 11 remote host 24.18 Full acceptance PASS over real ConPTY
macOS arm64 (2nd machine) remote host 26.6 Full acceptance PASS
CI Linux runner — 24 Full acceptance PASS

Identical build output on every platform: 4.44 MB, 2,031 modules, zero require("electron"). The shipped desktop --serve path passes the same acceptance unchanged.

Review loops

4 design rounds (Opus + Grok + GPT-5.6-Sol), then 1 confirming round.

Round 3 split: one reviewer returned SETTLED, two returned NOT-SETTLED. I sided with the dissent after verifying on code that PtyHost as specified could not open a terminal — only setPtyController at pty.ts:4538 does — then closed that blocker in code rather than in prose.

Verdict: SETTLED. The confirming round closed its own blocker.

Corrections the reviews forced into the design, all recorded: the boot proof retracted to load-and-bind only; the Node floor made per-variant; ControlChannel withdrawn as a port entirely; "phase 3 IS phase 1"; degradations[] shown to be necessary but not sufficient, because Electron silently opens a local tab when screencast is missing.


CI-only failures this gate caught

The step failed three times before passing, each on something no local run could reach:

  1. node-pty was never built for Node on the runner — the repo's own test script runs ensure-native-runtime --runtime=node first; the smoke did not. Fixed by running it.
  2. The harness never read the server's stderr, so a boot failure surfaced only as server exited with 1. An unread pipe can also fill and block the child. Now captured and printed.
  3. The teardown waited 15s for an exit that had already fired, stacking a bogus "server did not exit within 15000ms of SIGTERM" on top of the real error. Guarded on exitCode.
  4. orca is not on PATH in CI — the repo installs orca-dev. The smoke now drives out/cli/index.js from this checkout, which is the version under test anyway.

Only #1 was a product-adjacent gap; #2–#4 were defects in the gate itself. Recorded because the gate's credibility rests on it having been wrong and fixed, not on having looked right.

@nwparker
nwparker force-pushed the nwparker/preflight-ipc-split branch from ac6519f to 3839cdc Compare August 22, 2026 22:33
@nwparker
nwparker force-pushed the nwparker/orcad-node-runtime branch from b799320 to b2cffb9 Compare August 22, 2026 22:33
@nwparker
nwparker force-pushed the nwparker/preflight-ipc-split branch from 3839cdc to 8c41411 Compare August 22, 2026 23:11
@nwparker
nwparker force-pushed the nwparker/orcad-node-runtime branch from b2cffb9 to a6c79fc Compare August 22, 2026 23:11
@nwparker
nwparker force-pushed the nwparker/preflight-ipc-split branch from 8c41411 to 178a90a Compare August 22, 2026 23:27
@nwparker
nwparker force-pushed the nwparker/orcad-node-runtime branch 2 times, most recently from fbbea74 to 98c8b72 Compare August 23, 2026 00:00
@nwparker
nwparker force-pushed the nwparker/preflight-ipc-split branch from 412da10 to 59c5e79 Compare August 23, 2026 01:16
@nwparker
nwparker force-pushed the nwparker/orcad-node-runtime branch from 98c8b72 to 7db5307 Compare August 23, 2026 01:16
@nwparker
nwparker force-pushed the nwparker/preflight-ipc-split branch from 59c5e79 to b6cfd0b Compare August 23, 2026 04:24
…le modules

`parcel-watcher-entry-path.ts` and `session-scanner-service-entry-path.ts` read the
app root via `require('electron').app` inside a try/catch that already returns null
when Electron is absent. They were therefore correct under plain Node at runtime and
only failed the *static* text check — which is real, not pedantic: the comment in
`ports/port-scan-command-client.ts:19` records that the plain-node-entry-guard fails
on that literal text, try/catch or not.

`hasAppEnvironment() ? getAppEnvironment() : null` gives the identical "no app root
here" answer without the text. That restores `hasAppEnvironment`, which an earlier
commit in this stack deleted as unused — it now has the caller it was waiting for.

Ratchet baseline 27 → 25.

Verified: 74 files / 458 tests; `pnpm typecheck` clean; `oxlint` clean.
Closes the last two Electron couplings and makes `orcad` a working artifact:
a 4.43 MB Node bundle that boots, pairs, registers a repo, creates a real git
worktree and round-trips a PTY — with zero `require("electron")`.

Ratchet 2 -> 0, so `config/runtime-electron-baseline.txt` is now empty and its
test asserts exactly that: any reachable electron import is a regression.

- speech: inject the service factories, so importing ModelManager for its type
  no longer drags Electron's streaming net.request into the graph
- filesystem-watcher: add a WorktreeWatcherRemoval port. Every entry in those
  maps arrives through an ipcMain handler carrying a renderer sender, so a host
  with no renderer has nothing to close, restore or forget — the inert default
  is what the desktop code does against empty maps, not a stub hiding work
- user-data-path / profile-storage-paths: resolve userData through
  AppEnvironment. These surfaced only once orcad pulled the store in

Both host ports now anchor to a realm-global symbol. `vi.resetModules()` gives
the re-imported graph a fresh module copy, so a binding installed before the
reset silently read back as uninstalled.

The acceptance smoke drives both hosts through one code path (`--target
orcad|electron`) and seeds its own git repo, so it is hermetic and asserts the
same contract of each. Wired into PR CI.
@nwparker
nwparker force-pushed the nwparker/orcad-node-runtime branch from 7db5307 to cbd304c Compare August 23, 2026 04:36
@nwparker
nwparker changed the base branch from nwparker/preflight-ipc-split to main August 23, 2026 04:36
@coderabbitai

coderabbitai Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@nwparker, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

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

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

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 51dd1608-c2ec-4f11-8c37-9cf84dd2f1fb

📥 Commits

Reviewing files that changed from the base of the PR and between f975035 and cbd304c.

📒 Files selected for processing (34)
  • .github/workflows/pr.yml
  • config/runtime-electron-baseline.txt
  • config/scripts/build-orcad.mjs
  • config/scripts/check-runtime-electron-ratchet.mjs
  • config/scripts/check-runtime-electron-ratchet.test.mjs
  • config/scripts/runtime-serve-terminal-smoke.mjs
  • package.json
  • src/main/automations/service.test.ts
  • src/main/host/electron-speech-services.ts
  • src/main/index.ts
  • src/main/ipc/filesystem-watcher.ts
  • src/main/ipc/orca-profile-auth-handlers.test.ts
  • src/main/ipc/orca-profiles.test.ts
  • src/main/ipc/worktree-watcher-removal.ts
  • src/main/orca-profiles/profile-index-store.test.ts
  • src/main/orca-profiles/profile-storage-paths.ts
  • src/main/orcad/main.ts
  • src/main/orcad/orcad-entry.ts
  • src/main/persistence-async-write-syscalls.test.ts
  • src/main/persistence-duplicate-repo-id-host-scope.test.ts
  • src/main/persistence-protected-secret-fail-closed.test.ts
  • src/main/persistence-protected-secret-write-race.test.ts
  • src/main/persistence-proxy-secret-recovery.test.ts
  • src/main/persistence-single-serialize.test.ts
  • src/main/persistence-test-harness.ts
  • src/main/persistence-ui-state.test.ts
  • src/main/persistence-workspace-session-scrollback.test.ts
  • src/main/persistence-worktree-name-retirement.test.ts
  • src/main/persistence/loading-store/user-data-path.ts
  • src/main/quit-path-durable-write-blocking.test.ts
  • src/main/runtime/mobile-pairing-userdata-path.test.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/speech/speech-runtime-service.ts

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 03fcfdf into main Aug 23, 2026
56 of 72 checks passed
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 23, 2026
* refactor(host): resolve the app root through the port in fork-reachable modules

`parcel-watcher-entry-path.ts` and `session-scanner-service-entry-path.ts` read the
app root via `require('electron').app` inside a try/catch that already returns null
when Electron is absent. They were therefore correct under plain Node at runtime and
only failed the *static* text check — which is real, not pedantic: the comment in
`ports/port-scan-command-client.ts:19` records that the plain-node-entry-guard fails
on that literal text, try/catch or not.

`hasAppEnvironment() ? getAppEnvironment() : null` gives the identical "no app root
here" answer without the text. That restores `hasAppEnvironment`, which an earlier
commit in this stack deleted as unused — it now has the caller it was waiting for.

Ratchet baseline 27 → 25.

Verified: 74 files / 458 tests; `pnpm typecheck` clean; `oxlint` clean.

* feat(orcad): boot the Orca runtime on plain Node

Closes the last two Electron couplings and makes `orcad` a working artifact:
a 4.43 MB Node bundle that boots, pairs, registers a repo, creates a real git
worktree and round-trips a PTY — with zero `require("electron")`.

Ratchet 2 -> 0, so `config/runtime-electron-baseline.txt` is now empty and its
test asserts exactly that: any reachable electron import is a regression.

- speech: inject the service factories, so importing ModelManager for its type
  no longer drags Electron's streaming net.request into the graph
- filesystem-watcher: add a WorktreeWatcherRemoval port. Every entry in those
  maps arrives through an ipcMain handler carrying a renderer sender, so a host
  with no renderer has nothing to close, restore or forget — the inert default
  is what the desktop code does against empty maps, not a stub hiding work
- user-data-path / profile-storage-paths: resolve userData through
  AppEnvironment. These surfaced only once orcad pulled the store in

Both host ports now anchor to a realm-global symbol. `vi.resetModules()` gives
the re-imported graph a fresh module copy, so a binding installed before the
reset silently read back as uninstalled.

The acceptance smoke drives both hosts through one code path (`--target
orcad|electron`) and seeds its own git repo, so it is hermetic and asserts the
same contract of each. Wired into PR CI.

* test(smoke): remove the seeded workspace container, not just the worktree

* test(smoke): surface the server's stderr when it dies before ready

* fix(smoke): build node-pty for Node before booting orcad in CI

* fix(smoke): drive the CLI built from this checkout, not one on PATH

* docs(ratchet): say the baseline must stay empty, not merely shrink

* build(orcad): externalize only the native modules actually in the graph

(cherry picked from commit 03fcfdf)
CodeHourra pushed a commit to CodeHourra/orca that referenced this pull request Aug 23, 2026
* refactor(host): resolve the app root through the port in fork-reachable modules

`parcel-watcher-entry-path.ts` and `session-scanner-service-entry-path.ts` read the
app root via `require('electron').app` inside a try/catch that already returns null
when Electron is absent. They were therefore correct under plain Node at runtime and
only failed the *static* text check — which is real, not pedantic: the comment in
`ports/port-scan-command-client.ts:19` records that the plain-node-entry-guard fails
on that literal text, try/catch or not.

`hasAppEnvironment() ? getAppEnvironment() : null` gives the identical "no app root
here" answer without the text. That restores `hasAppEnvironment`, which an earlier
commit in this stack deleted as unused — it now has the caller it was waiting for.

Ratchet baseline 27 → 25.

Verified: 74 files / 458 tests; `pnpm typecheck` clean; `oxlint` clean.

* feat(orcad): boot the Orca runtime on plain Node

Closes the last two Electron couplings and makes `orcad` a working artifact:
a 4.43 MB Node bundle that boots, pairs, registers a repo, creates a real git
worktree and round-trips a PTY — with zero `require("electron")`.

Ratchet 2 -> 0, so `config/runtime-electron-baseline.txt` is now empty and its
test asserts exactly that: any reachable electron import is a regression.

- speech: inject the service factories, so importing ModelManager for its type
  no longer drags Electron's streaming net.request into the graph
- filesystem-watcher: add a WorktreeWatcherRemoval port. Every entry in those
  maps arrives through an ipcMain handler carrying a renderer sender, so a host
  with no renderer has nothing to close, restore or forget — the inert default
  is what the desktop code does against empty maps, not a stub hiding work
- user-data-path / profile-storage-paths: resolve userData through
  AppEnvironment. These surfaced only once orcad pulled the store in

Both host ports now anchor to a realm-global symbol. `vi.resetModules()` gives
the re-imported graph a fresh module copy, so a binding installed before the
reset silently read back as uninstalled.

The acceptance smoke drives both hosts through one code path (`--target
orcad|electron`) and seeds its own git repo, so it is hermetic and asserts the
same contract of each. Wired into PR CI.

* test(smoke): remove the seeded workspace container, not just the worktree

* test(smoke): surface the server's stderr when it dies before ready

* fix(smoke): build node-pty for Node before booting orcad in CI

* fix(smoke): drive the CLI built from this checkout, not one on PATH

* docs(ratchet): say the baseline must stay empty, not merely shrink

* build(orcad): externalize only the native modules actually in the graph
Jinwoo-H added a commit that referenced this pull request Aug 24, 2026
Textual conflicts (7 files) resolved as semantic merges — both sides kept in
every case; no side was dropped.

Beyond the textual conflicts, main added four gates and one behaviour that this
branch's new code violated. Fixed in this merge:

- runtime-electron ratchet (#15968): the branch's `rpc/methods/browser-network-tunnel.ts`
  reached `ipc/ssh.ts`, dragging 20 Electron modules back into the runtime graph the
  orcad work had just emptied. The connection-manager accessor moves to
  `ssh/ssh-target-registry.ts` (the same extraction #15927 did for the other five
  accessors) and the dispatch reads it there; `wsl-browser-network-relay-launch.ts`
  reads the app root through the AppEnvironment port. Baseline back to 0 entries.

- HTML side-preview focus (STA-5001, #15716): main keeps the source editor focused
  when the reserved preview split is still empty, by steering the visible tab. This
  branch's client-owned placement reconciler decides the active group on its own and
  bypassed that, refocusing the preview. It now takes the same fallback tab.

- child_process / windowsHide / wsl.exe census gates: the WSL browser-network relay
  launcher moves onto `spawnProcess`, and the two Electron test launchers now spawn
  with `windowsHide`. The four sites that cannot migrate today are allowlisted with
  their reason (detached process-group kill, a non-all-pipes stdio shape, and a
  long-lived streaming wsl.exe child that `runWslProcess` cannot express).

- max-lines: both sides grew `package-electron-runtime-contract.test.mjs`; the union
  crossed 600. This branch's two additions move to
  `config/scripts/client-hosted-browser-package-coverage.test.mjs`.

Also ports four browser-create test files onto main's
`applyWebSessionTabsSnapshot`/`decideWebSessionTabsSnapshot` split (#15644).

Gates: typecheck 0 errors, `pnpm lint` exit 0, 6316/6369 test files green. The 12
remaining failures are pre-existing on one or both parents (5 packaging tests need a
real `pnpm install`, global-fetch audit and 4 others fail on both parents) or flaky.
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
* refactor(host): resolve the app root through the port in fork-reachable modules

`parcel-watcher-entry-path.ts` and `session-scanner-service-entry-path.ts` read the
app root via `require('electron').app` inside a try/catch that already returns null
when Electron is absent. They were therefore correct under plain Node at runtime and
only failed the *static* text check — which is real, not pedantic: the comment in
`ports/port-scan-command-client.ts:19` records that the plain-node-entry-guard fails
on that literal text, try/catch or not.

`hasAppEnvironment() ? getAppEnvironment() : null` gives the identical "no app root
here" answer without the text. That restores `hasAppEnvironment`, which an earlier
commit in this stack deleted as unused — it now has the caller it was waiting for.

Ratchet baseline 27 → 25.

Verified: 74 files / 458 tests; `pnpm typecheck` clean; `oxlint` clean.

* feat(orcad): boot the Orca runtime on plain Node

Closes the last two Electron couplings and makes `orcad` a working artifact:
a 4.43 MB Node bundle that boots, pairs, registers a repo, creates a real git
worktree and round-trips a PTY — with zero `require("electron")`.

Ratchet 2 -> 0, so `config/runtime-electron-baseline.txt` is now empty and its
test asserts exactly that: any reachable electron import is a regression.

- speech: inject the service factories, so importing ModelManager for its type
  no longer drags Electron's streaming net.request into the graph
- filesystem-watcher: add a WorktreeWatcherRemoval port. Every entry in those
  maps arrives through an ipcMain handler carrying a renderer sender, so a host
  with no renderer has nothing to close, restore or forget — the inert default
  is what the desktop code does against empty maps, not a stub hiding work
- user-data-path / profile-storage-paths: resolve userData through
  AppEnvironment. These surfaced only once orcad pulled the store in

Both host ports now anchor to a realm-global symbol. `vi.resetModules()` gives
the re-imported graph a fresh module copy, so a binding installed before the
reset silently read back as uninstalled.

The acceptance smoke drives both hosts through one code path (`--target
orcad|electron`) and seeds its own git repo, so it is hermetic and asserts the
same contract of each. Wired into PR CI.

* test(smoke): remove the seeded workspace container, not just the worktree

* test(smoke): surface the server's stderr when it dies before ready

* fix(smoke): build node-pty for Node before booting orcad in CI

* fix(smoke): drive the CLI built from this checkout, not one on PATH

* docs(ratchet): say the baseline must stay empty, not merely shrink

* build(orcad): externalize only the native modules actually in the graph
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* refactor(host): resolve the app root through the port in fork-reachable modules

`parcel-watcher-entry-path.ts` and `session-scanner-service-entry-path.ts` read the
app root via `require('electron').app` inside a try/catch that already returns null
when Electron is absent. They were therefore correct under plain Node at runtime and
only failed the *static* text check — which is real, not pedantic: the comment in
`ports/port-scan-command-client.ts:19` records that the plain-node-entry-guard fails
on that literal text, try/catch or not.

`hasAppEnvironment() ? getAppEnvironment() : null` gives the identical "no app root
here" answer without the text. That restores `hasAppEnvironment`, which an earlier
commit in this stack deleted as unused — it now has the caller it was waiting for.

Ratchet baseline 27 → 25.

Verified: 74 files / 458 tests; `pnpm typecheck` clean; `oxlint` clean.

* feat(orcad): boot the Orca runtime on plain Node

Closes the last two Electron couplings and makes `orcad` a working artifact:
a 4.43 MB Node bundle that boots, pairs, registers a repo, creates a real git
worktree and round-trips a PTY — with zero `require("electron")`.

Ratchet 2 -> 0, so `config/runtime-electron-baseline.txt` is now empty and its
test asserts exactly that: any reachable electron import is a regression.

- speech: inject the service factories, so importing ModelManager for its type
  no longer drags Electron's streaming net.request into the graph
- filesystem-watcher: add a WorktreeWatcherRemoval port. Every entry in those
  maps arrives through an ipcMain handler carrying a renderer sender, so a host
  with no renderer has nothing to close, restore or forget — the inert default
  is what the desktop code does against empty maps, not a stub hiding work
- user-data-path / profile-storage-paths: resolve userData through
  AppEnvironment. These surfaced only once orcad pulled the store in

Both host ports now anchor to a realm-global symbol. `vi.resetModules()` gives
the re-imported graph a fresh module copy, so a binding installed before the
reset silently read back as uninstalled.

The acceptance smoke drives both hosts through one code path (`--target
orcad|electron`) and seeds its own git repo, so it is hermetic and asserts the
same contract of each. Wired into PR CI.

* test(smoke): remove the seeded workspace container, not just the worktree

* test(smoke): surface the server's stderr when it dies before ready

* fix(smoke): build node-pty for Node before booting orcad in CI

* fix(smoke): drive the CLI built from this checkout, not one on PATH

* docs(ratchet): say the baseline must stay empty, not merely shrink

* build(orcad): externalize only the native modules actually in the graph
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