fix(gateway): name a plan wait's workflow from its run, not the next one
workflow.approve pre-writes the task's workflow column with the workflow that runs once approved, so task_list named a workflow that had not started while the task's own log named the one that produced the plan. Chat now names the compiled workflow through the pinned definition for a plan wait, matching the log.
This commit is contained in:
5 files changed
+113
-20
No files matched your search
@@ -2127,7 +2127,7 @@ func (d *Daemon) pinWorkflowDefinition(ctx context.Context, task *workflow.Task)
|
||||
// pinDefinition keeps a valid pin and resolves a missing or mismatched one
|
||||
// again from the active definitions.
|
||||
func (d *Daemon) pinDefinition(ctx context.Context, task *workflow.Task) error {
|
||||
pinned, ok, err := pinnedDefinitionID(task)
|
||||
pinned, ok, err := workflow.PinnedDefinitionID(task)
|
||||
if err != nil {
|
||||
return pinFailure{taskstate.ParkNeedsDecision, err}
|
||||
}
|
||||
@@ -2185,22 +2185,6 @@ func parkBlocker(err error) taskstate.Blocker {
|
||||
return ""
|
||||
}
|
||||
|
||||
// pinnedDefinitionID returns the workflow id a task's pin declares, checking
|
||||
// its digest. ok is false when there is no pin.
|
||||
func pinnedDefinitionID(task *workflow.Task) (string, bool, error) {
|
||||
if task.WorkflowDefinitionYAML == "" {
|
||||
return "", false, nil
|
||||
}
|
||||
if workflow.DigestDefinition(task.WorkflowDefinitionYAML) != task.WorkflowDefinitionDigest {
|
||||
return "", false, fmt.Errorf("stored workflow definition digest mismatch")
|
||||
}
|
||||
id, err := workflow.DefinitionID(task.WorkflowDefinitionYAML)
|
||||
if err != nil {
|
||||
return "", false, fmt.Errorf("stored workflow definition: %w", err)
|
||||
}
|
||||
return id, true, nil
|
||||
}
|
||||
|
||||
// runActionPlaybooks runs the action playbooks matching a task before it is
|
||||
// pinned. Failures never fail the task; tasks already naming a workflow are
|
||||
// skipped.
|
||||
|
||||
Reference in new issue
Block a user