Propagate cancellation and preserve resumable state
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user