Add max-continuations field to agentic engine configuration#18368
Add max-continuations field to agentic engine configuration#18368
Conversation
|
@copilot this flag does not apply to the detection copilot execution. The detection agentic execution should never use |
… support Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in 407ca26. The Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
Agent Container Tool Check
Result: 12/12 tools available ✅ Overall Status: PASS
|
|
Commit pushed:
|
|
🤖 Smoke test §22406871214 results for
Overall: PASS (11/12)
|
There was a problem hiding this comment.
This PR cleanly adds max-continuations support for the Copilot engine's autopilot mode. The implementation follows existing patterns (validateMaxTurnsSupport), schema changes are well-documented, and the smoke test usage provides live validation. LGTM!
📰 BREAKING: Report filed by Smoke Copilot
|
|
||
| // 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 |
There was a problem hiding this comment.
The validation pattern here mirrors validateMaxTurnsSupport nicely — good consistency. Worth noting the guard engineConfig.MaxContinuations == 0 correctly treats 0 as "not set" since minimum valid value is 1 per schema.
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
Smoke test results:
|
|
Commit pushed:
|
Smoke Test Results - Run 22406871179
Overall Status: PARTIAL (all non-skipped tests passed, #17 skipped by design)
|
There was a problem hiding this comment.
💥 Automated smoke test review - all systems nominal!
💥 [THE END] — Illustrated by Smoke Claude
|
Hey
|
There was a problem hiding this comment.
Pull request overview
Adds a max-continuations engine configuration field to enable Copilot CLI autopilot mode with a configurable continuation limit, plus validation and schema/docs updates.
Changes:
- Extend
EngineConfigparsing and workflow schema to acceptengine.max-continuations. - Add an engine capability flag (
SupportsMaxContinuations) and validation that rejects unsupported engines. - Apply Copilot CLI execution flags
--autopilot --max-autopilot-continues <n>for agent runs whenmax-continuations > 1.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| smoke-test-22406871179.txt | Adds a smoke-test marker file for the run. |
| pkg/workflow/engine.go | Adds MaxContinuations to EngineConfig and parses max-continuations from engine frontmatter. |
| pkg/workflow/agentic_engine.go | Adds SupportsMaxContinuations() capability and backing field on BaseEngine. |
| pkg/workflow/copilot_engine.go | Marks Copilot engine as supporting max-continuations. |
| pkg/workflow/copilot_engine_execution.go | Adds Copilot CLI autopilot flags for non-detection runs when MaxContinuations > 1. |
| pkg/workflow/agent_validation.go | Adds validation to error if max-continuations is used with an engine that doesn’t support it. |
| pkg/workflow/compiler_orchestrator_tools.go | Wires the new max-continuations validation into compilation. |
| pkg/parser/schemas/main_workflow_schema.json | Adds max-continuations to the engine_config schema and examples. |
| .github/workflows/smoke-copilot.md | Updates smoke workflow to use object-form engine config with max-continuations: 2. |
| .github/workflows/smoke-copilot.lock.yml | Updates generated lock output reflecting the new Copilot CLI flags. |
| .devcontainer/devcontainer.json | Reorders feature entries (no functional change). |
| .changeset/patch-max-continuations.md | Adds changeset entry documenting the new configuration option. |
Comments suppressed due to low confidence (1)
pkg/workflow/engine.go:126
- Casting
uint64tointformax-continuationscan overflow on 32-bit platforms (or with unexpectedly large values), potentially producing a negative continuation limit. Prefer an overflow-safe conversion (like the existingparseIntValue/ParseIntFromConfigwhich guard overflow) or add an explicit bounds check before converting.
} else if maxContUint64, ok := maxCont.(uint64); ok {
config.MaxContinuations = int(maxContUint64)
} else if maxContStr, ok := maxCont.(string); ok {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // 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 | ||
| } |
There was a problem hiding this comment.
There are existing integration tests for max-turns engine support validation (pkg/workflow/max_turns_validation_test.go), but no corresponding tests for the new max-continuations validation. Add coverage that asserts: (1) max-continuations errors on engines that don’t support it (e.g., claude/codex), and (2) it succeeds for copilot.
| // 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 |
There was a problem hiding this comment.
Add unit/integration coverage for the new autopilot argument behavior: when EngineConfig.MaxContinuations > 1 and this is an agent run (SafeOutputs != nil), the generated Copilot CLI command should include --autopilot --max-autopilot-continues <n>, and those flags should be absent for detection jobs (SafeOutputs == nil). There are already similar assertions in pkg/workflow/copilot_engine_test.go for other flags.
| 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) |
There was a problem hiding this comment.
max-continuations parsing only handles int, uint64, and numeric strings. When engine config comes from JSON (e.g., included engine config via extractEngineConfigFromJSON), numbers are decoded as float64, so max-continuations will be silently ignored and autopilot won’t be enabled. Consider using the existing int-conversion helpers (e.g., ConvertToInt / parseIntValue / ParseIntFromConfig) and/or handling float64/int64/json.Number explicitly; also emit a warning/error when the key is present but unparseable.
This issue also appears on line 124 of the same file.
See below for a potential fix:
switch v := maxTurns.(type) {
case int:
config.MaxTurns = strconv.Itoa(v)
case int64:
config.MaxTurns = strconv.FormatInt(v, 10)
case uint64:
config.MaxTurns = strconv.FormatUint(v, 10)
case float64:
// JSON numbers are decoded as float64; coerce to int64 for formatting.
config.MaxTurns = strconv.FormatInt(int64(v), 10)
case json.Number:
// Preserve the textual representation; assumed to be numeric.
config.MaxTurns = v.String()
case string:
config.MaxTurns = v
default:
engineLog.Printf("Unsupported type for 'max-turns': %T (value: %v); ignoring", v, v)
}
}
// Extract optional 'max-continuations' field
if maxCont, hasMaxCont := engineObj["max-continuations"]; hasMaxCont {
switch v := maxCont.(type) {
case int:
config.MaxContinuations = v
case int64:
config.MaxContinuations = int(v)
case uint64:
config.MaxContinuations = int(v)
case float64:
// JSON numbers are decoded as float64; coerce to int.
config.MaxContinuations = int(v)
case json.Number:
if parsed, err := strconv.Atoi(v.String()); err == nil {
config.MaxContinuations = parsed
} else {
engineLog.Printf("Invalid numeric value for 'max-continuations': %v; ignoring", v)
}
case string:
if parsed, err := strconv.Atoi(v); err == nil {
config.MaxContinuations = parsed
} else {
engineLog.Printf("Invalid string value for 'max-continuations': %q; ignoring", v)
}
default:
engineLog.Printf("Unsupported type for 'max-continuations': %T (value: %v); ignoring", v, v)
Adds a
max-continuationsfield to the agentic engine configuration, enabling autopilot mode with a configurable continuation limit for supported engines (currently Copilot only).Changes Made
engine.go: AddedMaxContinuations intfield toEngineConfigstruct with parsing for themax-continuationsfrontmatter fieldagentic_engine.go: AddedSupportsMaxContinuations() boolto theCapabilityProviderinterface andBaseEnginecopilot_engine.go: EnabledsupportsMaxContinuations: truecopilot_engine_execution.go: Applies--autopilot --max-autopilot-continues <n>flags whenMaxContinuations > 1; flags are skipped for detection jobs (SafeOutputs == nil) since autopilot mode is only meaningful for the agent executionagent_validation.go: AddedvalidateMaxContinuationsSupportvalidation that errors if the engine doesn't supportmax-continuationscompiler_orchestrator_tools.go: Calls the new validationmain_workflow_schema.json: Addedmax-continuationsfield to theengine_configschemasmoke-copilot.md: Setmax-continuations: 2as a real-world usage example💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Add max-continuations field to agentic engine configuration
Adds a
max-continuationsfield to the agentic engine configuration, enabling autopilot mode with a configurable continuation limit for supported engines (currently Copilot only).Changes Made
engine.go: AddedMaxContinuations intfield toEngineConfigstruct with parsing for themax-continuationsfrontmatter fieldagentic_engine.go: AddedSupportsMaxContinuations() boolto theCapabilityProviderinterface andBaseEnginecopilot_engine.go: EnabledsupportsMaxContinuations: truecopilot_engine_execution.go: Applies--autopilot --max-autopilot-continues (n)flags whenMaxContinuations > 1; flags are skipped for detection jobs (SafeOutputs == nil) since autopilot mode is only meaningful for the agent executionagent_validation.go: AddedvalidateMaxContinuationsSupportvalidation that errors if the engine doesn't supportmax-continuationscompiler_orchestrator_tools.go: Calls the new validationmain_workflow_schema.json: Addedmax-continuationsfield to theengine_configschemasmoke-copilot.md: Setmax-continuations: 2as a real-world usage example💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey]((gh.io/redacted)
Changeset
max-continuationslimit when using Copilot so autopilot stops after a predictable number of iterations.Warning
The following domain was blocked by the firewall during workflow execution:
github.com✨ PR Review Safe Output Test - Run 22406871179