Component
sight
What happened?
Agents that were working normally (multi-step tasks, all completed successfully) were flagged with dead_loop / critical interruption events by the tool_sequence_repetition rule:
- {"repeated_tools":["terminal"],"repeat_count":5,"rule":"tool_sequence_repetition"}
- {"repeated_tools":["exec"],"repeat_count":5,"rule":"tool_sequence_repetition"}
In one flagged case the 5 consecutive terminal calls each ran a different command (pip list → find → cat → a detect script → an install script), made clear progress, and the task finished successfully — there was no loop.
What I expected: normal multi-step work that naturally invokes the same tool repeatedly (terminal/exec-heavy workflows) should not be classified as a critical dead loop.
Root cause analysis
In src/agentsight/src/interruption/loop_detector.rs, rule 1 (detect_tool_sequence_loop) compares only the tool name sequence (tool_call_names) of the last N tool-bearing calls. It does not look at the tool call arguments/commands, so five different commands executed via the same tool are indistinguishable from a genuine loop.
Additionally:
- The threshold
tool_sequence_repeat_threshold exists in LoopDetectorConfig, but the call site in src/agentsight/src/unified.rs constructs LoopDetector::default(), so the config value is effectively hardcoded to 5 and cannot be tuned via config.json.
InterruptionType::DeadLoop has a fixed default severity of Critical (src/agentsight/src/interruption/types.rs), so every false positive is reported at the highest severity.
How can we reproduce it?
- Run
agentsight trace with interruption detection enabled (default).
- Have any agent perform a normal multi-step task that issues 5+ consecutive calls to the same tool with different arguments (e.g. a shell/terminal tool running different commands).
- Observe a
dead_loop / critical event with rule: tool_sequence_repetition even though the task progresses and completes.
Anything else?
Suggested fixes:
- Improve precision: require the same tool arguments/command to repeat (not just the same tool name) before flagging a dead loop. This needs
RecentCallSummary to carry an argument fingerprint.
- Wire
tool_sequence_repeat_threshold (and related loop-detector knobs) into config.json instead of always using LoopDetector::default() at the call site.
- Reconsider severity: name-only repetition could be reported at a lower severity, reserving
critical for repetitions with identical arguments.
Component
sight
What happened?
Agents that were working normally (multi-step tasks, all completed successfully) were flagged with
dead_loop/criticalinterruption events by thetool_sequence_repetitionrule:In one flagged case the 5 consecutive
terminalcalls each ran a different command (pip list→find→cat→ a detect script → an install script), made clear progress, and the task finished successfully — there was no loop.What I expected: normal multi-step work that naturally invokes the same tool repeatedly (terminal/exec-heavy workflows) should not be classified as a critical dead loop.
Root cause analysis
In
src/agentsight/src/interruption/loop_detector.rs, rule 1 (detect_tool_sequence_loop) compares only the tool name sequence (tool_call_names) of the last N tool-bearing calls. It does not look at the tool call arguments/commands, so five different commands executed via the same tool are indistinguishable from a genuine loop.Additionally:
tool_sequence_repeat_thresholdexists inLoopDetectorConfig, but the call site insrc/agentsight/src/unified.rsconstructsLoopDetector::default(), so the config value is effectively hardcoded to 5 and cannot be tuned via config.json.InterruptionType::DeadLoophas a fixed default severity ofCritical(src/agentsight/src/interruption/types.rs), so every false positive is reported at the highest severity.How can we reproduce it?
agentsight tracewith interruption detection enabled (default).dead_loop/criticalevent withrule: tool_sequence_repetitioneven though the task progresses and completes.Anything else?
Suggested fixes:
RecentCallSummaryto carry an argument fingerprint.tool_sequence_repeat_threshold(and related loop-detector knobs) into config.json instead of always usingLoopDetector::default()at the call site.criticalfor repetitions with identical arguments.