[bug] workflow.call is not idempotent: a retry starts a second child #1032

Closed
opened 2026-10-27 13:38:45 +00:00 by sam · 0 comments
Owner

runWorkflowCall (internal/domain/workflow/workflow_call.go) creates the callers child before recording the call step. Any retry of the same logical call - a lost EnqueueCallTask reply, a failed startCallStep, a requeued attempt that re-runs the stage - starts another child for one call site, so the childs work happens twice.

Design: give each logical call a durable identity and make creation create-or-return.
(a) The identity is the call steps declared path within the run (tc.stepPath, accumulated by wrapStep from each steps StageName), which is stable across retries of one call site. workflow.call steps must therefore declare an id; validation refuses one without (a call result is already unreferenceable without an id).
(b) The child stores that key as tasks.call_key with a unique index on (call_parent_task_id, call_key) where call_key <> . EnqueueCallTask becomes atomic create-or-return: ON CONFLICT (call_parent_task_id, call_key) DO UPDATE SET call_key = EXCLUDED.call_key RETURNING *.
(c) StartCall passes the key: task.Caller, the state RPC EnqueueCallTaskRequest, and the store.
(d) The call step records the key as its name, so the dashboard names the call site.

Acceptance: a store test proves two EnqueueCallTask calls with one key return one task id; a workflow test proves two runs of the same call step start one child.

Notes

Fixed in 0038_workflow_call_key; verified in HEAD 5124bfd4. Closing as already shipped.

Close reason

Closed


Imported from beads archie-core-32ae · GitHub #1521 · type bug · priority P1 · created 2026-10-08 · closed 2026-10-10

runWorkflowCall (internal/domain/workflow/workflow_call.go) creates the callers child before recording the call step. Any retry of the same logical call - a lost EnqueueCallTask reply, a failed startCallStep, a requeued attempt that re-runs the stage - starts another child for one call site, so the childs work happens twice. Design: give each logical call a durable identity and make creation create-or-return. (a) The identity is the call steps declared path within the run (tc.stepPath, accumulated by wrapStep from each steps StageName), which is stable across retries of one call site. workflow.call steps must therefore declare an id; validation refuses one without (a call result is already unreferenceable without an id). (b) The child stores that key as tasks.call_key with a unique index on (call_parent_task_id, call_key) where call_key <> . EnqueueCallTask becomes atomic create-or-return: ON CONFLICT (call_parent_task_id, call_key) DO UPDATE SET call_key = EXCLUDED.call_key RETURNING *. (c) StartCall passes the key: task.Caller, the state RPC EnqueueCallTaskRequest, and the store. (d) The call step records the key as its name, so the dashboard names the call site. Acceptance: a store test proves two EnqueueCallTask calls with one key return one task id; a workflow test proves two runs of the same call step start one child. ### Notes Fixed in 0038_workflow_call_key; verified in HEAD 5124bfd4. Closing as already shipped. ### Close reason Closed --- _Imported from beads `archie-core-32ae` · GitHub #1521 · type bug · priority P1 · created 2026-10-08 · closed 2026-10-10_
sam added the highbug labels 2026-10-27 13:38:45 +00:00
sam self-assigned this 2026-10-27 13:38:45 +00:00
sam closed this issue 2026-10-27 13:38:45 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1032