TDD: tool_max_rounds config silently ignored when falsy, and undocumented in the LLM agent specification #145

Open
opened 2026-08-21 22:36:06 +00:00 by CoreRasurae · 0 comments
Member

Metadata

Commit Message: test(agents): capture tool_max_rounds zero-value fallback (#144)

Branch: tdd/m1-tool-max-rounds-precedence

Background and context

Companion TDD issue for #144 per the project's mandatory Bug Fix TDD workflow. This issue captures a failing Behave scenario proving that tool_max_rounds: 0 in an LLM agent config is silently overridden by TOOL_MAX_ROUNDS/the default, instead of being clamped to 1 as documented.

Current behavior

See #144. LLMAgent._execute_tool_loop() uses self.config.get("tool_max_rounds") or os.environ.get("TOOL_MAX_ROUNDS", "20"), so an explicitly-configured 0 is discarded by Python's or truthiness check and the loop runs with the env var/default limit instead of being clamped to 1.

Expected behavior

A Behave scenario in features/llm_agent_tool_loop.feature, tagged @tdd_issue @tdd_issue_144 @tdd_expected_fail, asserts that with tool_max_rounds: 0 configured, _execute_tool_loop() permits exactly 1 tool round. The assertion (using assert/AssertionError only) fails while the bug is present, and the CI TDD-inversion hook makes the scenario pass as a result.

Acceptance criteria

  • Scenario tagged with @tdd_issue, @tdd_issue_144, and @tdd_expected_fail
  • The failing step uses assert / raises AssertionError only (never ValueError, RuntimeError, etc.)
  • Scenario genuinely fails (reproduces the bug) when run without @tdd_expected_fail
  • nox -s unit_tests passes (CI passes via tag inversion while the bug is unfixed)
  • Committed to the tdd/m1-tool-max-rounds-precedence branch

Supporting information

Bug issue: #144 (Forgejo dependency: #144 depends on this TDD issue).

Subtasks

  • Add a failing Behave scenario in features/llm_agent_tool_loop.feature for tool_max_rounds: 0
  • Apply all three required tags (@tdd_issue, @tdd_issue_144, @tdd_expected_fail)
  • Confirm the scenario fails via AssertionError without the bug fix
  • Run nox -s unit_tests, confirm CI passes via tag inversion

Definition of Done

This issue is complete when:

  • The failing test scenario is committed with all three required tags.
  • The commit first line matches the Commit Message in Metadata exactly.
  • The commit is pushed to the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a PR to master, reviewed, and merged.
  • This TDD issue is closed.

PR: #146 (awaiting review — not self-approved).

## Metadata Commit Message: `test(agents): capture tool_max_rounds zero-value fallback (#144)` Branch: `tdd/m1-tool-max-rounds-precedence` ## Background and context Companion TDD issue for #144 per the project's mandatory Bug Fix TDD workflow. This issue captures a failing Behave scenario proving that `tool_max_rounds: 0` in an LLM agent config is silently overridden by `TOOL_MAX_ROUNDS`/the default, instead of being clamped to 1 as documented. ## Current behavior See #144. `LLMAgent._execute_tool_loop()` uses `self.config.get("tool_max_rounds") or os.environ.get("TOOL_MAX_ROUNDS", "20")`, so an explicitly-configured `0` is discarded by Python's `or` truthiness check and the loop runs with the env var/default limit instead of being clamped to 1. ## Expected behavior A Behave scenario in `features/llm_agent_tool_loop.feature`, tagged `@tdd_issue @tdd_issue_144 @tdd_expected_fail`, asserts that with `tool_max_rounds: 0` configured, `_execute_tool_loop()` permits exactly 1 tool round. The assertion (using `assert`/`AssertionError` only) fails while the bug is present, and the CI TDD-inversion hook makes the scenario pass as a result. ## Acceptance criteria - [x] Scenario tagged with `@tdd_issue`, `@tdd_issue_144`, and `@tdd_expected_fail` - [x] The failing step uses `assert` / raises `AssertionError` only (never `ValueError`, `RuntimeError`, etc.) - [x] Scenario genuinely fails (reproduces the bug) when run without `@tdd_expected_fail` - [x] `nox -s unit_tests` passes (CI passes via tag inversion while the bug is unfixed) - [x] Committed to the `tdd/m1-tool-max-rounds-precedence` branch ## Supporting information Bug issue: #144 (Forgejo dependency: #144 depends on this TDD issue). ## Subtasks - [x] Add a failing Behave scenario in `features/llm_agent_tool_loop.feature` for `tool_max_rounds: 0` - [x] Apply all three required tags (`@tdd_issue`, `@tdd_issue_144`, `@tdd_expected_fail`) - [x] Confirm the scenario fails via `AssertionError` without the bug fix - [x] Run `nox -s unit_tests`, confirm CI passes via tag inversion ## Definition of Done This issue is complete when: - The failing test scenario is committed with all three required tags. - The commit first line matches the Commit Message in Metadata exactly. - The commit is pushed to the branch matching the Branch in Metadata exactly. - The commit is submitted as a PR to master, reviewed, and merged. - This TDD issue is closed. --- PR: #146 (awaiting review — not self-approved).
CoreRasurae added this to the v2.1.0 milestone 2026-08-21 22:36:06 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveractors-core#145
No description provided.