Skip to content

feat: map engine max-turns and timeout-minutes to Copilot CLI arguments#134

Merged
jamesadevine merged 5 commits intomainfrom
copilot/add-max-turns-argument
Apr 7, 2026
Merged

feat: map engine max-turns and timeout-minutes to Copilot CLI arguments#134
jamesadevine merged 5 commits intomainfrom
copilot/add-max-turns-argument

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

engine: max-turns: and engine: timeout-minutes: were parsed and stored in EngineConfig but never forwarded to the Copilot CLI, unlike gh-aw which maps them to --max-turns <value> and --max-timeout <value>.

  • Added --max-turns {n} to generate_copilot_params() when set
  • Added --max-timeout {n} to generate_copilot_params() when set
  • Added compile-time warnings when max-turns: 0 or timeout-minutes: 0 are set, following the existing eprintln! warning pattern
  • Added tests for both presence (object engine config) and absence (simple string config) for each flag, plus zero-value tests
  • Documented the Engine Configuration section in AGENTS.md, including a field reference table and dedicated subsections explaining max-turns and timeout-minutes
  • Updated the {{ agency_params }} section in AGENTS.md to list both --max-turns and --max-timeout
  • Used "copilot params" terminology in new docs to align with the direction of rename agency_paramscopilot_params, remove built-in MCP spawning, and update docs #135
engine:
  model: claude-opus-4.5
  max-turns: 50
  timeout-minutes: 30

Now produces --max-turns 50 --max-timeout 30 in the generated pipeline's copilot params.

Copilot AI changed the title [WIP] Add max-turns argument to maps engine feat: map engine max-turns to --max-turns Copilot CLI argument Apr 7, 2026
Copilot AI requested a review from jamesadevine April 7, 2026 14:14
@jamesadevine
Copy link
Copy Markdown
Collaborator

@copilot document the role of max turns in agents.md

Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/8c7be6ee-473d-4cde-96ca-67ec8b8ca65c

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 7, 2026

@copilot document the role of max turns in agents.md

Added an "Engine Configuration" section to AGENTS.md documenting max-turns (and the other engine fields), including a field reference table and a dedicated subsection explaining what turns are and why you'd cap them. Also updated the {{ agency_params }} section to list --max-turns. See 2b3249c.

@jamesadevine
Copy link
Copy Markdown
Collaborator

@copilot can we add and document --max-timeout too? Reference GH-aw as before.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 7, 2026

@copilot can we add and document --max-timeout too? Reference GH-aw as before.

Added --max-timeout support: engine.timeout-minutes is now forwarded as --max-timeout <value> in generate_copilot_params(). Also added a timeout-minutes subsection in the Engine Configuration docs and updated the {{ agency_params }} section. Tests for both presence and absence included. See 3592323.

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:

  • deepwiki.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • github.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title feat: map engine max-turns to --max-turns Copilot CLI argument feat: map engine max-turns and timeout-minutes to Copilot CLI arguments Apr 7, 2026
@jamesadevine jamesadevine marked this pull request as ready for review April 7, 2026 14:59
@jamesadevine
Copy link
Copy Markdown
Collaborator

/rust-review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Rust PR Reviewer completed successfully!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

🔍 Rust PR Review

Summary: Looks good — clean, correct implementation with solid test coverage.

Findings

✅ What Looks Good

  • Type safety: max_turns and timeout_minutes are Option(u32), so there's zero injection risk when formatting into CLI args — the values are always numeric.
  • Ordering: The new flags are inserted immediately after --model and before --disable-builtin-mcps, which is a logical grouping (session/model config first, then policy flags).
  • Test coverage: All four cases are covered — presence and absence for both flags, using both the object engine format and the simple string format via minimal_front_matter().
  • Non-breaking: The simple string engine format (engine: claude-opus-4.5) correctly returns None from both accessors, so existing pipelines are unaffected.

⚠️ Suggestions

  • src/compile/common.rs:313-318 — No validation that max_turns > 0 or timeout_minutes > 0. A user setting max-turns: 0 will emit --max-turns 0, which could silently mean "zero turns allowed" and cause confusing pipeline behavior. Consider either clamping to a minimum of 1 at compile time or emitting a warning. This is low priority since u32 makes it an explicit opt-in to zero, but worth a follow-up.

  • AGENTS.md (new sections) — The closing sentences of both max-turns and timeout-minutes sections still say "in the generated pipeline's agency params". Given PR rename agency_paramscopilot_params, remove built-in MCP spawning, and update docs #135 is in flight to remove all agency terminology, these new docs will immediately need updating. Consider using "copilot params" here to stay consistent with the direction of the project.

Generated by Rust PR Reviewer for issue #134 ·

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • dev.azure.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "dev.azure.com"

See Network Configuration for more information.

@jamesadevine
Copy link
Copy Markdown
Collaborator

@copilot

src/compile/common.rs:313-318 — No validation that max_turns > 0 or timeout_minutes > 0. A user setting max-turns: 0 will emit --max-turns 0, which could silently mean "zero turns allowed" and cause confusing pipeline behavior. Consider either clamping to a minimum of 1 at compile time or emitting a warning. This is low priority since u32 makes it an explicit opt-in to zero, but worth a follow-up.

AGENTS.md (new sections) — The closing sentences of both max-turns and timeout-minutes sections still say "in the generated pipeline's agency params". Given PR [WIP] Remove agency references and update agency_params to copilot_params #135 is in flight to remove all agency terminology, these new docs will immediately need updating. Consider using "copilot params" here to stay consistent with the direction of the project.

…pilot params terminology

Agent-Logs-Url: https://github.com/githubnext/ado-aw/sessions/8826b5cb-7d91-4b7b-9e18-6b5f9e1d02f7

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 7, 2026

@copilot

src/compile/common.rs:313-318 — No validation that max_turns > 0 or timeout_minutes > 0. A user setting max-turns: 0 will emit --max-turns 0, which could silently mean "zero turns allowed...

Both addressed in b61c58b:

  1. Zero-value validation: Added eprintln! warnings when max-turns: 0 or timeout-minutes: 0 are set, following the existing warning pattern (e.g. the workspace warning). The values are still emitted since u32 makes zero an explicit opt-in, but the warnings make the consequences clear.

  2. Terminology: Updated both occurrences in AGENTS.md from "agency params" to "copilot params" to stay consistent with rename agency_paramscopilot_params, remove built-in MCP spawning, and update docs #135.

@jamesadevine jamesadevine merged commit 2dbe162 into main Apr 7, 2026
This was referenced Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants