Set default max to 1 for assign-to-agent safe-output#14867
Conversation
…utputs Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds a default max value of 1 to the assign-to-agent safe-output, ensuring consistent behavior with dispatch-workflow and preventing unlimited operations when max is not explicitly configured. The fix is implemented at both the parser level (when reading YAML configuration) and the config generation level (when generating runtime configuration).
Changes:
- Added default max=1 logic in the parser (
parseAssignToAgentConfig) when parsing workflows - Modified config generation helper to accept and apply a
defaultMaxparameter, consistent with other safe-output helpers - Added comprehensive test coverage for both default and explicit max behavior for both
assign-to-agentanddispatch-workflow
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/workflow/assign_to_agent.go | Sets default max=1 in parser when config.Max is 0 |
| pkg/workflow/safe_outputs_config_generation_helpers.go | Added defaultMax parameter to generateAssignToAgentConfig and applies default when max=0 |
| pkg/workflow/safe_outputs_config_generation.go | Passes default max value of 1 when calling generateAssignToAgentConfig |
| pkg/workflow/safe_outputs_default_max_test.go | New test file with comprehensive coverage for default and explicit max behavior for both safe-output types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -32,7 +32,12 @@ func (c *Compiler) parseAssignToAgentConfig(outputMap map[string]any) *AssignToA | |||
| return &AssignToAgentConfig{} | |||
There was a problem hiding this comment.
The error handling path returns an empty AssignToAgentConfig without setting Max to the default value of 1. While the config generation layer will apply the default later, it would be more consistent with other parsers like assign-to-user (line 31-33 in assign_to_user.go) to set the default in the error case as well. Consider: return &AssignToAgentConfig{BaseSafeOutputConfig: BaseSafeOutputConfig{Max: 1}}
See below for a potential fix:
// Handle null case: create config with default max
return &AssignToAgentConfig{
BaseSafeOutputConfig: BaseSafeOutputConfig{
Max: 1,
},
}
The
assign-to-agentsafe-output was missing a default max value, allowing unlimited operations when not explicitly configured. Thedispatch-workflowsafe-output already had the correct default.Changes
max: 1inparseAssignToAgentConfigwhen value is 0generateAssignToAgentConfigto accept and applydefaultMaxparameter, consistent with other safe-output helpersBehavior
Before:
After:
Explicit max values continue to override the default as expected.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.