Problem
Workspace configuration is resolved at pipeline parse time, before any steps execute. This means workspace fields like branch: can only use static values or pipeline-level template variables ({{ pipeline_id }}), not outputs from prior steps.
This forces patterns like:
- Create a throwaway worktree on
{{ pipeline_id }}
- Inside the step prompt,
git fetch && git checkout the real branch
- The worktree creation was wasted work
This matters most for cross-pipeline workflows like ops-pr-rework, where the target branch name comes from a prior step's output (the PR's headRefName).
Proposed Solution
Support step output references in workspace config:
steps:
- id: fetch-review
# ... produces artifact with head_branch field
- id: apply-fixes
dependencies: [fetch-review]
workspace:
type: worktree
branch: "{{ steps.fetch-review.artifacts.review-findings.head_branch }}"
The workspace for apply-fixes is created after fetch-review completes, using the resolved value from its output artifact.
Implementation
Deferred resolution in executor
In internal/pipeline/executor.go, the workspace creation path currently runs before step execution. Change to:
- At step start, check if workspace config contains
{{ steps.* }} references
- If yes, resolve the references from prior step artifacts (already available in
.wave/artifacts/)
- Then create the workspace with the resolved config
This is a narrow change — only the workspace creation path needs to defer, not the full config resolution.
Template syntax
Reuse the existing template variable system. Add a steps namespace:
{{ steps.<step-id>.artifacts.<artifact-name>.<json-path> }} — read a field from a prior step's JSON artifact
{{ steps.<step-id>.output.<field> }} — read from step outcome metadata
Fallback
If the referenced step hasn't completed or the artifact doesn't exist, fail with a clear error rather than creating a broken workspace.
Acceptance Criteria
Problem
Workspace configuration is resolved at pipeline parse time, before any steps execute. This means workspace fields like
branch:can only use static values or pipeline-level template variables ({{ pipeline_id }}), not outputs from prior steps.This forces patterns like:
{{ pipeline_id }}git fetch && git checkoutthe real branchThis matters most for cross-pipeline workflows like
ops-pr-rework, where the target branch name comes from a prior step's output (the PR'sheadRefName).Proposed Solution
Support step output references in workspace config:
The workspace for
apply-fixesis created afterfetch-reviewcompletes, using the resolved value from its output artifact.Implementation
Deferred resolution in executor
In
internal/pipeline/executor.go, the workspace creation path currently runs before step execution. Change to:{{ steps.* }}references.wave/artifacts/)This is a narrow change — only the workspace creation path needs to defer, not the full config resolution.
Template syntax
Reuse the existing template variable system. Add a
stepsnamespace:{{ steps.<step-id>.artifacts.<artifact-name>.<json-path> }}— read a field from a prior step's JSON artifact{{ steps.<step-id>.output.<field> }}— read from step outcome metadataFallback
If the referenced step hasn't completed or the artifact doesn't exist, fail with a clear error rather than creating a broken workspace.
Acceptance Criteria
branch:field can reference prior step artifact valuesops-pr-reworkpipeline updated to use deferred branch resolution