Workflow interp() regex does not match hyphens in step IDs — {{step-1.output}} fails to resolve
- Dominant language
- TypeScript
- Stars
- 72.7k
- Forks
- 8.6k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 83
Description
## Bug
The `interp()` function in `workflow-tools.js` uses a regex that doesn't match hyphens. Since step IDs are generated as `step-1`, `step-2`, etc., the template variable `{{step-1.output}}` is never resolved — the agent receives the literal string.
## Reproduction
1. Create a workflow with 2+ steps and `defaultAgentId` set
2. In step 2's `config.prompt`, reference `{{step-1.output}}`
3. Execute the workflow
4. Step 2 receives the literal text `{{step-1.output}}` instead of step 1's output
## Root Cause
File: `src/mcp-tools/workflow-tools.js` (also compiled in `dist/`)
```js
const interp = (text) => {
return text.replace(/\{\{\s*([a-zA-Z_][\w.]*)\s*\}\}/g, (_, key) => {
```
`[\w.]*` matches `[a-zA-Z0-9_.]` but NOT hyphens. The key `step-1.output` contains a hyphen, so the regex never matches it.
Note: the output IS correctly stored in `workflow.variables["step-1.output"]` after step 1 completes — the bug is purely in the interpolation regex.
## Fix
Change `[\w.]*` to `[\w.-]*` in the regex character class:
```js
return text.replace(/\{\{\s*([a-zA-Z_][\w.-]*)\s*\}\}/g, (_, key) => {
```
## Impact
Step-output chaining — a core workflow feature documented in ADR-095 as "step-output binding" — is silently broken for all workflows using the default `step-N` ID format. Variables without hyphens (e.g. `{{project}}`, `{{dashboard_url}}`) work fine.
## Environment
Reproduced with `@claude-flow/cli` via npx on macOS, Ruflo v3 workflow executor (G3).
Contributor guide
Research direction
Start in src/mcp-tools/workflow-tools.js at the interp() regex, then check the corresponding compiled file in dist/. Reproduce the two-step workflow using {{step-1.output}} and verify that step 2 receives step 1's output rather than the literal template text; ensure variables without hyphens still resolve.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100