feat(agents): allow per-invocation timeout override on shell/http tools #113
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.
Dependencies
No dependencies set.
Reference
cleveragents/cleveractors-core!113
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/m1-shell-timeout-override"
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
Adds an optional per-invocation
timeoutargument to theshellandhttp_requesttools so an LLM driving them can raise the execution limit for a single long-running call — instead of being told to "increase the timeout config value", which it cannot do at runtime. The model previously threadedtimeout Ninto the call, corrupting the command.TimeoutPolicyvalue object resolves the effective timeout.max_timeoutconfig field (default 120s) bounds any override; an optional shell-onlyshell_max_timeoutrefines the ceiling forshellalone and is never consulted byhttp_request.timeoutargument.Specification / ADR
docs/adr/ADR-2030-tool-calling-spec-extensions.mdD-9 (accepted revision).max_timeoutfield).Testing
features/shell_timeout_override.feature— 32 scenarios (shell + http, including one provingshell_max_timeoutdoes not leak intohttp_request). Full suite green (2943 scenarios, 0 failed).robot/shell_timeout_override.robot— 4 real-subprocess integration tests.benchmarks/timeout_policy_benchmark.py.timeout_policy.py100%,llm_tools.py100%,tool.py98%). lint / format / typecheck / security / dead_code all green.Closes #111
PR Review: !113 (Ticket #111)
Verdict: Approve
The implementation cleanly realizes ADR-2030 D-9 and the Actor Configuration Standard §4.5 / §21.1 (Version 1.2.0) changes. The
TimeoutPolicyvalue object is a good abstraction, validation happens before any subprocess/request, thetimeoutcontrol argument is never concatenated into the shell command, and the error messages now point the model at the actionable per-call lever. Tests (Behave, Robot, ASV) are comprehensive and the commit/branch hygiene matches the ticket metadata. Only minor gaps/note-level items remain.Critical Issues
None
Major Issues
None
Minor Issues
Missing regression scenario for the original bug shape (
timeout+ positionalargs)features/shell_timeout_override.featuretimeout Ninto the positionalargslist, which got concatenated onto the command line. The code now correctly readsargs.get("timeout")separately fromargs["args"], but there is no Behave/Robot scenario that supplies both a per-calltimeoutand a positionalargslist and asserts the output is uncorrupted. Adding one scenario would close the regression loop explicitly.TimeoutPolicymodule docstring is slightly stalesrc/cleveractors/agents/timeout_policy.py, lines 1–9shelltool's per-invocationtimeoutargument today … and is reusable by any future tool." Since_http_request_toolalso usesTimeoutPolicytoday, the wording implies onlyshellconsumes it. Rephrase to mention both current consumers or drop the "today / future" framing.Invalid timeout ceilings are validated lazily
src/cleveractors/agents/tool.py, lines 325–362max_timeoutorshell_max_timeoutis only detected when the first timeout-honouring tool is invoked, not atToolAgentconstruction. For faster failure of misconfigured agents, consider validating these config fields in__init__(or in the policy builders called from__init__).Coverage sits between two documented thresholds
noxfile.pyconstant (COVERAGE_THRESHOLD = 96.5), butCONTRIBUTING.mdstates the project-specific enforced merge gate is 97%. Please confirm the actualnox -s coverage_reportoutput; if it is below 97%, add targeted tests to meet the documented gate (the project may also need to reconcile the noxfile constant withCONTRIBUTING.md).Nits
ShellTimeoutLibexposes a rawValueErroron bad timeout stringsrobot/ShellTimeoutLib.py, line 36float(timeout)will raiseValueErrorif the Robot test passes a non-numeric string. Wrapping this in anExecutionError(or validating and raisingAssertionError) would give clearer Robot failure output.Empty benchmark
teardownbenchmarks/timeout_policy_benchmark.py, lines 32–33teardownmethod is a no-op. It is harmless, but can be removed or annotated with a comment if state cleanup is truly unnecessary.Summary
Solid, well-scoped change. The per-invocation
timeoutargument is implemented correctly for bothshellandhttp_request, the ceiling logic (max_timeout/shell_max_timeout) is clean and properly separated, and the schema/documentation/spec updates are all in place. The only substantive follow-ups are adding thetimeout+argsregression scenario and clarifying the coverage threshold situation; neither blocks approval.In the review issuecomment 321954, Minor, Issue 4, the coverage is a non-issue, since the 96.5% threshold rounds to the 97% threshold in the documentation and it is meant to be that way. The current coverage of 96.7% is within the specified range.
Thanks for the review, @hurui200320! Addressed the Minor issues; Nit 1 fixed, Nit 2 kept as-is (see below). Confirmed all four against §4.5/ADR-2030 before applying — none conflict with the spec.
Minor 1 (missing
timeout+argsregression scenario) — Added. Two new Behave scenarios infeatures/shell_timeout_override.featurereproduce the original bug shape directly: a positionalargslist containing the literal tokens"timeout"/"99"alongside a real per-calltimeoutcontrol argument, asserting the output is exactly the harmless concatenated text ("marker timeout 99") and that the override still functions (asleep 2succeeds undertimeout=4even withargspresent). Also added a matching Robot regression test.Minor 2 (stale
TimeoutPolicydocstring) — Fixed. Now states it backs the per-invocationtimeoutargument on bothshellandhttp_requesttoday, dropping the "today / future" framing.Minor 3 (lazy ceiling validation) — Fixed.
ToolAgent.__init__now eagerly builds both timeout policies and converts aValueErrorintoAgentCreationError, so a misconfiguredtools_max_timeout/shell_max_timeoutfails at construction, not on first call. As a consequence, the two call sites (_execute_shell_command,_http_request_tool) no longer need their owntry/except ValueError— the ceiling is guaranteed valid by the time they run, per ADR-2030 D-9 (updated in place with a bullet documenting this). The two existing "invalid ceiling" scenarios now assertAgentCreationErrorat construction time instead ofExecutionErrorat call time.Minor 4 (coverage 96.5% vs 97%) — No code change; per @CoreRasurae's earlier reply this is an intentional pre-existing project-wide threshold choice, outside this ticket's scope (not part of the Actor Configuration Standard or ADR-2030). Independently verified: a coverage run scoped to the feature-relevant BDD files shows
timeout_policy.pyandllm_tools.pyat 100%, and none of the changed/added lines intool.pyappear in that scoped run's missing-lines list — the new eager-validation code is fully exercised. Also confirmed the full 2945-scenario suite still passes with 0 failures after these changes (no regressions from touching the sharedToolAgent.__init__path).Nit 1 (
ShellTimeoutLibrawValueError) — Fixed. Added a_parse_timeouthelper that raises a clearAssertionErroron a non-numerictimeoutstring; added a Robot test case (Non Numeric Timeout Argument Fails With A Clear Message) exercising it.Nit 2 (empty benchmark
teardown) — Left as-is. It matches the establishedsetup/time_*/teardownlifecycle convention used by the other benchmarks in this repo (e.g.hello_benchmark.py), so removing it would make this benchmark inconsistent with house style for near-zero benefit.Ran
nox -s lint / format --check / typecheck / dead_code / security_scan(all green), the full Behave suite (146 features, 2945 scenarios, 0 failed), and the Robot integration suite for this feature (5/5 passed) after applying the above.e3b675b7d2f19714a3daf19714a3da0133520555timeoutargument #111