Keep unengaged open chats unread

Update the live-chat regression and note to reflect that replies received while a chat is merely open are not acknowledged as seen. This preserves phone notifications until the user actually interacts with the chat.
This commit is contained in:
2026-11-12 03:21:38 +00:00
parent 6ccced012e
commit ae5e00326c
2 changed files with 38 additions and 23 deletions
@@ -229,29 +229,32 @@ void main() {
expect(find.byKey(const Key('chat-row-unread')), findsOneWidget);
});
testWidgets('a tool call and reply in the open chat stay read on leaving', (
tester,
) async {
final fake = gateway();
await _pump(tester, fake, active: 's1');
fake.pushed.add(_tool('s1', 'running'));
fake.pushed.add(_tool('s1', 'completed'));
fake.pushed.add(_event('s1', delta: 'Here is the answer.'));
fake.pushed.add({
'type': 'chat_event',
'chat_event': {
'session_id': 's1',
'kind': 'step',
'step': {'status': 'ended'},
},
});
await tester.pumpAndSettle();
expect(find.byKey(const Key('chat-row-unread')), findsNothing);
testWidgets(
'a tool call and reply in the open chat stay New on leaving without interaction',
(tester) async {
final fake = gateway();
await _pump(tester, fake, active: 's1');
fake.pushed.add(_tool('s1', 'running'));
fake.pushed.add(_tool('s1', 'completed'));
fake.pushed.add(_event('s1', delta: 'Here is the answer.'));
fake.pushed.add({
'type': 'chat_event',
'chat_event': {
'session_id': 's1',
'kind': 'step',
'step': {'status': 'ended'},
},
});
await tester.pumpAndSettle();
expect(find.byKey(const Key('chat-row-unread')), findsNothing);
await _pump(tester, fake);
expect(find.byKey(const Key('chat-row-unread')), findsNothing);
expect(_store.state?.isUnseen('s1') ?? false, isFalse);
});
// The chat was open but the user never interacted with it, so the
// reply is not seen: it stays New after the chat is left.
await _pump(tester, fake);
expect(find.byKey(const Key('chat-row-unread')), findsOneWidget);
expect(_store.state?.isUnseen('s1') ?? false, isTrue);
},
);
testWidgets('only unresolved permission requests mark New', (tester) async {
final fake = gateway();