Repository navigation
Commit e1422ab
fix(ui): avoid false stale chat send guard (#2034)
Fixes a false-positive chat send guard that can show `New messages
loaded — please review before sending` during normal same-tab usage
after an agent response has already completed and is visible.
The send guard now compares backend-derived messages against all locally
visible comparable messages instead of only persisted/stored messages.
This preserves the intended cross-tab stale-message warning while
allowing the next same-tab send to proceed.
Fixes #2033.
## Changes
- Count all locally visible comparable chat messages when deciding
whether the backend has unseen messages.
- Apply the same comparable-message filtering to backend-derived
messages before comparing counts.
- Add mounted regression tests covering:
- same-tab completed stream does not block the next send
- true cross-tab/unseen messages still block
- cross-tab/unseen messages still block after a same-tab stream
## Validation
Automated:
```bash
cd ui
npm test -- --runTestsByPath src/components/chat/__tests__/ChatInterface.sendGuard.test.tsx --runInBand
```
Result:
```text
Test Suites: 1 passed, 1 total
Tests: 3 passed, 3 total
```
Previously also run successfully during branch validation:
```text
src/lib/__tests__/messageHandlers.test.ts: 27 passed
Full UI Jest suite: 268 passed
```
Manual:
- Deployed/tested locally against `kind-kagent`.
- Verified the next same-tab message sends without the false `New
messages loaded` toast after a completed agent response.
---------
Signed-off-by: Evan Rauner <[email protected]>
Co-authored-by: Eitan Yarmush <[email protected]>1 parent 79cab39 commit e1422ab
3 files changed
Lines changed: 475 additions & 12 deletions
File tree
- ui/src
- components/chat
- __tests__
- lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
252 | 250 | | |
253 | | - | |
| 251 | + | |
254 | 252 | | |
255 | 253 | | |
256 | 254 | | |
| |||
270 | 268 | | |
271 | 269 | | |
272 | 270 | | |
| 271 | + | |
| 272 | + | |
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
| 276 | + | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
282 | 283 | | |
283 | 284 | | |
284 | 285 | | |
| |||
378 | 379 | | |
379 | 380 | | |
380 | 381 | | |
381 | | - | |
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| |||
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
| 600 | + | |
600 | 601 | | |
601 | 602 | | |
602 | 603 | | |
| |||
648 | 649 | | |
649 | 650 | | |
650 | 651 | | |
651 | | - | |
| 652 | + | |
652 | 653 | | |
653 | | - | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
654 | 659 | | |
655 | 660 | | |
656 | 661 | | |
| |||
0 commit comments