Problem
Materializing the workspace executable currently does copy → delete → move → chmod. That sequence has two crash windows:
- After delete, before move — the destination is missing.
- After move, before chmod — the destination exists but is not executable.
The second is the dangerous one: it permanently bricks the workspace, because verification never mutates the file. A workspace that lands in this state will fail every subsequent launch and will not self-heal, since nothing in the verification path fixes permissions.
Proposed approach
Make materialization atomic:
- Copy to a temporary file.
chmod the temporary file.
rename into place.
rename is atomic on both target platforms, so the destination is either the old valid file or the new valid file — never a half-materialized one.
Acceptance criteria
- No window exists in which the destination is missing or non-executable.
- A crash at any point leaves the workspace in a launchable state.
- Existing workspaces already in the bricked state are repaired or detected (decide and document which).
Notes
Stack PR 3 (feat/unix-filesystem).
Problem
Materializing the workspace executable currently does copy → delete → move → chmod. That sequence has two crash windows:
The second is the dangerous one: it permanently bricks the workspace, because verification never mutates the file. A workspace that lands in this state will fail every subsequent launch and will not self-heal, since nothing in the verification path fixes permissions.
Proposed approach
Make materialization atomic:
chmodthe temporary file.renameinto place.renameis atomic on both target platforms, so the destination is either the old valid file or the new valid file — never a half-materialized one.Acceptance criteria
Notes
Stack PR 3 (
feat/unix-filesystem).