What is wanted
Make the slow_run threshold configurable from the command line, for example agentrace check --slow-seconds 300.
Why it matters
check_runaway in agentrace/checks.py (line 206) takes slow_s: float = 900.0, so the parameter was clearly meant to be tunable, but nothing can set it. The CHECKS list at line 224 stores the bare function and analyse (line 235) calls check(run) with no arguments, so 15 minutes is effectively hardcoded.
15 minutes is the wrong number for a lot of workloads in both directions. A repo where subagents grep and report should treat 3 minutes as suspicious; a long research sweep legitimately runs longer than 15 and just produces noise. Today the only way to change it is to edit the source.
Every other threshold in the file has the same shape (the 80-char thin_result cutoff, the 200-char prompt cutoffs, the 5-URL floor), so whatever pattern this issue lands on is the pattern for exposing those later. That is why it is worth doing carefully rather than with a module global.
Suggested approach
- Give
analyse in agentrace/checks.py an optional settings argument, for example analyse(run, slow_s: float = 900.0), and have it pass the value to check_runaway while calling the other checks as they are. A tiny dataclass of thresholds is also fine and leaves room for the others, but do not over-build it.
- Add
--slow-seconds to the check subparser in agentrace/cli.py (defined around line 166) and thread it into the analyse call at line 71. cmd_show (line 107) also calls analyse, so decide whether the flag applies there too; consistency is better.
- Add a test in
tests/test_agentrace.py alongside test_slow_run_is_flagged: a 30-minute run is not flagged when the threshold is raised above it, and a 2-minute run is flagged when the threshold is lowered.
- Document the flag in the Usage block of
README.md (lines 80-87).
Keep the default at 900 so nobody's CI changes behaviour.
Comment below if you would like to take it. I usually reply within a day.
What is wanted
Make the
slow_runthreshold configurable from the command line, for exampleagentrace check --slow-seconds 300.Why it matters
check_runawayinagentrace/checks.py(line 206) takesslow_s: float = 900.0, so the parameter was clearly meant to be tunable, but nothing can set it. TheCHECKSlist at line 224 stores the bare function andanalyse(line 235) callscheck(run)with no arguments, so 15 minutes is effectively hardcoded.15 minutes is the wrong number for a lot of workloads in both directions. A repo where subagents grep and report should treat 3 minutes as suspicious; a long research sweep legitimately runs longer than 15 and just produces noise. Today the only way to change it is to edit the source.
Every other threshold in the file has the same shape (the 80-char
thin_resultcutoff, the 200-char prompt cutoffs, the 5-URL floor), so whatever pattern this issue lands on is the pattern for exposing those later. That is why it is worth doing carefully rather than with a module global.Suggested approach
analyseinagentrace/checks.pyan optional settings argument, for exampleanalyse(run, slow_s: float = 900.0), and have it pass the value tocheck_runawaywhile calling the other checks as they are. A tiny dataclass of thresholds is also fine and leaves room for the others, but do not over-build it.--slow-secondsto thechecksubparser inagentrace/cli.py(defined around line 166) and thread it into theanalysecall at line 71.cmd_show(line 107) also callsanalyse, so decide whether the flag applies there too; consistency is better.tests/test_agentrace.pyalongsidetest_slow_run_is_flagged: a 30-minute run is not flagged when the threshold is raised above it, and a 2-minute run is flagged when the threshold is lowered.README.md(lines 80-87).Keep the default at 900 so nobody's CI changes behaviour.
Comment below if you would like to take it. I usually reply within a day.