Skip to content

save assistant messages as EventNewAssistantMessage instead of EventNewToken#27

Merged
x2d7 merged 3 commits intodevfrom
26-fix-newtoken-context
Feb 19, 2026
Merged

save assistant messages as EventNewAssistantMessage instead of EventNewToken#27
x2d7 merged 3 commits intodevfrom
26-fix-newtoken-context

Conversation

@x2d7
Copy link
Owner

@x2d7 x2d7 commented Feb 19, 2026

"Minor version numbers are for when you're ashamed of the changes."

Summary

Session was appending the collected assistant response to chat history as NewEventNewToken instead of NewEventNewAssistantMessage. Since the SyncInput contract explicitly states that streaming-only events (including EventNewToken) should not be synced to client params, providers were silently dropping the assistant's turns — making the model appear to have no memory of its own responses.

Changes

  • handleCompletionEnd now appends NewEventNewAssistantMessage instead of NewEventNewToken
  • SyncInput and AppendEvent contracts documented explicitly in types.go and helpers.go
  • Test TestSession_CollectsTokens updated to assert on EventNewAssistantMessage

Closes #26

@x2d7 x2d7 merged commit ae7605f into dev Feb 19, 2026
1 check passed
@x2d7 x2d7 deleted the 26-fix-newtoken-context branch February 19, 2026 22:50
@x2d7 x2d7 added the bug label Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant