cloud: fix Freestyle VM fork via snapshot clone - #12320
Conversation
…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.
|
All contributors have signed the CLA ✍️ ✅ |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe VM provider gateway now reports provider capabilities. ChangesVM fork capability handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to The capability-aware fork routing is mergeable with no identified current-head risk. 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
Bugbot is paused — on-demand spend limit reachedBugbot 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. |
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)
Problem
cmux vm forkselected the gateway's always-presentfork()method on Freestyle, then returned501 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.tspasses.bun run typecheckreaches two existing unrelated test errors intests/docs-search-cache.test.tsandtests/vercel-ignore-build.test.ts.vmfx1stack: fork created a new VM from a fresh snapshot, exec worked, and delete worked.Need help on this PR? Tag
@codesmith-botwith 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 forkon Freestyle, which was incorrectly treated as a native clone because the provider gateway always exposes aforkmethod that fails withvm_operation_unsupportedwhen the driver has no real fork API.The gateway now exposes optional
capabilities(provider)(backed byvmCapabilitiesFor), andforkVmpicks the native path only when the driver reportsfork: trueviaproviderForksNatively. 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 forkon Freestyle, which previously always selected the gateway'sfork()method and failed withvm_operation_unsupported. The gateway now exposes driver capabilities, and the native fork path is used only when the driver declaresfork: 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.
Summary by CodeRabbit
Bug Fixes
New Features