Relationships
#814 Resolve dynamic workflow task targets inside forEach
Opened by evrardjp · 6/25/2026· Shipped 6/25/2026
Problem
A capability planner can produce ordered waves of workflow invocations as Swamp data. A child workflow can iterate a wave with forEach and pass resolved item fields into task inputs, but the workflow task target itself is not resolved when it is expressed from the forEach item.
Example child workflow step:
- name: apply-${{ self.item.host }}-${{ self.item.capability }}
forEach:
item: item
in: ${{ inputs.items }}
task:
type: workflow
workflowIdOrName: ${{ self.item.implementation.workflowIdOrName }}
inputs:
host: ${{ self.item.host }}
capability: ${{ self.item.capability }}
vm: ${{ self.item.vm }}The evaluator resolves task inputs such as host, capability, and vm, but leaves task.workflowIdOrName as the literal expression. It also partially resolves the step name (apply-bao-${{ self.item.capability }}), suggesting dynamic workflow task target/name expression handling is incomplete compared with dynamic model targeting.
Desired behavior
For workflow tasks in forEach, resolve workflowIdOrName from the current item the same way task inputs resolve. This enables a planner model to emit dependency waves whose items each select a workflow implementation.
Use case
A Swamp capability catalog/planner model emits data like:
{
"waves": [
{
"name": "wave-0",
"items": [
{
"host": "gitea",
"capability": "ssh",
"implementation": {
"type": "workflow",
"workflowIdOrName": "lab-capability-ssh"
}
}
]
}
]
}A parent workflow iterates waves sequentially and a child workflow iterates items in a wave in parallel. Without dynamic workflow target resolution, the workflow cannot execute planner-selected workflow implementations without hardcoding capability names.
Reproduction
- Create a workflow with the step above.
- Run
swamp workflow evaluate <workflow> --input-file wave0.json --json. - Observe that inputs resolve but
task.workflowIdOrNameremains${{ self.item.implementation.workflowIdOrName }}.
Expected
The evaluated step should contain:
task:
type: workflow
workflowIdOrName: lab-capability-sshEnvironment
Observed with Swamp CLI version shown by auto-update logs: 20260624.192904.0-sha.e86b32ec.
Shipped
Click a lifecycle step above to view its details.