fix(workflow): key a call on its callee, and free a terminal child's key
A call's key was the step's declared path alone, so one task running a second definition at a colliding path -- workflow.handoff, human.approve and a definition re-pin all change it -- was handed the first callee's child, waited on the wrong workflow and published its outputs. The key now carries the callee too, while the step row and the call's events stay named and staged for the call site, so a rail pairing an event with its step still attaches them. A child that reached dead or closed_wont_do can never do the work and holds no result the caller can use, so it leaves the call key's index and frees the key for the caller's retry to start a fresh child. parked and rejected keep theirs: a parked child is recoverable by retrying it, and a rejected child ran. The id a call step must declare is now refused where the definition is compiled, which is also the path a pinned definition takes, so an id that spells a step type is accepted again and no stage needs a heuristic.
This commit is contained in:
1 parent
0101947131
commit
703aea4568
13 files changed
+302
-109
No files matched your search
@@ -41,7 +41,7 @@ SELECT
|
||||
caller.id, caller.call_depth + 1, $7
|
||||
FROM caller
|
||||
WHERE caller.status = 'running' AND caller.call_depth + 1 <= $8::int
|
||||
ON CONFLICT (call_parent_task_id, call_key) WHERE call_key <> '' DO UPDATE SET call_key = EXCLUDED.call_key
|
||||
ON CONFLICT (call_parent_task_id, call_key) WHERE call_key <> '' AND status NOT IN ('dead', 'closed_wont_do') DO UPDATE SET call_key = EXCLUDED.call_key
|
||||
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key
|
||||
`
|
||||
|
||||
@@ -60,9 +60,11 @@ type EnqueueCallTaskParams struct {
|
||||
//
|
||||
// The call key makes this the one write that can be retried: a call site that
|
||||
// already started its child gets that child back rather than a second one. The
|
||||
// upsert only fires for a keyed callee, and the WHERE below still decides
|
||||
// whether the caller may call at all -- a caller that is missing, not running
|
||||
// or past the depth limit inserts nothing and returns no row, conflict or not.
|
||||
// upsert only fires for a keyed callee whose child can still do the work -- a
|
||||
// child that ended dead or closed_wont_do freed its key -- and the WHERE below
|
||||
// still decides whether the caller may call at all: a caller that is missing,
|
||||
// not running or past the depth limit inserts nothing and returns no row,
|
||||
// conflict or not.
|
||||
func (q *Queries) EnqueueCallTask(ctx context.Context, arg EnqueueCallTaskParams) (Task, error) {
|
||||
row := q.db.QueryRow(ctx, enqueueCallTask,
|
||||
arg.ID,
|
||||
|
||||
Reference in new issue
Block a user