Repository navigation
feat(ai-vault): read remote OpenCode history with the pinned Node; remove Bun - #24128
Conversation
|
| await exec(conn, `mkdir -p ${shellEscape(stageDir)}`, signal) | ||
| await uploadRelayDirectory(conn, localStage, stageDir, host, { signal }) | ||
| await exec(`mkdir -p ${shellEscape(stageDir)}`, signal) | ||
| await remoteStep(() => uploadRelayDirectory(conn, localStage, stageDir, host, { signal })) |
There was a problem hiding this comment.
Runtime upload misses SFTP mapping
If a POSIX host's SFTP subsystem sees different paths from its shell, this upload uses the shell's stage path without translating it for SFTP. The previous vault upload used a mapped stage. Here the archive can fail to upload or land where the shell cannot find it, so the pinned Node cannot be installed and remote OpenCode history remains unavailable.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the full branch through fa6bde90, which removes the Bun SQLite backend and moves remote OpenCode history onto the pinned Node runtime.
- Bun SQLite adapter deleted —
bun-sqlite-database.ts,bun-sqlite-statement.ts,bun-readonly-wal.ts, andsrc/shared/orcad-bun-runtime.tsare gone;sync-database.ts,sqlite-read-failure.ts, andprofile-state-backup-worker.tsnow usenode:sqliteunconditionally.build-relay.mjsno longer externalisesbun:sqliteandconfig/tsconfig.cli.jsondrops the removed modules. - Probes require
node:sqlite.backup()— both the SSH probe (probeOpenCodeNodeSqliteCommand) and the WSLSQLITE_PROBEnow fail capability whenbackupis absent, so 22.13–22.15 hosts fall through to the pinned runtime. - Shared runtime store on POSIX/WSL — the vault reader reuses
runtimes/node-<executableSha256>/bin/node; newinstallNodeRuntimeFromHostArchiveCommandstages a host-readable archive, extracts/verifies/self-tests/promotes it, then removes the stage.ensureRemoteOrcadNodeRuntimenow returns the executable and wraps each host round trip inremoteStep. - Windows vault path — uploads a verified bare
node.exeunder the same store layout; on-host archive extraction is explicitly deferred. - Materializer refactor —
materializeCachedNodeRuntime(client cachenode/<sha>/node[.exe]) replaces the Bun materializer,findExtractedExecutableis removed now thatmemberalways contains/, and the tar branch passes the member.
I verified pnpm tc:node, pnpm run check:code-quality:changed, and the focused suites (orcad-remote-node-runtime, ssh-relay-opencode-pinned-node, ssh-relay-opencode-runtime, pinned-runtime-materializer, opencode-wsl-runtime-preparation, sync-database, sqlite-read-failure) all pass. The install/promote ordering is safe under concurrency and interruption: the executable hash and --version self-test run before .verified is written, so the probe never accepts wrong bytes, and stages are token-scoped.
Note for reviewers: the mixed-version direction is sound but has no staged-rollout gate — a new client rewrites opencode-sqlite-runtime.json to a Node path while an older relay may still be live; that older reader bundle still reads through node:sqlite under Node, and a new reader handles an old Bun reference via Bun's node:sqlite. Worth confirming on a real upgrade before this reaches users.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior pullfrog review (fa6bde90): the base-branch merge 91f87dd and one test-only commit.
- Dropped a stale Bun driver test —
journal-open-failure.test.tslost itsSQLiteError/errno-shaped case. Sincefa6bde90removed theerrnofallback and thename === 'SQLiteError'acceptance fromisSqliteDriverError, that input no longer classifies as corrupt, so the case was failing; deleting it is the right fix.isSqliteCorruptionhas no caller outside the journal classifier, so no production path still distinguishes Bun's error shape. - Merged the base branch —
91f87ddis a clean merge ofOrcaWin/node-rt-cutover(0b15611f); it touches no PR-authored file.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
… Bun SSH hosts whose Node lacks node:sqlite (or its backup(), which 22.13-22.15 omit) now get the pinned Node in the shared ~/.orca-remote/runtimes/node-<sha> store orcad uses: POSIX hosts receive the official archive and extract and hash-verify it on the host; Windows hosts receive the verified node.exe the client extracted, promoted by host Node with the same hash check. WSL distros use the same layout and checks under ~/.cache/orca/runtimes/. The Bun release pin table and its materializer are deleted. Old relays keep reading their vault-sqlite/<sha>/bun references; nothing deletes those files. An unconfirmed runtime upload now keeps its stage instead of removing it.
…y backend Nothing outside Electron runs on Bun any more (design D4), so SyncDatabase loses its Bun branch, and bun-sqlite-database, bun-sqlite-statement and bun-readonly-wal go, with the relay's bun:sqlite external. The profile-state backup worker admits Electron or an entry that exists, and startup errors name the pinned Node. The D7 cross-runtime gate still runs Bun 1.4.2, now reaching Bun's SQLite through its node:sqlite.
…te is the only backend
4d44093 to
2937783
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior pullfrog review (4d44093): the branch was rebased onto main (merge-base 6593d7d1, which already carries #24110), so the three PR commits now sit directly on main instead of a merge of OrcaWin/node-rt-cutover.
- Probes adapted to main's shared reader API —
isSqliteAvailable()insync-database.ts, the SSHprobeOpenCodeNodeSqliteCommand, and the WSLSQLITE_PROBEnow callhasNodeSqliteReaderApi/ embedNODE_SQLITE_READER_API_SOURCEfrom main'snode-sqlite-reader-api.tsinstead of inlineDatabaseSync+backupchecks. Admission semantics are unchanged, and the embedded source is routed throughshellEscape/powerShellNativeArg, so its quotes stay safe. - New WSL probe test —
opencode-wsl-runtime-preparation.test.tsruns the real probe with a preload that deletesnode:sqlite.backup, asserting rejection, and confirms anExperimentalWarningon stderr does not fail the probe. - Rebased journal test —
journal-open-failure.test.tspicks up main'sNO_LEGACY_JOURNAL_RECORDSargument; the prior deletion of the Bun-driver corruption case still stands.
I verified pnpm tc:node and the focused suites (opencode-wsl-runtime-preparation, sync-database, sqlite-read-failure) pass. No behavioral regression in the rebase adaptation.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (40)
💤 Files with no reviewable changes (9)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change replaces Bun-specific SQLite handling with Node’s Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The change moves OpenCode history reading and SQLite access from Bun to the pinned Node runtime. No concrete merge-blocking issue remains after review. Remote installs on real hosts were not exercised here, so ordinary pre-release validation still applies. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Digest verification and atomic updates limit the migration’s risk. No introduced security weakness was established in the inspected paths, but host compatibility and cleanup after interrupted installations remain partly unresolved. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |

ELI5
When a remote host's Node can't read OpenCode's chat history database, Orca used to download Bun to read it. It now uses the same pinned Node that orcad uses, stored once per host by hash. That removes Orca's last runtime use of Bun.
What Changed
ssh-relay-opencode-pinned-node.tsreusesensureRemoteOrcadNodeRuntime. The runtime lives at~/.orca-remote/runtimes/node-<sha>/bin/node: probed by hash and.verified, uploaded as the official archive only when missing, then hash-checked and self-tested on the host.node.exetoruntimes/node-<sha>/node.exe. Uploading the archive and extracting it on the host is later Phase 2 work.$HOME/.cache/orca/runtimes/.node:sqlitebackup()too, so hosts on Node 22.13–22.15 use the pinned Node.orcad-bun-runtime.ts(the Bun asset table), the Bun materializer,bun-sqlite-*,bun-readonly-wal, the Bun branch ofsync-database.ts, and thebun:sqliteexternal inbuild-relay.mjs.vault-sqlite/<sha>/bunreference is never read or rewritten, so they keep working.Why
This completes design D4:
node:sqliteis the only SQLite backend outside Electron. Reusing orcad's runtime store avoids a second pinned binary on each host.Linked Issue
Part of the Node runtime plan (Phase 2). Stacked on #24110.
Visual Proof
N/A. The only effect is which runtime a background reader uses.
Testing
Targeted suites pass under the pinned Node 24.21.0: sqlite, profile-state, ai-vault, relay, the SSH vault, the orcad runtime and the materializer.
orcad-remote-node-runtimeinstalled the real darwin archive through a real shell.The cross-runtime profile test passes with Bun 1.4.2 and the pinned Node.
build:relayoutput contains nobun:sqliteorversions.bun.pnpm tc, the changed-code gate and anti-slop pass.Known gaps:
tar -zandsha256sumorshasum.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.