Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

The Second Turn Forgot the First: A Payload Debugging Retrospective

说明与用途

问题源于客户端在中断流后发送的对话历史格式不正确。通过在客户端进行负载审计和规范化,删除空转和重复角色,并添加回归测试,解决了此问题。

问题

An AI coding assistant produced incorrect output after an interrupted streaming turn, causing the assistant to “forget” the first user request.

结果

By auditing and normalizing the conversation payload at the client boundary, the assistant no longer misinterprets truncated or empty turns, eliminating the false “memory loss” and improving reliability on free tiers.

工作流

  • 1. Log every outgoing request body (redacted) to a JSONL file.
  • 2. After each turn, print the role sequence: system, user, assistant, user…
  • 3. Flag empty content, duplicated roles, and assistant fragments shorter than a word.
  • 4. Reproduce the issue with an exact transcript, not memory.
  • 5. Normalize history by filtering out empty turns and enforcing strict role alternation.
  • 6. Add a regression test that aborts a stream, builds the next payload, and asserts the shape of the history.
  • 7. If payload is clean, escalate to the provider with evidence.

证据

The variant I actually caught in my logs was even nastier: a completely empty assistant turn, pushed into history by an aborted stream, which broke the role alternation entirely.

来源

Add a regression test that aborts a stream, builds the next payload, and asserts the shape of the history.

来源

  • 记录日期: 2026-09-06T20:37:34.299Z