Files
devvm/internal/structure
w3cjandClaude Opus 5.5 3ebb998752 fix(vm): a per-folder creation lock from lookup through Create
Nothing held a lock from finding that a folder has no VM until Create,
and a second creation's clear deleted the vms/<hash>/ folder of the VM
the first had just made; the remake's lock lives inside that folder, so
it couldn't help.

- paths.Dirs.CreateLock(hash): run/create-<hash>.lock, outside the VM's
  folder.
- Launch.makeHeld: when up finds no VM, or the folder's own unfinished
  one, it TryLocks the folder's creation lock before the plan's
  questions, finds the VM again under it (finder.again, sameCreation)
  and opens one another devvm made meanwhile; create lets go of the lock
  once created records Created, before the first start. After an
  interrupt the lock is let go of by a cleanup that runs after
  undoCreate's.
- A second devvm refuses at once (create_running), never waiting on the
  first one's questions; so does up's remakeUnfinished question.
- devvm rm (Rm and rmGone) takes the lock too (holdForRm) and refuses
  while it's held, or when the VM's state changed once it has it.
- The holder deletes the lock file as it lets go, so no file named by
  the VM stays outside its folder; teardown deletes one a killed devvm
  left (dropCreateLock).
- Tests: TestUpCreateLock (two creations at once: one VM, one state;
  failed before the fix with two CreateVMs), TestUpMadeMeanwhile,
  TestUpInterruptedHoldsCreateLock, TestCreateLockRefuses (up's
  remake-unfinished question and rm by folder and by name refused),
  TestRmChangedMeanwhile, TestTeardownDropsCreateLock.
- Docs: internals overview (a new VM's step 1, run/, the locks section
  and table), troubleshooting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 04:53:35 -07:00
..