Repository navigation
fix(ttsr): repetitive-turns never cuts a reply off and ignores summaries separated by tool work (#4537) - #4538
Open
code-yeongyu wants to merge 3 commits into
Open
code-yeongyu wants to merge 3 commits into
code-yeongyu wants to merge 3 commits into
Conversation
…s on tool work, and never cuts a reply off Summaries separated by real tool work were compared with the last completed text however long ago, aborted mid-stream on a single near-duplicate pair, and paused long autonomous runs because one correction stayed spent until the next user message. The lane now compares only consecutive text-only replies, nudges after the reply completes, the correction bound renews once the agent acts again, and no 'nudge queued' notice is written for a nudge that will be suppressed. Fixes #4537
code-yeongyu
marked this pull request as ready for review
October 27, 2026 17:00
6 tasks
…537 review) Split the loop-stop test so it claims only the loop stop, and add a case where main reaches the armed-after-correction path (correction, a different reply, then another owner's automatic turn repeating it): main writes a second 'nudge queued' activation for the suppressed correction, this head writes none.
This was referenced Oct 28, 2026
This branch has not been deployed
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.
Fixes #4537
Reported by jamestesting on the OmO Discord: a long autonomous session kept getting its progress summary cut off mid-sentence by the
repetitive-turnsstream rule, and then paused until a human sent a message.What changed
ttsr/repetitive-turns-lane.ts: the lane compares each completed text-only reply with the previous one. A reply that calls a tool resets the comparison, both live (noteToolWork) and when restoring from history (readPersistedAssistantTextskeeps only the text-only replies since the last tool call). The streaming arm path (observeTextDelta) is gone.ttsr/index.ts:repetitive-turnsno longer callsctx.abort; the verdict is taken atmessage_endand the nudge follows the complete reply. Both nudge paths go throughqueueRuleNudge, which writes the "nudge was queued" activation only when the nudge will be sent.ttsr/follow-up-limit.ts:ruleAlreadyCorrectedscopes the one-correction bound to one episode: it ends at the next user message or when the agent calls a tool after the correction. A repeat right after the correction still stops the loop (senpi#2967 stays fixed).rule-activation/renderer.ts: the repetitive-turns activation says the reply repeated the previous one instead of "Output interrupted".Why
observeTextDeltacompared the streaming prefix with the last completed text however long ago it was (tool-only messages carry no text), armed on a single pair at Jaccard >= 0.55, and aborted the reply. The detector's 3-turn streak never took effect:index.tscheckedarmedbeforerecordCompletedTurnarmed it, and the nextturn_startcleared it. And the spent-correction check ran back to the last user message, so in an hours-long goal any later hit paused the session.Tests
test/suite/regressions/4537-repetitive-turns-tool-work.test.ts(new): RED on main 0acf766, 4 failed / 3 passed. The failures: the second summary after tool work came backabortedand was followed by a nudge turn; a text-only repeat came backaborted; nottsr-loop-stoppedwas written for a repeat after the correction; and the correction was never renewed after tool work. GREEN with this change: 7/7.check(lint, fmt, lint ratchet, tsc, locks) passed at commit time.Not in this PR
detectors/repetitive-turns.ts(normalizeTurnText,recordTurnText) is untouched, to stay clear of feat(core): the handoff block is a structured part of the reply (#4077) #4082.recordTurnText's streak is now used only by its unit tests; remove it once feat(core): the handoff block is a structured part of the reply (#4077) #4082 lands.ttsr-extensionsupervisor test pins changing-count status lines as a loop.Summary by cubic
Fixes the
repetitive-turnsrule cutting off progress summaries mid-sentence in long autonomous sessions and pausing the session until a human messaged.The rule now compares each completed text-only reply with the previous one and nudges after the reply finishes, so replies are never aborted mid-stream. A reply that calls a tool resets the comparison, so similar summaries separated by real work are treated as progress reports instead of loops. The one-correction bound renews when the user sends a message or the agent calls a tool after a correction, so later violations in a long run get a correction instead of a pause.
Output interrupted.Written for commit cb40d03. Summary will update on new commits.