Skip to content

Materialize workspace executables atomically; current sequence can permanently brick a workspace #316

Description

@bobtista

Problem

Materializing the workspace executable currently does copy → delete → move → chmod. That sequence has two crash windows:

  1. After delete, before move — the destination is missing.
  2. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions