Skip to content

Make the slow_run threshold configurable with --slow-seconds #6

Description

@royalpinto007

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

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions