Skip to content

feat: make the per-dialog-turn round limit configurable (0 = unlimited) - #2198

Open
ArrogHie wants to merge 1 commit into
GCWing:evals-on-releasefrom
ArrogHie:feat/max-turns-config
Open

feat: make the per-dialog-turn round limit configurable (0 = unlimited)#2198
ArrogHie wants to merge 1 commit into
GCWing:evals-on-releasefrom
ArrogHie:feat/max-turns-config

Conversation

@ArrogHie

Copy link
Copy Markdown
Contributor

What

The CodeAgent execution loop currently enforces a hard-coded round limit: at agentic system assembly the execution engine is always built from ExecutionEngineConfig::default() (DEFAULT_MAX_ROUNDS = 200). AIConfig.max_rounds already existed in the config schema but was never wired, so changing config had no effect.

This PR makes the per-dialog-turn round limit configurable, and adds an explicit "unlimited" mode:

  • Config: ai.max_rounds (new alias ai.max_turns) is now honored when the engine is assembled (clamped to min 1).
  • CLI: new global flag --max-rounds N overrides the configured limit for exec, interactive, and session-resume startup. --max-rounds 0 means unlimited.
  • Core API: new init_agentic_system_with_options(session_config, max_rounds_override); existing entry points keep their signatures.

Usage

# pin the limit to 500 rounds per dialog turn
bitfun exec TASK --max-rounds 500

# unlimited rounds per dialog turn
bitfun exec TASK --max-rounds 0

# config file (either name works)
# ai.max_rounds = 500  or  ai.max_turns = 500

Tests

  • resolve_max_rounds unit tests (override pins value, 0 => unlimited, configured fallback).
  • clap parsing tests for the global flag (before/after subcommand, zero, absent).
  • cargo test -p bitfun-cli and cargo test -p bitfun-core --lib agentic::system pass.

The CodeAgent execution loop was hard-coded to
ExecutionEngineConfig::default() (DEFAULT_MAX_ROUNDS=200) at agentic
system assembly; AIConfig.max_rounds existed but was never wired, so
config changes had no effect.

- core: resolve the AI config when assembling the engine and build the
  engine config from ai.max_rounds (min 1); accept 'max_turns' as a
  serde alias so both names configure the same limit. Add
  init_agentic_system_with_options(session_config, max_rounds_override)
  where Some(0) means unlimited (usize::MAX) and Some(n) pins the limit.
- cli: add a global --max-rounds flag threaded through
  initialize_core_services into exec / interactive / session-resume
  startup; 0 = unlimited.
- tests: resolve_max_rounds unit tests + clap parsing tests (before/after
  subcommand, zero, absent).
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.

1 participant