Merge branch 'main' into resource-pool-runner-handoff

This commit is contained in:
2026-10-18 23:20:55 +01:00
31 changed files with 403 additions and 1024 deletions
+21 -3
View File
@@ -519,11 +519,13 @@ func (r *runner) retrySourceCheckpointSelected(sourceID int64, pinned *protocol.
if failed.Input == nil {
return retryCheckpoint{}, fmt.Errorf("retry source %d is missing failed-stage handoff context", sourceID)
}
selectedInput, err := retryInputOverride(failed.Input, override)
if err != nil {
if _, err := retryInputOverride(failed.Input, override); err != nil {
return retryCheckpoint{}, err
}
handoff = map[string]any{"input": selectedInput, "sequence": failed.Sequence, "stage": failed.Stage, "visit": failed.Sequence}
// Keep the source-stage input immutable in the checkpoint. The selected
// stage's memory bindings must be resolved from the original prefix before
// this override is applied at invocation time.
handoff = map[string]any{"input": failed.Input, "override": override, "sequence": failed.Sequence, "stage": failed.Stage, "visit": failed.Sequence}
prefix := map[string]any{}
for _, step := range source.Steps {
if step.Sequence >= failed.Sequence || step.Status != "completed" {
@@ -774,6 +776,9 @@ func (r *runner) run(ctx context.Context, id int64, d *protocol.PipelineDetail,
return
}
state := rebuildRetryState(source, checkpoint.failed)
if override, ok := storedHandoff["override"].(map[string]any); ok {
state.retryOverride = stage.Values(override)
}
r.runLoop(ctx, id, d.Graph, d.Name, workspace, request, state)
return
}
@@ -852,6 +857,9 @@ type runState struct {
// running total without re-reading the store.
completed int
artifactDirs []string
// retryOverride is applied once, after the selected stage's memory bindings
// have been resolved. It is intentionally not part of run input or memory.
retryOverride stage.Values
}
func newRunState(key string, input stage.Values) *runState {
@@ -1274,6 +1282,16 @@ func (r *runner) runLoop(ctx context.Context, id int64, graph protocol.Graph, na
finish("failed", "error", copyErr.Error())
return
}
if state.retryOverride != nil {
input, copyErr = retryInputOverride(input, state.retryOverride)
if copyErr != nil {
finish("failed", "error", copyErr.Error())
return
}
// A selected-stage override belongs only to this invocation, not to
// a later visit reached through the stage graph.
state.retryOverride = nil
}
if err := r.store.BeginStep(ctx, id, sequence, key, input); err != nil {
if ctx.Err() != nil {
finish("canceled", "", ctx.Err().Error())