Skip to content

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
mainfrom
fix/ttsr-repetitive-turns-tool-work
Open

code-yeongyu wants to merge 3 commits into
mainfrom
fix/ttsr-repetitive-turns-tool-work

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

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-turns stream 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 (readPersistedAssistantTexts keeps only the text-only replies since the last tool call). The streaming arm path (observeTextDelta) is gone.
  • ttsr/index.ts: repetitive-turns no longer calls ctx.abort; the verdict is taken at message_end and the nudge follows the complete reply. Both nudge paths go through queueRuleNudge, which writes the "nudge was queued" activation only when the nudge will be sent.
  • ttsr/follow-up-limit.ts: ruleAlreadyCorrected scopes 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

observeTextDelta compared 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.ts checked armed before recordCompletedTurn armed it, and the next turn_start cleared 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

Not in this PR


Summary by cubic

Fixes the repetitive-turns rule 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.

Written for commit cb40d03. Summary will update on new commits.

View guided diff Turn on auto-fix

…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
…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 branch has not been deployed

No deployments
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.

ttsr repetitive-turns aborts productive progress summaries and repeatedly pauses long autonomous sessions

1 participant