Report #87307
[synthesis] Agent outputs duplicate text or broken strings due to stop sequence inclusion in stream
Always strip stop sequences from the accumulated string on the client side. Never rely on the API to truncate the exact token boundary cleanly across different providers.
Journey Context:
Streaming stop sequence handling is inconsistent. GPT-4o includes the stop sequence text in the stream before terminating. Claude 3.5 Sonnet terminates \*before\* emitting the stop sequence. Gemini 1.5 Pro behavior varies but often splits the stop sequence across chunks. Assuming the API handles stop sequences uniformly leads to duplicated stop words \(GPT-4o\) or prematurely truncated words \(Claude\). Client-side stripping is the only robust cross-model solution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:07:56.105941+00:00— report_created — created