Repository navigation
fix(agent): a command's timeout never outlasts the turn's time limit - #8424
kovtcharov wants to merge 3 commits into
Conversation
A turn with a time limit could spend most of it inside one command: a script left at its 600 s class default ran past a 720 s limit's stop point and was killed with nothing written. A shell or Python run the agent starts now gets a timeout no longer than the time left before the stop point, and a run with under 5 s left is refused with a message to write the result instead. Turns with no time limit are unchanged.
|
Verdict: Approve with suggestions With Two gaps are left on nearby paths, and neither blocks the merge:
Real-world evidenceN/A: no evidence bundle was produced for this run. This verdict rests on static review and the PR's unit tests. The 🔍 Technical detailsIssues 🟢 Cap is computed before the rate-limit wait ( 🟡 Follow-up: 🟢 Docstring disagrees with its own comment ( Sibling paths checked: both Python entry points in Strengths
|
Review follow-ups to the time-limit cap: - The cap assumed the stop was at 90% of the limit; slow steps move it earlier. The loop and the cap now read one stop point. - The cap is applied after the shell's rate-limit wait, which is time the turn has also spent. - sleep and wait_for_condition are capped the same way. - A run the limit cut short says so, in place of advice to rescope it or ask for a larger timeout.
A turn run with
--time-limitcould spend most of its time inside one command and end with nothing written. A script left at its 600 s default timeout ran straight past a 720 s limit's stop point; the turn was then killed before it wrote its result. Now a shell or Python command the agent starts gets a timeout no longer than the time left before the stop point, and a command with under 5 s left is refused with a message to write the result instead. Turns with no time limit are unchanged, and no tool description changes.Checked end to end: under
--time-limit 120, a command that sleeps 600 s was cut off at 110 s and the agent still wrote its result file before the limit.Test plan
python -m pytest tests/unit/agents/test_turn_time_limit.py tests/unit/test_run_python_timeouts.pygaia -p "run: python -c 'import time; time.sleep(600)', then write result.txt saying what happened" --time-limit 120 --full-accesscuts the command off before the limit and still writesresult.txt