WorkflowDispatch
A WorkflowDispatch watches succeeded WorkflowRuns and fans
out objects from a step’s JSON array output into parallel
WorkflowBacklogs, routing each item to a target
AgentSet without an external polling loop.
It pairs with WorkflowSchedule so a continuous planning or leadership loop can produce parallel work streams while kslip dispatches, deduplicates, bounds concurrency, and coordinates overlapping writes through PathLeases.
Fan out work from a WorkflowSchedule
Section titled “Fan out work from a WorkflowSchedule”The dispatch sample watches runs
owned by WorkflowSchedule/leadership-loop, reads workItems from the
architect step output, routes each item to the AgentSet named by
targetAgentSet (falling back to core-eng when a specialist team is absent or
has zero bound seats), deduplicates active work by issueNumber, and bounds
concurrent owned backlogs to 4:
kubectl --namespace team-a apply -f config/samples/workflowdispatch.yamlkubectl --namespace team-a get workflowdispatch leadership-fanout --watch| Field | Purpose |
|---|---|
source.scheduleName |
Selects WorkflowRuns controlled by the named WorkflowSchedule in the same namespace. Mutually exclusive with source.selector. |
source.selector |
Label selector matching source WorkflowRuns in the same namespace. Mutually exclusive with source.scheduleName. |
source.step |
Step name in the source WorkflowRun whose JSON output holds the item array. |
source.itemsField |
Top-level JSON array key inside source.step’s output. |
defaultAgentSet |
Default AgentSet in the same namespace. |
agentSetField |
Optional item field selecting a specialist AgentSet in the same namespace. |
fallbackToDefaultAgentSet |
When true (default), routes to defaultAgentSet if the requested specialist AgentSet is missing or has zero bound seats. When false, skips the item. |
dedupeKeyField |
Optional item field used to skip spawning duplicate active WorkflowBacklogs carrying the same key. |
itemNameField |
Optional item field used to derive each spawned WorkflowBacklogItem name. |
recipe |
Reference to an immutable recipe ConfigMap (name, key). |
inputs |
Static base recipe inputs merged with inputMappings. |
inputMappings |
Maps recipe input parameter names to top-level item JSON field names (up to 16 combined inputs). |
scope |
Optional non-Git PathLease scope passed to spawned backlogs. Mutually exclusive with repository. |
repository, targetBranch, gitCredentialsSecretRef |
Optional Git repository target passed to spawned backlogs. Mutually exclusive with scope. |
repairAttempts |
Repair retry budget (0 to 3) passed to each spawned WorkflowBacklogItem. |
backlogTimeoutSeconds |
Timeout in seconds for each spawned WorkflowBacklog (defaults to 3600). |
maxConcurrent |
Maximum active owned WorkflowBacklogs at once (defaults to 4, max 32). |
maxItemsPerRun |
Maximum items fanned out from one source WorkflowRun (defaults to 8, max 16). |
historyLimit |
Number of finished owned WorkflowBacklogs retained before pruning older ones (defaults to 20, max 50). |
suspend |
Set true to pause dispatching new backlogs while active ones continue. |
Status and events
Section titled “Status and events”status reports observedGeneration, activeBacklogs, dispatchedRuns,
dispatchedItems, bounded processedRunUIDs, lastSourceRun, and the Ready
condition (Watching, AtCapacity, Suspended, or InvalidDispatch). kslip
emits Kubernetes Events on BacklogDispatched, ItemSkipped, and
SourceProcessed.