Skip to main content

Module repeat_fuse

Module repeat_fuse 

Source
Expand description

O6: RepeatFuse — the hard rungs of the no-progress escalation ladder.

The 2c salience-footer STOP (context/renderer.rs) is the SOFT rung: at ≥2 consecutive turns of the identical tool call (same name AND args) it injects a STOP: line at the prompt’s peak-attention position and bets the model self-corrects. This module holds the config for the two rungs above it, enforced in the state machine’s gate (scheduler/state_machine/gate.rs):

  • deny (deny_after, default 5): the turn is rolled back like a governance deny and a directive note — WHY it was denied, WHAT to do instead — is fed back to the model.
  • terminate (terminate_after, default 8): the run ends with TerminationReason::NoProgress after one final no-tools report turn, so embedders can tell “looped with no progress” from MaxTurns.

The fuse keys on the SAME per-turn signature the 2c STOP uses (non-meta name(args) joined), so a legit loop varying its args reads as distinct progress on every rung. A signature-based fuse deliberately does NOT catch args-varying loops — the token/turn budgets remain the backstop there (any mechanical detector would false-positive real iteration).

Structs§

RepeatFuseConfig
Thresholds for the repeat fuse. 0 disables that rung individually; enabled: false disables the whole fuse. Counting is per consecutive identical turn-signature: a different call (or the same tool with different args) resets the streak to 1.