Conversation
The interactive command declared `default=20` for --max-steps, while run and show-config left it unset. click then always passed 20 as the CLI value, which outranks the config file in resolve_config_value, so agents.trae_agent.max_steps was silently ignored in interactive mode.
|
Closing this PR on the same three measurements documented on #490, re-taken at 2026-09-26T00:39Z. The reason is the state of the repository, not the change.
Expect the red ✗ on those two runs within a second or two of this close: it happened on all three earlier batches today (closes at 18:22Z, 22:32Z, 00:31Z), the flip lands 1–2 s after One thing to say plainly, because both sides of this are the same GitHub account: the PR above and this close come from The branch |
|
Reopening at the lane owner's instruction, 2026-09-26. Re-checked against My closing comment recorded why the thread was parked - this repository has accepted no pull requests since 2026-02-05, so fork CI runs here stay at |
Description
trae-cli interactivesilently ignoredmax_stepsfrom the config file: its--max-stepsclickoption was declared with
default=20, sointeractive()always handed20toConfig.create(...).resolve_config_values(max_steps=...)as the CLI value. Sinceresolve_config_valueis documented as "CLI > ENV > Config > Default", a filled-in default alwaysbeat the config file, and
agents.trae_agent.max_stepswas never consulted in interactive mode.The other two commands that resolve the same config (
run,show-config) declare the optionwithout a default and therefore do honour the config file. This PR removes the inconsistent default
so all three commands share one precedence rule, and adds a regression test that pins the
behaviour in both directions (flag absent -> config value, flag present -> CLI value).
Reported in #491.
More Information
The single production change is in
trae_agent/cli.py(line 425, theinteractivecommand):Why removing the default cannot leave the value undefined:
interactive()already annotates the parameter asmax_steps: int | None = None(
trae_agent/cli.py:437), so "flag not given =None" is the shape the function expects - thesame shape
run()andshow_config()use.max_stepsis a required field of the agent config:Config.create()buildsTraeAgentConfig(**agent_config, ...), and a config file withoutmax_stepsfails outright withTypeError: TraeAgentConfig.__init__() missing 1 required positional argument: 'max_steps'.resolve_config_valuestherefore always yields anint; there is no path where the removeddefault was the only thing keeping the value non-
None.interactive(the20values indocs/legacy_config.mdanddocs/TRAJECTORY_RECORDING.mdare config file examples, andREADME.mddemonstratesmax_steps: 200).Impact: interactive sessions now respect the configured step budget. Users who relied on the
implicit 20 can pass
--max-steps 20, and their config file value keeps working - which is thebehaviour the config schema and the other two commands already promise.
The new test
tests/test_cli_max_steps.pydrives the real commands throughclick.testing.CliRunnerwith a temp config file (
max_steps: 50) and asserts the value that reaches the agent config, forboth
interactiveandrun, with and without the flag. It lives in its own file to avoid touchingtests/test_cli.py, which several open PRs are editing.Validation
All commands were run locally on Windows 11 / Python 3.12.13,
uvenvironment of the repo(
--all-extras), againstmain=e839e559ac61bdd0e057c375dd1dee391fee797d.Red first - the new test on unmodified
main(the test file added,trae_agent/cli.pyrevertedto
e839e55):The failing case is
test_interactive_without_flag_keeps_config_max_steps; the three others(
runwithout the flag, and both commands with--max-steps 70) already passed, which is whatmakes the failure specific to
interactive.Same test after removing
default=20:Full suite on the branch, with the clean
mainclone as control (same machine, sameenvironment):
63 = 59 + the 4 new tests, and the skipped count is unchanged. The 3 failures are identical in
both runs and are pre-existing, Windows-only baseline failures, not caused by this PR:
tests/tools/test_bash_tool.py::TestBashTool::test_command_error_handling,::test_session_restart,::test_successful_command_execution(they depend onpexpect/POSIXbashsession behaviour, so they fail on a Windows checkout ofmainand pass on the Linux CIrunners).
Static checks on the changed files only:
The mypy finding is in
trae_agent/tools/bash_tool.py, a file this PR does not touch:os.setsidis POSIX-only, so mypy on Windows reports it for any checkout of
main. No mypy error isreported for the two changed files.
Conflict screen against the open PRs that edit the same files.
trae_agent/cli.pyis touched by15 open PRs, but none of their diff hunks cover the
interactiveoption line (base lines423-427), and a three-way merge of this branch against the nearest seven heads
(
#412 #423 #434 #435 #436 #437 #438) is clean:Linked Issues
Resolves #491