Skip to content

cloud: fix Freestyle VM fork via snapshot clone - #12320

Merged
lawrencecchen merged 3 commits into
mainfrom
fix-cloud-vm-fork-capability-main
Sep 12, 2026
Merged

cloud: fix Freestyle VM fork via snapshot clone#12320
lawrencecchen merged 3 commits into
mainfrom
fix-cloud-vm-fork-capability-main

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Problem

cmux vm fork selected the gateway's always-present fork() method on Freestyle, then returned 501 vm_operation_unsupported. Freestyle has no native fork API.

Fix

Expose driver capabilities from the provider gateway and select the native path only when the driver declares fork: true. Freestyle now uses the existing documented snapshot-then-create clone path.

The PR keeps the regression test in its own first commit, followed by the fix.

Validation

  • bun test --isolate tests/vm-fork-capability.test.ts passes.
  • ESLint passes for the changed files.
  • Full bun run typecheck reaches two existing unrelated test errors in tests/docs-search-cache.test.ts and tests/vercel-ignore-build.test.ts.
  • Live Freestyle validation was completed on the prior PR's vmfx1 stack: fork created a new VM from a fresh snapshot, exec worked, and delete worked.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Medium Risk
Changes fork routing in the VM workflow for Freestyle and any provider without native fork; wrong capability wiring could still pick the wrong clone path or skip billing/create semantics on the native branch.

Overview
Fixes cmux vm fork on Freestyle, which was incorrectly treated as a native clone because the provider gateway always exposes a fork method that fails with vm_operation_unsupported when the driver has no real fork API.

The gateway now exposes optional capabilities(provider) (backed by vmCapabilitiesFor), and forkVm picks the native path only when the driver reports fork: true via providerForksNatively. Freestyle (fork: false) goes through the existing snapshot → create clone flow instead of calling provider fork. A regression test asserts Freestyle never hits the fork call and reaches snapshot first.

Reviewed by Cursor Bugbot for commit 18ca953. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Fixes cmux vm fork on Freestyle, which previously always selected the gateway's fork() method and failed with vm_operation_unsupported. The gateway now exposes driver capabilities, and the native fork path is used only when the driver declares fork: true. Freestyle uses the existing snapshot-then-create clone path instead, with usage events recording which fork path was taken. A regression test locks in the capability decision.

Written for commit af7025c. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes

    • Improved VM forking behavior by respecting provider-declared capabilities.
    • Freestyle providers now correctly use the snapshot-based fallback when native forking is unsupported.
    • Prevented unsupported native fork attempts from causing VM operations to fail unnecessarily.
    • Improved reliability when providers report that native VM cloning is unavailable.
  • New Features

    • Added capability detection for VM providers to support more accurate operation handling.

…ive fork

The live provider gateway always defines fork() and answers unsupported from
inside it when the driver has no native fork. forkVm read the presence of
that function as native support, so on Freestyle every fork failed with
vm_operation_unsupported and the snapshot-based path was unreachable.
@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cmux166 Ready Ready Preview Sep 12, 2026 2:57am UTC
cmux41 Ready Ready Preview Sep 12, 2026 2:57am UTC

@github-actions

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: ec0ea2c8-aa7e-4910-9976-de786ed0fad8

📥 Commits

Reviewing files that changed from the base of the PR and between 18ca953 and af7025c.

📒 Files selected for processing (1)
  • web/services/vms/workflows.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The VM provider gateway now reports provider capabilities. forkVm checks the fork capability before selecting native cloning and uses the snapshot path when native fork is unsupported. Tests cover the capability value and routing behavior.

Changes

VM fork capability handling

Layer / File(s) Summary
Provider capability reporting
web/services/vms/providerGateway.ts
The gateway shape and live implementation now expose provider capabilities through vmCapabilitiesFor.
Capability-aware fork selection
web/services/vms/workflows.ts, web/tests/vm-fork-capability.test.ts
forkVm checks the provider fork capability before using native fork. Tests verify that Freestyle uses the snapshot path when native fork is unsupported.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: austinywang

Merge Risk: ⚪ Minimal · up to af702

The capability-aware fork routing is mergeable with no identified current-head risk.

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing Freestyle VM forks by using snapshot cloning.
Description check ✅ Passed The description clearly explains the problem, fix, regression test, lint validation, typecheck limitation, and live validation. It does not include the template's Demo Video, Review Trigger, or Checkl…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed The pull request changes only TypeScript files: web/services/vms/providerGateway.ts, web/services/vms/workflows.ts, and a TypeScript test. The authoritative diff contains no Swift paths or Swift a…
Cmux Swift Blocking Runtime ✅ Passed PASS. The authoritative pull-request diff changes only three TypeScript files. It adds no production Swift code and introduces no Swift blocking or timing synchronization. The Effect.sync calls are …
Cmux Browser Automation Off-Main ✅ Passed PASS. The pull request changes only web/services/vms/providerGateway.ts, web/services/vms/workflows.ts, and web/tests/vm-fork-capability.test.ts. It does not change browser socket automation, `S…
Cmux Expensive Synchronous Load ✅ Passed PASS. The authoritative pull-request diff changes only three TypeScript files: web/services/vms/providerGateway.ts, web/services/vms/workflows.ts, and web/tests/vm-fork-capability.test.ts. It ad…
Cmux Cache Substitution Correctness ✅ Passed PASS: The PR does not replace an authoritative read with a cached or opportunistic value. capabilities delegates to vmCapabilitiesFor, which derives flags from the registered driver and declaratio…
Cmux No Hacky Sleeps ✅ Passed PASS: The pull request adds capability lookup and changes fork routing, but it adds no sleep, timer, delayed dispatch, polling loop, or wall-clock wait. The only Effect.sleep and polling logic found…
Cmux Algorithmic Complexity ✅ Passed PASS: The production diff adds only constant-time capability resolution and a single capability branch. providerForksNatively performs fixed scalar checks at `web/services/vms/workflows.ts:1511-1513…
Cmux Swift Concurrency ✅ Passed The authoritative pull-request diff changes only TypeScript files under web/services/vms and one TypeScript test. It introduces no Swift code or Swift concurrency patterns, so this check is not appl…
Cmux Swift @Concurrent ✅ Passed PASS: The authoritative PR diff changes only TypeScript files (providerGateway.ts, workflows.ts, and vm-fork-capability.test.ts). It introduces no Swift files or Swift concurrency annotations, s…
Cmux Swift Package Boundaries ✅ Passed The authoritative pull-request diff changes only two TypeScript production files and one TypeScript test file. It contains no Swift changes, so the Swift package boundary rule is not applicable.
Cmux Swiftpm Lockfiles ✅ Passed PASS. The review-scoped diff changes only three TypeScript files: web/services/vms/providerGateway.ts, web/services/vms/workflows.ts, and web/tests/vm-fork-capability.test.ts. It changes no `Pac…
Cmux Swift Logging ✅ Passed PASS: The PR changes only three TypeScript files (providerGateway.ts, workflows.ts, and a test file); it adds no Swift file or Swift code. The added lines contain no print, debugPrint, dump,…
Cmux User-Facing Error Privacy ✅ Passed PASS. The production diff adds an internal gateway capability method, changes fork routing, and records native/snapshotId in usage-event metadata. It does not add or modify user-facing error text,…
Cmux Full Internationalization ✅ Passed PASS. The diff changes only VM service logic and adds a regression test. It adds no Swift text, web UI copy, API response text, rendered markdown, locale files, or message keys. The new capabilities
Cmux Swiftui State Layout ✅ Passed PASS: The reviewed diff changes only three TypeScript files under web/services/vms and web/tests. It introduces no SwiftUI code, ObservableObject/@published state, GeometryReader layout measurement, l…
Cmux Architecture Rethink ✅ Passed PASS. The authoritative pull-request diff changes only two TypeScript service files and one TypeScript test file. It contains no Swift changes, so the Swift architectural-rethink failure conditions do…
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS. The reviewed diff changes only three TypeScript files: web/services/vms/providerGateway.ts, web/services/vms/workflows.ts, and web/tests/vm-fork-capability.test.ts. The patch contains no Swift f…
Cmux Source Artifacts ✅ Passed The diff changes only two hand-written TypeScript source files and one hand-written regression test: web/services/vms/providerGateway.ts, web/services/vms/workflows.ts, and `web/tests/vm-fork-capa…
Cmux No Test Or Debug Seam In Production Source ✅ Passed The authoritative pull-request diff changes only two TypeScript production files and one TypeScript test file. It contains no Swift files under a production Sources/ path, so the specified Swift tes…
Cmux No Ambient Global State ✅ Passed PASS: The reviewed range changes only three TypeScript files (web/services/vms/providerGateway.ts, web/services/vms/workflows.ts, and web/tests/vm-fork-capability.test.ts). It contains no Swift …
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-cloud-vm-fork-capability-main

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.

@cursor

cursor Bot commented Sep 12, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@lawrencecchen
lawrencecchen merged commit b317b35 into main Sep 12, 2026
23 of 25 checks passed
@lawrencecchen
lawrencecchen deleted the fix-cloud-vm-fork-capability-main branch September 12, 2026 02:59
rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 12, 2026
f23e719 fix: add nightly floor for beta builds (manaflow-ai#12389)
b317b35 cloud: fix Freestyle VM fork via snapshot clone (manaflow-ai#12320)
a7bd0c3 Fix Nightly compatibility warnings (manaflow-ai#12385)
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