-
Notifications
You must be signed in to change notification settings - Fork 259
Add max-continuations field to agentic engine configuration #18368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7e66032
118f3de
407ca26
856778c
f11654b
dc3868f
13081f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| // | ||
| // - validateAgentFile() - Validates custom agent file exists | ||
| // - validateMaxTurnsSupport() - Validates max-turns feature support | ||
| // - validateMaxContinuationsSupport() - Validates max-continuations feature support | ||
| // - validateWebSearchSupport() - Validates web-search feature support (warning) | ||
| // - validateWorkflowRunBranches() - Validates workflow_run has branch restrictions | ||
| // | ||
|
|
@@ -122,6 +123,24 @@ func (c *Compiler) validateMaxTurnsSupport(frontmatter map[string]any, engine Co | |
| return nil | ||
| } | ||
|
|
||
| // validateMaxContinuationsSupport validates that max-continuations is only used with engines that support this feature | ||
| func (c *Compiler) validateMaxContinuationsSupport(frontmatter map[string]any, engine CodingAgentEngine) error { | ||
| // Check if max-continuations is specified in the engine config | ||
| _, engineConfig := c.ExtractEngineConfig(frontmatter) | ||
|
|
||
| if engineConfig == nil || engineConfig.MaxContinuations == 0 { | ||
| // No max-continuations specified, no validation needed | ||
| return nil | ||
| } | ||
|
Comment on lines
+126
to
+134
|
||
|
|
||
| // max-continuations is specified, check if the engine supports it | ||
| if !engine.SupportsMaxContinuations() { | ||
| return fmt.Errorf("max-continuations not supported: engine '%s' does not support the max-continuations feature", engine.GetID()) | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| // validateWebSearchSupport validates that web-search tool is only used with engines that support this feature | ||
| func (c *Compiler) validateWebSearchSupport(tools map[string]any, engine CodingAgentEngine) { | ||
| // Check if web-search tool is requested | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The validation pattern here mirrors |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,15 @@ func (e *CopilotEngine) GetExecutionSteps(workflowData *WorkflowData, logFile st | |
| copilotArgs = append(copilotArgs, "--agent", agentIdentifier) | ||
| } | ||
|
|
||
| // Add --autopilot and --max-autopilot-continues when max-continuations > 1 | ||
| // Never apply autopilot flags to detection jobs; they are only meaningful for the agent run. | ||
| isDetectionJob := workflowData.SafeOutputs == nil | ||
| if !isDetectionJob && workflowData.EngineConfig != nil && workflowData.EngineConfig.MaxContinuations > 1 { | ||
| maxCont := workflowData.EngineConfig.MaxContinuations | ||
|
Comment on lines
+89
to
+93
|
||
| copilotExecLog.Printf("Enabling autopilot mode with max-autopilot-continues=%d", maxCont) | ||
| copilotArgs = append(copilotArgs, "--autopilot", "--max-autopilot-continues", strconv.Itoa(maxCont)) | ||
| } | ||
|
|
||
| // Add tool permission arguments based on configuration | ||
| toolArgs := e.computeCopilotToolArguments(workflowData.Tools, workflowData.SafeOutputs, workflowData.SafeInputs, workflowData) | ||
| if len(toolArgs) > 0 { | ||
|
|
@@ -144,7 +153,6 @@ func (e *CopilotEngine) GetExecutionSteps(workflowData *WorkflowData, logFile st | |
| // Copilot CLI reads it natively - no --model flag in the shell command needed. | ||
| needsModelFlag := !modelConfigured | ||
| // Check if this is a detection job (has no SafeOutputs config) | ||
| isDetectionJob := workflowData.SafeOutputs == nil | ||
| var modelEnvVar string | ||
| if isDetectionJob { | ||
| modelEnvVar = constants.EnvVarModelDetectionCopilot | ||
|
|
@@ -303,7 +311,6 @@ COPILOT_CLI_INSTRUCTION="$(cat /tmp/gh-aw/aw-prompts/prompt.txt)" | |
| env[constants.CopilotCLIModelEnvVar] = workflowData.EngineConfig.Model | ||
| } else { | ||
| // No model configured - use fallback GitHub variable with shell expansion | ||
| isDetectionJob := workflowData.SafeOutputs == nil | ||
| if isDetectionJob { | ||
| env[constants.EnvVarModelDetectionCopilot] = fmt.Sprintf("${{ vars.%s || '' }}", constants.EnvVarModelDetectionCopilot) | ||
| } else { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,18 +13,19 @@ var engineLog = logger.New("workflow:engine") | |
|
|
||
| // EngineConfig represents the parsed engine configuration | ||
| type EngineConfig struct { | ||
| ID string | ||
| Version string | ||
| Model string | ||
| MaxTurns string | ||
| Concurrency string // Agent job-level concurrency configuration (YAML format) | ||
| UserAgent string | ||
| Command string // Custom executable path (when set, skip installation steps) | ||
| Env map[string]string | ||
| Config string | ||
| Args []string | ||
| Firewall *FirewallConfig // AWF firewall configuration | ||
| Agent string // Agent identifier for copilot --agent flag (copilot engine only) | ||
| ID string | ||
| Version string | ||
| Model string | ||
| MaxTurns string | ||
| MaxContinuations int // Maximum number of continuations for autopilot mode (copilot engine only; > 1 enables --autopilot) | ||
| Concurrency string // Agent job-level concurrency configuration (YAML format) | ||
| UserAgent string | ||
| Command string // Custom executable path (when set, skip installation steps) | ||
| Env map[string]string | ||
| Config string | ||
| Args []string | ||
| Firewall *FirewallConfig // AWF firewall configuration | ||
| Agent string // Agent identifier for copilot --agent flag (copilot engine only) | ||
| } | ||
|
|
||
| // NetworkPermissions represents network access permissions for workflow execution | ||
|
|
@@ -116,6 +117,19 @@ func (c *Compiler) ExtractEngineConfig(frontmatter map[string]any) (string, *Eng | |
| } | ||
| } | ||
|
|
||
| // Extract optional 'max-continuations' field | ||
| if maxCont, hasMaxCont := engineObj["max-continuations"]; hasMaxCont { | ||
| if maxContInt, ok := maxCont.(int); ok { | ||
| config.MaxContinuations = maxContInt | ||
| } else if maxContUint64, ok := maxCont.(uint64); ok { | ||
| config.MaxContinuations = int(maxContUint64) | ||
|
Comment on lines
+121
to
+125
|
||
| } else if maxContStr, ok := maxCont.(string); ok { | ||
| if parsed, err := strconv.Atoi(maxContStr); err == nil { | ||
| config.MaxContinuations = parsed | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Extract optional 'concurrency' field (string or object format) | ||
| if concurrency, hasConcurrency := engineObj["concurrency"]; hasConcurrency { | ||
| if concurrencyStr, ok := concurrency.(string); ok { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Test file for PR push - Run 22406871179 |
Uh oh!
There was an error while loading. Please reload this page.