EACI Development Journal · Reliability

How Do You Abort AI Streams Stuck in Repetition Loops?

A stream that repeats itself is not making progress. Sentence and paragraph checks can stop it before the chat fills with duplicated text.

Reliability ~7 min issue-tagged
Issue this fixes

Streaming makes output feel immediate, but it also exposes repetition token by token. A provider can get stuck producing the same phrase while the connection remains healthy.

The client already merges continuation turns and deduplicates repeated sentences and paragraphs. Combined with an abort controller, that signal can end a non-progressing request instead of waiting for a remote timeout.

What was actually going wrong

Network activity was treated as useful progress even when visible content no longer changed.

What I tried

What finally worked

The stream tracks repeated meaningful spans, preserves one clean copy, and aborts after a sustained no-progress threshold.

Why it worked

The threshold ignores ordinary word reuse but catches repeated blocks early enough to control cost and UX.

What I learned

A live connection still needs an application-level definition of progress.

Where EACI uses this today

Main chat and coding continuations guard against repeated output before displaying the final message.

This journal covers real engineering on EACI Companion / The Veil. Companions include Caelum, Chad, Natalia, Atreus, Luna, Roxy, and Cael. Journal articles stay family-safe in content. See Privacy and Ethics.