test(agents): capture tool_max_rounds zero-value fallback (#144) #146
No reviewers
Labels
No labels
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
#145 TDD: tool_max_rounds config silently ignored when falsy, and undocumented in the LLM agent specification
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core!146
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "tdd/m1-tool-max-rounds-precedence"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Companion TDD issue-capture test for #144 ("tool_max_rounds config silently ignored when falsy, and undocumented in the LLM agent specification"). Adds a Behave regression scenario proving the bug:
_execute_tool_loop()resolves the round limit viaself.config.get("tool_max_rounds") or os.environ.get("TOOL_MAX_ROUNDS", "20"), and Python'sortreats an explicitly configured0as falsy, so it silently falls through toTOOL_MAX_ROUNDS/the"20"default instead of being clamped to 1 asCHANGELOG.md(issue #59 entry) documents.features/llm_agent_tool_loop.feature, steps added to the existing sharedfeatures/steps/llm_agent_tool_loop_steps.py(no new step file).@tdd_issue @tdd_issue_144 @tdd_expected_fail.tool_max_rounds: 0with a mock that always returns tool calls, and asserts the main tool-call loop executes exactly 1 round before the stuck-model synthesis calls.AssertionError(main_rounds=20, not 1) reproducing the bug; with the tag present,TddExpectedFailPolicyinverts the result so CI passes.Closes #145
Test plan
nox -s lint— greennox -s format -- --check— greennox -s typecheck— green (pre-existing unrelated warning:langchain_google_genaiimport inllm_imports.py)nox -s security_scan— green (bandit + semgrep, 0 findings)nox -s dead_code— greennox -s unit_tests— 154 features / 3084 scenarios / 14279 steps green (includes the new scenario passing via TDD tag inversion)nox -s coverage_report— 96.9% (>= repo gate 96.5%)nox -s integration_tests— skipped per explicit instruction; test-only change tofeatures/, nosrc/orrobot/code touchednox -s benchmark_regression— skipped per explicit instruction; test-only change, no ASV-relevant code touchedAssertionError(notValueError/RuntimeError) when@tdd_expected_failis removed locally_execute_tool_loop() resolves the round limit via self.config.get("tool_max_rounds") or os.environ.get("TOOL_MAX_ROUNDS", "20"). Python's `or` treats an explicitly configured 0 as falsy, so it silently falls through to TOOL_MAX_ROUNDS/the "20" default instead of being clamped to 1, as CHANGELOG.md (issue #59 entry) documents ("values <= 0 are clamped to 1"). An agent configured with tool_max_rounds: 0 therefore runs far more tool-call rounds than intended. Adds a new scenario to features/llm_agent_tool_loop.feature (extending the existing shared llm_agent_tool_loop_steps.py rather than a new step file) that configures tool_max_rounds: 0 with a mock that always returns tool calls, and asserts the main loop executes exactly 1 round before the stuck-model synthesis calls. Confirmed locally that the assertion fails with AssertionError (main_rounds=20, not 1) when @tdd_expected_fail is removed, proving the bug is genuinely reproduced; with the tag present, TddExpectedFailPolicy inverts the failure so nox -s unit_tests stays green. ISSUES CLOSED: #145PR Review: !146 (Ticket #145)
Verdict: Approve
This is a clean, well-focused TDD issue-capture PR for bug #144. The new Behave scenario correctly reproduces the
tool_max_rounds: 0precedence bug, uses the required@tdd_issue @tdd_issue_144 @tdd_expected_failtag combination, fails viaAssertionError(soTddExpectedFailPolicyinverts it as expected), and isolates the environment from ambientTOOL_MAX_ROUNDS. No critical or major issues were found.Critical Issues
None.
Major Issues
None.
Minor Issues
None.
Nits
None.
Summary
features/llm_agent_tool_loop.featureadds a single tagged scenario that documents #144 and asserts the documented clamp-to-1 behavior fortool_max_rounds: 0.features/steps/llm_agent_tool_loop_steps.pyextends the existing shared step file with an env-var isolation step and amain_rounds = counter[0] - 2assertion that matches the current_execute_tool_loop()stuck-model synthesis flow (one main round + synthesis + follow-up).src/cleveractors/agents/llm.py: with the bug present the loop runs 20 main rounds, so the assertion fails withmain_rounds=20; after the fix it will pass withmain_rounds=1.patch.dict(os.environ, …)patcher is registered incontext._active_patches, whichafter_scenarioalready cleans up, so the test is deterministic across environments.src/orrobot/, and it correctly defers the actual precedence fix and specification updates to the companion bugfix PR.Approved as a valid TDD capture for #144.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.