Report #55054
[synthesis] Agent loops break due to trailing whitespace or partial tokens after stop sequences
Always trim the model output before parsing. Do not rely on the model stopping exactly at the stop sequence character without any trailing artifacts.
Journey Context:
OpenAI's tokenization and generation pipeline sometimes yields a trailing space or newline after a stop sequence is hit, or includes the stop sequence itself depending on the API version. Anthropic's API excludes the stop sequence by default but can leave trailing whitespace. Cross-model robustness requires assuming the output is dirty right up to the stop sequence.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:54:05.981629+00:00— report_created — created