fix(native-chat): scope composer sends to the active turn (#8568)

* fix(native-chat): scope composer sends to the active turn

* fix(native-chat): close pending send lifecycle gaps

* fix(native-chat): deduplicate pending message derivation
This commit is contained in:
Jinjing
2026-07-13 13:07:25 -07:00
committed by GitHub
parent 476b6f97d0
commit 39b2ec832e
14 changed files with 848 additions and 92 deletions
+16
View File
@@ -47,6 +47,22 @@ describe('deriveNativeChatStreamingText', () => {
).toBe('Working on it')
})
it('treats an optimistic user echo as the active streaming-turn boundary', () => {
const optimistic = {
...user('new prompt'),
id: 'pending:send-1',
timestamp: 20,
source: 'scrape' as const
}
expect(
deriveNativeChatStreamingText({
messages: [assistant('A much longer answer from the completed prior turn'), optimistic],
previewText: 'New reply',
working: true
})
).toBe('New reply')
})
it('drops the preview once the real assistant turn contains it (no duplicate)', () => {
expect(
deriveNativeChatStreamingText({