Fall back to default output when WithOutputFrom is called with no agents - #1062
PratikDhanave (PratikDhanave) wants to merge 1 commit into
Conversation
outputDesignations.explicit() returned d != nil, but withOutputFrom allocates a non-nil map even for zero agents. So WithOutputFrom() / WithIntermediateOutputFrom() called with no agents (e.g. spreading an empty slice) made the designation set non-nil-but-empty: explicit() reported true, applyDefaults() was skipped, and the designation loop registered nothing - producing a workflow with zero output executors that runs but yields nothing (only a dead-end WARN). Affects the concurrent, sequential, and group-chat builders via the shared path. Treat an empty designation set as non-explicit so the default terminal output still applies.
There was a problem hiding this comment.
🟢 Approval recommended
The fix is covered by regression testing and no unresolved issues were identified.
Pull request overview
Updates output designation handling so empty WithOutputFrom calls retain default workflow outputs.
Changes:
- Treat empty designation maps as non-explicit.
- Add regression coverage for concurrent workflows.
File summaries
| File | Summary |
|---|---|
workflow/agentworkflow/concurrent_test.go |
Verifies default output remains enabled. |
workflow/agentworkflow/builders.go |
Corrects explicit designation detection. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Scope: internal-only (bug fix in unexported helper; no exported API surface changed) Changed Go contract: None. Upstream evidence reviewed:
Result: aligned (with a minor note for maintainers). The Go fix's chosen behavior — silently falling back to the default terminal output when This is a straightforward, well-tested (
|
Problem
outputDesignations.explicit()returnedd != nil, butwithOutputFromallocates a non-nil map even for zero agents:So
WithOutputFrom()/WithIntermediateOutputFrom()called with no agents — e.g. spreading a computed slicebuilder.WithOutputFrom(outs...)that happens to be empty — makes the designation set non-nil-but-empty.explicit()then reportstrue, soapplyDefaults()(which designates the concurrent end / sequential output / group-chat host as the terminal output) is skipped, and the designation loop registers nothing. The built workflow has zero output executors: it runs but yields no result (only adead-end executors detectedWARN, no error). This affects the concurrent, sequential, and group-chat builders via the shared path.Fix
Treat an empty designation set as non-explicit (
len(d) != 0), so an emptyWithOutputFrom()falls back to the default terminal output instead of silently disabling all output. A designation with ≥1 agent is unaffected.Test
TestConcurrentWorkflowBuilder_NoArgWithOutputFromFallsBackToDefaultbuilds a concurrent workflow with.WithOutputFrom()(no agents) and assertsOutputExecutorIDs()is non-empty. Fails before the fix (zero outputs), passes after.