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

@@ -64,23 +64,22 @@ func withLockedInvocation(ctx context.Context, cfg *config.Config, plan BoundedP
if _, _, err := loadManifestAtPathIfPresent(ctx, &manifest.LocalStore{}, runtime.manifestPath); err != nil {
return nil, err
}
if err := prepareInvocationLayout(runtime); err != nil {
return nil, err
}
lock, err := runtime.artifactStore.AcquireWorkspaceLockContext(ctx)
if err != nil {
return nil, fmt.Errorf("acquire session lock: %w", err)
return nil, fmt.Errorf("acquire workspace lock: %w", err)
}
defer func() {
if releaseErr := runtime.artifactStore.ReleaseWorkspaceLock(lock); releaseErr != nil {
if resultErr == nil {
resultErr = fmt.Errorf("release session lock: %w", releaseErr)
resultErr = fmt.Errorf("release workspace lock: %w", releaseErr)
} else {
resultErr = errors.Join(resultErr, fmt.Errorf("release session lock: %w", releaseErr))
resultErr = errors.Join(resultErr, fmt.Errorf("release workspace lock: %w", releaseErr))
}
}
}()
if err := prepareInvocationLayout(runtime); err != nil {
return nil, err
}
defer func() {
if runtime.started {
result, resultErr = finalizeInvocation(runtime, resultErr)