Coordinate workspace cleanup with active operations

This commit is contained in:
2026-12-01 20:17:27 +00:00
parent 038105ece9
commit 9e3fc25fdd
15 changed files with 358 additions and 32 deletions

View File

@@ -46,11 +46,14 @@ session run-history cleanup, and are excluded from publish and restore enumerati
## Locking
`artifacts.LocalStore` enforces the single-writer session lock via an
operating-system lock held on `.lock` (`ErrLockConflict` on contention). The
`artifacts.LocalStore` enforces single-writer workspace access via an
operating-system lock held on `<workspace.root>/.lock` (`ErrLockConflict` on contention). The
file retains owner metadata after release or process death; its existence is
not evidence that a lock is active. Command and restore flows wait for this
lock only while their context remains active, and report a release failure.
not evidence that a lock is active. Runs, preflight, mutating restore, and
manual cleanup acquire it before creating or changing managed session state.
Initialization targeting managed work also acquires it. They wait only while
their context remains active and report a release failure. Read-only inspection
and dry runs do not acquire it; separate workspaces remain independent.
Standalone preflight holds the same lock through preparation, readiness probes,
and finalization, keeping active probe files outside concurrent cleanup.
Preparation uses ordinary manifest transitions and invalidation.