Skip to content

Extract subprocess handling into @orca/process-host - #26963

Merged
nwparker merged 11 commits into
mainfrom
nwparker/REFACTOR
Oct 10, 2026
Merged

nwparker merged 11 commits into
mainfrom
nwparker/REFACTOR

Conversation

@nwparker

@nwparker nwparker commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Orca's subprocess code now belongs to @orca/process-host, with explicit public entry points and independent checks. Engineers can find its owner and contract directly. Application behavior stays compatible; the work also fixes development rebuild and Windows daemon lifecycle problems exposed by review.

What Changed

  • Move execution functions and process contracts into their owning modules. Consumers use public subpaths, with no forwarding barrel or runtime npm dependencies, Electron imports, or native addons.
  • Build and stage the package for desktop, CLI, headless server, SSH relay, daemon, and Node tooling. One CommonJS runtime preserves registration state across import and require callers; declarations and output support remote Node 18.
  • Recover development builds when missing modules are created, publish new dependencies before replacement importers, and preserve daemon startup ownership, observed build layouts, and profile isolation.
  • Update existing CI selectors and import enforcement. Ready PRs retain full unit testing; this foundational package still has broad consumer reach.

Why

A useful package boundary needs enforceable imports, an independent compiler and tests, and complete deployed artifacts. A folder move would leave those responsibilities implicit. Explicit modules make ownership clearer; retaining one runtime avoids duplicate process observers and termination policies. A new module format or task runner would add unrelated migration work.

Linked Issue

Maintainer-requested restructuring; no existing issue.

Visual Proof

N/A — no rendered UI or interaction changes.

Testing

  • I manually tested these changes locally: builds, public artifact loading, runtime smoke, and dependency checks on macOS, plus native Windows checks on paired host awin. No desktop windows were launched.
  • Automated tests added/updated.

Full typechecks, changed-code quality (594 files, zero new findings), import enforcement, reliability checks, frozen root/mobile installation, and desktop/CLI/relay/headless builds pass. Focused tests cover package contracts, stream-owning consumers, build/watch recovery, concurrent output publication, scripts, and daemon ownership. Actual Node 18.20.8 loads all 16 public entries with shared import/require identities; strict CommonJS and ESM consumers verify declarations.

Exact head d72d173 passes native Windows qualification on awin (Windows 10.0.26200.9457, Node 24.18.0, pnpm 12.8.1): frozen installation, package build/types, main-process and CLI types, and import checks. 306 tests pass, with 26 platform skips, including real Windows shim arguments, concurrent builds/readers, missing-module watch recovery, staged package loading, and daemon relocation.

Current-head CI passes all five unit shards and aggregate verification, Windows/Linux packaging, Windows native smoke and desktop/headless switching, missing-AppData startup, all four Docker watcher shards, Linux runtime floors, actual Node 18 loading, Windows SSH hosts, mixed-version wire compatibility, relay integration, real WSL, and Git compatibility.

The original changed-E2E job failed an agent readiness timeout and a paired-stream precondition assertion. The readiness timeout reproduces on unrefactored main. A matching 26-test main batch passes all 17 applicable tests; paired recovery also passes the matching small PR batch. The single matching full PR batch also passes all 17 applicable tests with nine skips, including both agent launches and paired recovery, on unchanged exact head. The original check remains red; the controlled runs qualify its intermittent failures. Paired failure was not reproduced on baseline. No assertions were weakened. Earlier real-Claude checks reproduced two unchanged baseline model-name assertions.

Review

Independent native Codex review rounds covered correctness, manifests/types, consumers, artifacts, build/watch lifecycle, CI/workspaces, and architecture. Findings were fixed and independently reviewed again; all six final scopes returned CLEAN. Earlier Opus 5.5 orchestration reviews covered their preceding snapshots. Final native simplicity and merge-readiness reviews are CLEAN at d72d173: redundant aliases, test-only forwarding exports, and a duplicate directory walk were removed. The combined merge with latest main 15823ac5c09 preserves both sides byte-for-byte, with no package import violations or deleted-source references.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material copied or translated.

Notes

Dist publication is atomic per file. Supported launch paths await complete builds; direct packaging checks completeness, not source freshness. Published current-version daemon copies remain until their application version retires. The import checker is a bounded static ratchet.

Checklist

  • This PR is small and focused — scope is one package boundary; its consumer migration and runtime integration are large.
  • I explained what changed and why.
  • Visual proof is N/A with reason.
  • Self-reviewed for correctness, security, and performance.
  • Cross-platform, SSH/remote, folder-workspace, and compatibility impact considered.
  • Local checks and native Windows qualification pass; the matching full main and PR E2E batches pass.

@nwparker
nwparker requested a review from brennanb2025 as a code owner October 9, 2026 23:19
@nwparker
nwparker merged commit 1912c90 into main Oct 10, 2026
84 of 85 checks passed
Jinwoo-H added a commit that referenced this pull request Oct 10, 2026
Keeps this tree's .github/actions: main's install action now runs build:packages (#26963), which this release predates.
mkjung added a commit to mkjung/orca that referenced this pull request Oct 11, 2026
Upstream stablyai#27215 deleted the SSH relay server. Accept the deletion of its
node-pty cloexec patch and test, and keep only the desktop half of the
failed-spawn cleanup test. Take upstream's shorter stablyai#9902 message in
build-orcad-prebuilds.mjs. Keep upstream's new oxlint-plugin-anti-slop
patch entry next to this PR's node-pty patch hash. The lockfile differs
from upstream main only in the three node-pty patch hash references.
Upstream stablyai#26963 moved the node-gyp spawn to @orca/process-host, so the
prebuild floor gate fixture now stages a stub of that package.

Validation: 198 tests passed across 16 focused files on the Node runner;
30 macOS- or Windows-only cases skipped. Frozen-lockfile install passed.
oxlint and oxfmt passed on the changed files. The Bun runner and native
prebuild builds were not rerun.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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