fix: commit run notification intents with state transitions

This commit is contained in:
2026-10-20 15:55:01 +01:00
parent a08789e071
commit 90cd43bdd7
7 changed files with 509 additions and 10 deletions
+8 -3
View File
@@ -1332,7 +1332,10 @@ func (r *runner) finishRunState(id int64, name, workspace, status, outcome, diag
CompletedSteps: completed,
FinishedAt: detail.FinishedAt,
}, true)
r.notifyRun(id, name, status, sequence, currentStage, diagnostic)
if status != protocol.RunStatusCanceled {
r.notifyTerminalStep(id, status)
}
r.deliverRunNotificationBatch(time.Now(), 1)
// The run is terminal: nothing more can notify for it.
r.forgetAttention(id)
r.forgetNotifyMode(id)
@@ -1422,9 +1425,11 @@ func (r *runner) finishStage(id int64, name, workspace string, selected protocol
}
state.memory[step.Stage] = memoryValue{output: values, sequence: step.Sequence}
}
r.notifyStep(id, name, workspace, selected.Notify, step)
state.input = stage.Values(step.Output)
status, outcome, diagnostic, terminal = terminalFinish(step.Target, step.Stage, step.Outcome, step.Diagnostic)
if !terminal {
r.notifyStep(id, name, workspace, selected.Notify, step)
}
return status, outcome, diagnostic, terminal, nil
}
@@ -1588,7 +1593,7 @@ func (r *runner) runLoop(ctx context.Context, id int64, graph protocol.Graph, na
Step: &protocol.RunStepDelta{Sequence: sequence, Stage: key, Status: protocol.StepStatusWaiting},
}, false)
r.notifyStep(id, name, workspace, selected.Notify, waitStep)
r.notifyRun(id, name, protocol.RunStatusWaiting, sequence, key, "")
r.deliverRunNotificationBatch(time.Now(), 1)
return
}
// A stage that declares a `skipped` route is short-circuited when the run