githubnext/chopinPublic

Let's compose rich plans together

Stop the agent's reply arriving twice

A streamed message was keyed by `data.messageId` on the way in and looked up by
`event.id` on the way out. Those are different identifiers — the envelope has
its own, distinct from the message's — so the final event matched nothing,
appended a second copy of what had just been said, and left the first one
marked streaming, since clearing that flag lives in the branch that missed.

The result was a duplicated reply with a caret blinking after the first of
them, indefinitely. Nothing threw: reading the wrong near-homonym off an event
produces plausible output, which is why it reached a screenshot rather than a
log.

An entry left mid-stream is now settled when the turn ends, whatever ended it.
Aborting or failing never sends a final message, so the caret would otherwise
outlive the turn that started it — the same visible symptom from a different
cause, and worth closing as a class.

`translate` is exported and tested. Every field it reads lives under `data`,
several are near-homonyms of fields on the envelope, and none of the confusions
available there fail loudly. Reintroducing this bug now fails three tests.
KCKrzysztof Cieslak authored
255065cPatch
Parent6d30eb3
2 files changed+277-7
StackedSplit
apps/server/src/chat/service.test.ts+241 −0
apps/server/src/chat/service.ts+36 −7