Propagate cancellation and preserve resumable state

This commit is contained in:
2026-11-20 05:53:49 +00:00
parent a6c6f1e4ab
commit c7a5ff316d
21 changed files with 356 additions and 27 deletions

View File

@@ -88,6 +88,9 @@ func executePlanWithDependencies(ctx context.Context, cfg *config.Config, plan B
}
for index, selected := range runtime.stages {
if err := ctx.Err(); err != nil {
return nil, err
}
outcome, err := executeSelectedStage(runtime, selected)
result := &runtime.stageResults[index]
result.Attempted = outcome.executed
@@ -112,7 +115,7 @@ func executePlanWithDependencies(ctx context.Context, cfg *config.Config, plan B
return nil, err
}
}
return nil, nil
return nil, ctx.Err()
}
func stagesContainAny(stages []stage.Stage, names ...string) bool {
@@ -147,7 +150,9 @@ func persistSessionTerminalFailure(
sessionManifest.RecordFailure(at, operationErr.Error())
}
sessionErr := sessionStore.Save(ctx, sessionManifestPath, sessionManifest)
// Only terminal local persistence is detached; adapters and checkpoints keep
// the canceled operation context.
sessionErr := sessionStore.Save(context.WithoutCancel(ctx), sessionManifestPath, sessionManifest)
return errors.Join(
operationErr,
wrapTerminalPersistenceError("save terminal session manifest", sessionErr),