Make default output paths unique and authoritative across all run modes#227
Open
smithyyang wants to merge 9 commits into
Open
Make default output paths unique and authoritative across all run modes#227smithyyang wants to merge 9 commits into
smithyyang wants to merge 9 commits into
Conversation
When no explicit `output` is passed in the subagent call and the output comes from the agent config default (e.g. `output: /tmp/research.md`), the framework now appends `_<runId>_<index>` to prevent collisions in parallel execution and avoid hardcoded-path confusion. - Foreground single: suffix added when `params.output` is undefined - Foreground parallel: suffix added per task when no task-level override - Async single + async chain: same logic - Progress tracks alongside output in the same directory Progress path is `.progress_<runId>/progress.md` (same directory); a follow-up could use `progress_<runId>.md` for consistency. Related: nicobailon#220, nicobailon#223, nicobailon#224
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes several output-path and UI issues across foreground, async, parallel, and chain subagent execution paths.
It makes runtime output paths authoritative and unique when they come from agent defaults, while preserving exact user-specified output paths.
Fixes
1. Prevent output collisions for default agent outputs
When an agent default output path is used, the runtime now appends a unique suffix:
This prevents multiple subagents from writing to the same file in parallel/chain runs.
Covered paths:
Explicit user output paths remain exact and are not modified:
2. Fix async parallel index collision
Previously, async parallel default outputs all used index
0, causing two researchers to write to the same file:This PR passes the real flat step index, producing:
3. Fix async single default-output suffixing
Async single runs pre-normalized the output before calling
executeAsyncSingle, so the lower layer could not tell whether the path came from an agent default or an explicit user override.This PR adds an
outputFromAgentDefaultflag so async single can suffix default outputs correctly without changing explicit outputs.4. Make runtime output paths authoritative in prompts
Agent prompts may mention static filenames such as
research.md,context.md, orplan.md. Runtime-generated paths must override these static filenames.This PR strengthens task output instructions from:
to:
It also injects the same runtime output override into the child system prompt, so the system prompt and task prompt agree on the authoritative output path.
5. Disable default progress files for built-in writer agents
The built-in
researcher,scout, andworkeragents now set:This avoids automatic progress file creation unless the caller explicitly asks for progress.
6. Disable chain clarify UI by default
Sequential foreground chains previously opened the clarify UI by default. This PR changes chain clarify behavior so the UI only opens when explicitly requested:
clarify: trueDefault behavior now matches single/parallel runs: execute directly unless clarify is requested.
7. Show model badge in compact multi-result view
Compact multi-result rendering now includes the model/thinking badge for each result row.
Validation
Manual validation performed locally:
/tmp/research_<runId>_0.md/tmp/research_<runId>_1.md/tmp/research_<runId>_2.md_0.mdand_1.mdrespectively_0.md_0.md, and step 2 received_1.mdin its task instructionsrunSyncand async step constructionNotes
This PR intentionally preserves backwards compatibility:
outputpaths are used exactly as providedoutput: falsedisables outputoutput: truemeans “use the agent default” and receives the runtime suffix