diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index 5bed71434..7c8de19c7 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -1686,6 +1686,9 @@ func (d *Daemon) process(ctx context.Context, task *workflow.Task, hold *taskHol // A task off the NATS stream only has an id once the store has claimed its // row, inside this call, so its capacity is named here. hold.name(task.ID, task.Attempt) + // The log opens before any check that can park, so every park reason + // reaches the attempt log. + defer d.openTaskLog(task)() // The workflow may name the identity the run acts as, which everything // below is chosen by, so it is settled before anything else. if !d.adoptWorkflowIdentity(ctx, task) { @@ -1694,7 +1697,6 @@ func (d *Daemon) process(ctx context.Context, task *workflow.Task, hold *taskHol // Register first so the task can be stopped during setup. ctx, finished := d.running.begin(ctx, task.ID, task.Identity) defer finished() - defer d.openTaskLog(task)() if d.parkIfIdentityUnresolvable(ctx, task) { return