Preserve an explicit max_turns=0 when building the CLI command#1132
Open
Osamaali313 wants to merge 1 commit into
Open
Preserve an explicit max_turns=0 when building the CLI command#1132Osamaali313 wants to merge 1 commit into
Osamaali313 wants to merge 1 commit into
Conversation
`_build_command` gates the `--max-turns` flag on a truthy check:
if self._options.max_turns:
cmd.extend(["--max-turns", str(self._options.max_turns)])
so `max_turns=0` is falsy and silently dropped — the flag is omitted and
the CLI falls back to its default turn limit, the opposite of what the caller
explicitly requested.
Every other numeric option in the same method preserves an explicit 0 by
checking `is not None`: `max_budget_usd`, `task_budget`, `max_thinking_tokens`,
and `effort`. Use the same `is not None` check for `max_turns` so an
explicitly-set value is always forwarded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When building the CLI command,
--max-turnsis gated on a truthy check, while every other numeric option usesis not None:So a caller that explicitly sets
max_turns=0has the flag silently omitted, and the CLI falls back to its default turn limit — the opposite of the explicit request. An explicitly-provided option shouldn't be discarded just because its value is0.Fix
Match the sibling numeric options:
Reproduction
max_turns=0--max-turns 0✅max_budget_usd=0.0--max-budget-usd 0.0--max-budget-usd 0.0max_thinking_tokens=0--max-thinking-tokens 0--max-thinking-tokens 0(
max_turns=0is the only numeric option whose explicit0is currently lost.)