Delete repetition/thrash/backstop detection outright - #609
Closed
TheGreatAxios wants to merge 1 commit into
Closed
Conversation
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.
2 tasks
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tssrc/util/period-detection.ts(detectSequencePeriod) and its test — nothing outside the deleted detectors imported itsrc/subagent/stop-policy.test.ts— tested onlydetectToolFingerprintThrash/detectTurnsSinceUserMessageBackstop, both deletedRemoved from existing files:
src/subagent/run.ts: the streamed-text repetition/contentless-growth abort path in the sub-agent stream sink,repetitionStopDetail/contentlessGrowthDetailsrc/subagent/stop-policy.ts:detectToolFingerprintThrash,IDENTICAL_REPEAT_MIN/CYCLE_REPEAT_MIN,TURNS_SINCE_USER_MESSAGE_BACKSTOP,MAX_LEAF_PROGRESS_BACKSTOP_RESETS, the"repetition"ForcedStopReasonand its parent-hint text,"salvage-repetition"outcomesrc/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 outputsrc/subagent/brief-dispatch.ts:"repetition"hard-block salvage classsrc/tui/turn-state.ts: the intra-cycledetectTailCharLoopcheck and its throttling bookkeeping (streamCharsSeen,repetitionCheckedAt) — kept the independent cross-cycle fingerprint streak (consecutiveMatchingCycles), which is unrelated TUI stall-recovery machinery not named in scopesrc/session/summarizer.ts: dropped adetectRepetitioncall 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"fromPartialFlushReasonDead-by-consequence cleanup: unused imports/helpers left over from the above (
fingerprintToolCalls/backstop imports in director.ts, several now-unused test fixtures indirector.test.ts,stop-policy.ts's now-unuseddetectSequencePeriodimport).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.tsshowing 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):
retry-policy.ts, the harness's own attempt budget)maxTurns) and no-progress (identical tool-call fingerprint repeatedDEFAULT_SUBAGENT_REPEAT_LIMITtimes) 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)turn-state.ts(not named in the deletion scope and not part of therepetition.ts/stop-policy.tsmachinery)Test plan
bun run checkgreen in the worktree (lint, typecheck, build, test — 5366 pass / 0 fail)scripts/verify-corbits-only-scope.shpasses (no vendor/ changes)Net: -2620 lines (118 insertions, 2738 deletions across 24 files).