Repository navigation
fix: let managed SSH Claude chats load the agent SDK - #26450
Conversation
Review summaryProblem: every Claude chat on an SSH host failed with "Chat could not be started". The managed SSH server is bundled as one CommonJS file, and the bundler turns User-facing change: Claude native chat starts on SSH hosts that run the managed server. Nothing visible changes elsewhere. What the PR does: every server output (server, launcher, daemon and its child workers) maps Review (independent, head 90b0fdb): no findings.
Not verified: a full SSH chat (the load check stops before talking to the provider), native Linux/Windows runs, and the exact pinned Node 24 runtime (the review used Node 26). Live SSH QA across all the SSH chat fixes is still to come, and screenshots will go in the PR body before this is marked ready. Still open: a conflict with main in |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬆️ High Merge Risk: ⚪ Minimal · up to The change lets the managed server bundle load the Claude SDK by providing a module URL, and it adds a build-time check for that. No concrete merge-blocking risk was found. Live SSH chat behavior still needs QA. Pre-merge checks |
|
…-orcad-esm-import-meta # Conflicts: # config/scripts/build-orcad.mjs
|
Confirming this on Orca 1.4.224 (macOS arm64) with |
…-orcad-esm-import-meta
|
Synced with Before this sync, merging would have broken Checks
Live check. I built this PR merged with #26464 into a local-only build and ran it over SSH on a Linux container with a stand-in Claude. Claude chats start and complete on the managed server. Without this PR, every chat start fails with Merge order: this PR first, then #26464. |
ELI5
Every structured Claude chat on a managed SSH host failed with “Chat could not be started.” The server bundle erased the Claude SDK's module URL, so loading the SDK called
createRequire(undefined)before Claude could start. This change lets the packaged server load that SDK successfully and prevents unsupported module metadata from silently becoming an empty object again.What Changed
import.metawarning as a build error across the server, launcher, forked children, and staged watcher wrapper. Onlyimport.meta.urlis mapped; unsupported metadata access fails packaging.build:orcadinvokes it, including the existing template-build workflow.#/%, and unsupported module metadata.The server and launcher bytes already participate in the slot version and template checksums, so deployments automatically select a new version without changing the manifest format.
Why
The server graph has two executable
import.metasites, both in the Claude SDK: its module-loadcreateRequireand its optional native-CLI lookup. Orca supplies its resolved executable explicitly, so that fallback does not need packaged SDK binaries; neither site needs a separate wasm or worker asset. The graph's other occurrence is source text for a generated plugin, which this mapping leaves as text.Keeping CommonJS avoids changing the loader contract for native dependencies, workers, older launchers, and Windows hosts. Emitting ESM would require adapting that existing contract; externalizing the SDK would require shipping and hashing another package tree. The selected mapping supplies the same deployed-bundle location that a native ESM bundle would use, and the build error prevents silently accepting other metadata semantics. See esbuild's diagnostic override and Node's file-URL conversion.
Differences from the common pattern:
Linked Issue
U29 from the managed SSH structured-chat investigation; no separate issue.
Visual Proof
Pending coordinator QA on the final branch: open structured Claude chat on a managed SSH host and send a message. This draft has automated packaged-module evidence, but no final-head rendered before/after evidence yet.
Testing
The new real-bundle test reproduced the live
ERR_INVALID_ARG_VALUE/createRequire(undefined)failure before the URL mapping and passes with it. Four targeted files passed, 18 tests total:config/scripts/orcad-entry-build.test.mjs,src/main/orcad/orcad-bundle-native-load-order.test.ts,src/main/orcad/orcad-runtime-entry-artifacts.test.ts, andconfig/scripts/orcad-artifact-version.test.mjs.The queued
tc-nodecheck passed. All 22 pre-pushorca-ci-checks --no-typecheckchecks passed after the queued Node typecheck. The complete macOS package build passed under local Node 26.5.0, including the new SDK smoke check, daemon load check, and profile-state workers. The pinned Node 24.21.0 package also built successfully after resuming and verifying the timed-out archive download. Invoking the packaged server’s structured-provider load check with that exact pinned runtime exited 0 with empty stderr. The blocking CI watch completed: static analysis/typecheck, all ten Node 24 unit shards, relay integration, both package jobs (including Windows), repository guards, and test-selection evidence passed. No red checks remain. Headless/template, compatibility, and UI qualification jobs were skipped by the draft/change-scope policy and are not counted as passes. The download timeout and watch interruption were infrastructure issues, both resolved without code changes.All nine relay/companion entries also built with unsupported module metadata promoted to an error, with zero such warnings. The desktop daemon externalizes third-party packages; the CLI is compiled with TypeScript, so those paths do not perform this failing SDK transformation. Codex, ACP, and Pi use their existing command/protocol paths; the existing whole-server graph and native load-order checks passed.
Local checks used macOS arm64 and plain Node 26.5.0 plus the pinned Node 24.21.0, with no Electron UI, provider process, login, or credentials. Linux/Windows execution and an actual managed SSH turn remain for CI/coordinator QA. Other SSH chat lifecycle, configuration, and launch-environment fixes are separate work.
Review
Draft for coordinator review and end-to-end QA; do not merge or mark ready.
Agent skill upstream boundary
Notes
No wire or persisted-data format changes. Native modules retain their deployed package directories. The content hash and template manifest continue to derive from the emitted bytes.
Checklist