fix(chat): keep streamed reasoning live across queued follow-ups

This commit is contained in:
2026-10-24 02:04:44 +01:00
parent de7c308fdb
commit 8e980564cb
4 changed files with 61 additions and 6 deletions
@@ -112,6 +112,47 @@ void main() {
});
for (final cupertino in [false, true]) {
testWidgets('reasoning first arriving after a queued follow-up opens live '
'($cupertino)', (tester) async {
gateway.prompt = (_, _) async => {'chat_queued': true};
await tester.pumpWidget(
composerThread(
gateway,
cupertino: cupertino,
newOperationId: nextOperation,
),
);
await tester.pumpAndSettle();
gateway.emitEvent({
'session_id': 's',
'message_id': 'live',
'kind': 'text',
'part': {'id': 'live-text-0', 'type': 'text'},
'delta': 'Working answer',
});
await tester.pumpAndSettle();
await tester.enterText(
find.byKey(const Key('chat-composer-field')),
'Continue',
);
await tester.pump();
await tester.tap(find.byKey(const Key('chat-composer-primary')));
await tester.pumpAndSettle();
gateway.emitEvent({
'session_id': 's',
'message_id': 'live',
'kind': 'reasoning',
'part': {'id': 'live-reasoning-0', 'type': 'reasoning'},
'delta': 'Provided reasoning after the follow-up',
});
await tester.pumpAndSettle();
expect(
find.text('Provided reasoning after the follow-up'),
findsOneWidget,
);
expect(gateway.interruptBodies, isEmpty);
});
testWidgets(
'running send waits only for its acknowledgement and keeps newer draft '
'(${cupertino ? 'cupertino' : 'material'})',