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.
20 lines
992 B
Go
20 lines
992 B
Go
package task
|
|
|
|
import "context"
|
|
|
|
// Caller starts a workflow.call callee and reads it back.
|
|
type Caller interface {
|
|
// StartCall enqueues the callee for callerTaskID's call step at depth + 1.
|
|
// callKey is the call site's durable identity -- the call step's declared
|
|
// path within the run, plus the workflow it starts -- and is required: the
|
|
// same caller and key return the child already started, so a retry of a
|
|
// call site starts one child.
|
|
// It fails if the caller is not running or the depth limit is exceeded.
|
|
StartCall(ctx context.Context, callerTaskID int64, callKey, workflow string, inputs map[string]any) (*Task, error)
|
|
// CallStatus reads one call's callee: its status, latest transition detail
|
|
// and written outputs. A store only answers for a task whose
|
|
// call_parent_task_id is callerTaskID, so a caller reads only its own
|
|
// callees.
|
|
CallStatus(ctx context.Context, callerTaskID, callTaskID int64) (status, detail string, outputs map[string]any, err error)
|
|
}
|