Repository navigation
Conversation
`Bash`/`BashTool` `timeout_seconds` set the shell timeout but left embedded Python and TypeScript at the profile's `max_duration` per run (30 s, Hardened 10 s), so `timeout_seconds=120` still stopped `python3` at 30 s. It now also sets that limit, as `Bash` already did for SQLite.
Review summary — #2864
|
#2873) timeout_seconds on Python Bash/BashTool now also sets the python3/ts per-run max_duration, clamped to the remaining execution deadline. Test asserts exit 124 and an upper bound; TM-PY-039 records that a longer cap lengthens how long a CPU-bound run can hold a shared worker thread. Supersedes #2864. Fixes #2866. Co-authored-by: krimvp <anton.balboa@gmail.com>
|
Thanks @krimvp! Your two commits landed unchanged (rebased onto main) in #2873, squash-merged as d4e50b5 with you as co-author. On top we added an upper bound and exit-124 check to the test, and a threat-model entry (TM-PY-039) noting that a longer per-run cap lets a CPU-bound run hold a shared worker thread longer. Closing this one as superseded. Generated by Claude Code |
Fixes #2866
What changed
timeout_secondsonBashandBashToolnow also sets the embedded runtimes' own per-run time limit (max_durationfor Montypython3and ZapCodets), the same wayBashalready passes it to SQLite. It applies to construction,reset(), snapshot factories, and the external-handler paths.Each run is still clamped to the remaining execution deadline, and a per-call
execute(timeout_seconds=...)can still only shorten it. Callers who don't settimeout_secondssee no change.Why
The runtimes take their time limit from the execution profile (30 s, or 10 s under Hardened), and
timeout_secondsonly raised the shell timeout. SoBash(python=True, timeout_seconds=120)still stoppedpython3at 30 s, and Python callers had no way to raise it, becauseExecutionProfileis a closed set.Before / After
Bash(python=True, timeout_seconds=40).execute_sync("python3 -c 'while True: pass'"):timeout_seconds=120)TimeoutError: time limit exceeded: 30.000000166s > 30spython3: execution timed out after 40.0sNew test
test_timeout_seconds_raises_runtime_time_limit(Hardened profile,timeout_seconds=11):python3andtsstop at 10.0 s, and the test fails.The full Python suite passes locally: 966 passed, 7 skipped.
Risk
tsrun is still bounded by the execution work budget (one unit per µs of VM time, so about 100 s Standard and 25 s Hardened). This PR documents that inknowledge/and doesn't change it.timeoutMsonly reaches SQLite. It's left for a follow-up to keep this PR small.Checklist
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.