Skip to content

fix(desktop): build the sandbox VM helper for dev runs - #321

Merged
quickbeard merged 1 commit into
mainfrom
fix/predev-vzhelper
Aug 25, 2026
Merged

quickbeard merged 1 commit into
mainfrom
fix/predev-vzhelper

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

On a fresh clone, opening any sandbox dialog on the Work side of a dev run (bun dev) dead-ends on:

sandbox VM helper is not installed (expected at …/packages/codev-sandbox/native/vzhelper/dist/codev-vmm)

Root cause

The vz provider's availability check stats the helper binary (packages/codev-sandbox/src/vz/provider.ts:118). In dev runs vmmHelperPath() points at the codev-sandbox dist/ build output — but only prebuild (packaging) ever ran build-vzhelper.ts. Nothing built it for bun dev, so every dev machine that hadn't packaged a release sat in this state. The renderer then caches the failed verdict for the app's lifetime (staleTime: Infinity in sandbox/context.tsx), so even building the helper by hand needs an app relaunch to register.

Fix

predev.ts — the hook that already exists for exactly this fresh-clone class of failure (the Electron 42 install-electron shim) — now builds the helper on macOS:

  • Host arch only; packaging keeps doing --universal in prebuild.
  • Incremental: ~1.5s when the Swift build is up to date.
  • Non-fatal: no Swift toolchain → a warning ("Work sandboxes will be unavailable") and a working app, never a broken bun dev.

Updated the existing predev.ts row in DIVERGENCES.md.

Verified

Ran bun ./scripts/predev.ts end-to-end (helper built and ad-hoc signed with com.apple.security.virtualization), relaunched the dev app, and drove it over CDP: window.api.sandboxes.availability() → {supported: true}, and the Work-side "Set up your sandbox" dialog now shows the real setup flow (Choose… / Cancel / Set up) with no error line.

🤖 Generated with Claude Code

`bun dev` never built codev-vmm — only prebuild (packaging) did — so on a
fresh clone the Work side answered every sandbox dialog with "sandbox VM
helper is not installed" (the vz provider stats the dev helperPath,
codev-sandbox/native/vzhelper/dist/codev-vmm). Same fresh-clone class of
failure predev already fixes for the Electron binary, so the build joins it
there: macOS only, host arch (packaging still does --universal), incremental
(~1.5s when up to date), and non-fatal — a machine without a Swift toolchain
warns and still gets a working app, minus sandboxes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@quickbeard
quickbeard merged commit 97ced88 into main Aug 25, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the fix/predev-vzhelper branch August 25, 2026 03:40
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