Skip to content

Delete repetition/thrash/backstop detection outright - #609

Closed
TheGreatAxios wants to merge 1 commit into
mainfrom
cl-6995-delete-repetition-detection-outright
Closed

Delete repetition/thrash/backstop detection outright#609
TheGreatAxios wants to merge 1 commit into
mainfrom
cl-6995-delete-repetition-detection-outright

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

Deletion task (CL-6995): removes all repetition/cycle/no-progress-by-turn-count detection outright, no replacement, no raised thresholds.

Deleted entirely:

  • src/subagent/repetition.ts (detectRepetition, trackContentlessGrowth, detectTailCharLoop)
  • src/subagent/repetition.test.ts
  • src/util/period-detection.ts (detectSequencePeriod) and its test — nothing outside the deleted detectors imported it
  • src/subagent/stop-policy.test.ts — tested only detectToolFingerprintThrash / detectTurnsSinceUserMessageBackstop, both deleted

Removed from existing files:

  • src/subagent/run.ts: the streamed-text repetition/contentless-growth abort path in the sub-agent stream sink, repetitionStopDetail/contentlessGrowthDetail
  • src/subagent/stop-policy.ts: detectToolFingerprintThrash, IDENTICAL_REPEAT_MIN/CYCLE_REPEAT_MIN, TURNS_SINCE_USER_MESSAGE_BACKSTOP, MAX_LEAF_PROGRESS_BACKSTOP_RESETS, the "repetition" ForcedStopReason and its parent-hint text, "salvage-repetition" outcome
  • src/agent/director.ts: the tool-fingerprint thrash pause and turns-since-user-message backstop nudge/escalation (pausedForToolOnly, toolFingerprintHistory, backstopNudgeFiredAtTurn, leafProgressBackstopResets, etc.) — kept the unrelated soft check-in nudge (toolOnlyTurnNudgeAt), which is a plain turn-count nudge, not a comparison of model output
  • src/subagent/brief-dispatch.ts: "repetition" hard-block salvage class
  • src/tui/turn-state.ts: the intra-cycle detectTailCharLoop check and its throttling bookkeeping (streamCharsSeen, repetitionCheckedAt) — kept the independent cross-cycle fingerprint streak (consecutiveMatchingCycles), which is unrelated TUI stall-recovery machinery not named in scope
  • src/session/summarizer.ts: dropped a detectRepetition call gating which assistant turns feed the compaction summary excerpt (found as an additional call site not in the original inventory)
  • src/session/stream-journal.ts: "repetition" from PartialFlushReason

Dead-by-consequence cleanup: unused imports/helpers left over from the above (fingerprintToolCalls/backstop imports in director.ts, several now-unused test fixtures in director.test.ts, stop-policy.ts's now-unused detectSequencePeriod import).

Tests: deleted tests that asserted the deleted detectors fire (turn-monitor, turn-state, stall-watchdog, director, index, summarizer suites); added one test in src/subagent/index.test.ts showing a leaf that keeps varying its own tool calls in reaction to a stably-failing environment runs to the turn budget and still completes normally on a real report.

Where the line is drawn

Kept as-is (transport reliability, not behavior policing):

  • Provider stream error / connection failure handling and inference retry/backoff (retry-policy.ts, the harness's own attempt budget)
  • Turn budget (maxTurns) and no-progress (identical tool-call fingerprint repeated DEFAULT_SUBAGENT_REPEAT_LIMIT times) on leaf sub-agents — this is a simple repeat-count check, not a comparison/hash of model output, and neither peer's absence-of-repetition-detection claim covers turn caps (both peers were found to have no default turn cap at all, which is a separate, unaddressed gap noted for future consideration, not touched here)
  • The independent cross-cycle TUI stall-recovery fingerprint streak in turn-state.ts (not named in the deletion scope and not part of the repetition.ts/stop-policy.ts machinery)

Test plan

  • bun run check green in the worktree (lint, typecheck, build, test — 5366 pass / 0 fail)
  • scripts/verify-corbits-only-scope.sh passes (no vendor/ changes)

Net: -2620 lines (118 insertions, 2738 deletions across 24 files).

Remove all behavior-policing repetition, cycle, and no-progress-by-turn-
count detection: the streamed-text loop detector and contentless-growth
guard on sub-agent runs (src/subagent/repetition.ts and its call sites in
run.ts), the tool-fingerprint period/cycle thrash pause and
turns-since-user-message backstop on the main director loop
(stop-policy.ts, director.ts), and the standalone period-detection
utility they both used (src/util/period-detection.ts).

These were compensating for bugs now fixed at their cause (tool-arg
rejections driving identical retries, missing prompt_cache_key,
byte-identical thinking-only turns, apply_patch reading line-numbered
output), and the streamed-text detector's own defaults were shown to
kill healthy runs reacting correctly to a stable external error.

Kept: transport-level abort handling (provider stream errors,
connection failures, retry/backoff on the model API call) and the
turn-budget / no-progress (identical tool-call fingerprint) leaf
worker limits, which are unrelated policy.
@linear-code

linear-code Bot commented Aug 24, 2026

Copy link
Copy Markdown

CL-6995

@TheGreatAxios

Copy link
Copy Markdown
Collaborator Author

Superseded by #612, which re-applied this deletion on a settled main after #610 restructured the same files. #612 merged; the work is in 0.3.0.

@TheGreatAxios
TheGreatAxios deleted the cl-6995-delete-repetition-detection-outright branch August 28, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant