You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(subagent): enforce explicit summary output from subagents
When a subagent completes without providing a structured summary, the
executor now requests an additional turn specifically asking for a summary.
This ensures subagents always return properly formatted output for the
orchestrator to process.
The fix:
- Adds has_summary_output() function to detect summary markers in output
- Requests explicit summary turn if output doesn't contain summary markers
- Uses SUMMARY_REQUEST_PROMPT constant with structured format requirements
- Combines original response with summary in the final result
- Properly tracks token usage across both turns
This follows the Codex pattern of ensuring structured agent output and
resolves the issue where subagents would terminate without providing
feedback to the orchestrator.
/// Prompt used to request an explicit summary from a subagent when none was provided.
711
+
/// This follows the Codex pattern of ensuring structured output from agents.
712
+
constSUMMARY_REQUEST_PROMPT:&str = r#"You have completed your work but did not provide a summary. Please provide a final summary NOW using EXACTLY this format:
713
+
714
+
## Summary for Orchestrator
715
+
716
+
### Tasks Completed
717
+
- [List each task you completed with brief outcome]
718
+
719
+
### Key Findings/Changes
720
+
- [Main discoveries or modifications made]
721
+
722
+
### Files Modified (if any)
723
+
- [List of files with type of change]
724
+
725
+
### Recommendations (if applicable)
726
+
- [Any follow-up actions or suggestions]
727
+
728
+
### Status: COMPLETED
729
+
730
+
DO NOT use any tools. Just provide the summary based on the work you have already done."#;
731
+
732
+
/// Check if the response contains a proper summary for the orchestrator.
733
+
/// Returns true if summary markers are present, false otherwise.
734
+
fnhas_summary_output(response:&str) -> bool{
735
+
// Empty responses definitely don't have a summary
736
+
if response.trim().is_empty(){
737
+
returnfalse;
738
+
}
739
+
740
+
// Check for key summary markers that indicate structured output
0 commit comments