Conversation
A fork starts from the source's latest snapshot, never from the live session, so forking a running source silently drops its recent changes while exiting 0. Look the source up first, warn on stderr when it is running, and say so in fork --help.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: Gauntlet story Fork a prepared sandbox into multiple work sandboxes. The agent created a source, wrote
/workspace/prepared/state.txt, ransandbox forktwice, and both children came up without the file. It recovered only after findingsandbox snapshot --stopon its own and forking again: 12 of 22 steps adapted.The server forks from the source's latest snapshot, or from a fresh copy of its runtime when there is none. It never reads a running session's filesystem. The SDK JSDoc and the vercel.com CLI reference say so; the CLI did not.
fork --helponly mentioned copied config, and forking a running source printed the normal success summary and exited 0.Reproduced with sandbox 4.3.0 against
elisabethrulke/sandbox-demo:This:
resume: falseso a stopped source stays stopped) and, when its session isrunning, prints a warning to stderr with the snapshot-first workaround. The fork still proceeds.fork --help;docs/index.mdregenerated.Same sequence with this branch:
After
sandbox snapshot --stop fork-warn-src, the next fork printed no warning andcat /workspace/prepared/state.txtin the child returnedready.Not done here: the warning fires on
runningonly;stoppingandsnapshottingsources are left alone. I did not add a snapshot-and-fork flag, since it would stop the source as a side effect and deserves its own discussion. Server behavior is unchanged.Verification:
pnpm vitest run test/commands22 passed (3 new infork.test.ts),pnpm typecheckclean, live run above, all 4 test sandboxes removed afterwards.