Commit 57f27ab
Fix session list timestamp reset and missing new sessions (#326)
* fix(session-list): preserve timestamps on resume and show recent zero-turn sessions
Two bugs in session list rendering:
1. **Timestamp reset on resume**: When sessions were resumed (e.g. on
server restart), upsertSession() was called without updatedAt, causing
the EventStore to default to "now". This made all recently-resumed
sessions show identical timestamps. Fix: read existing updatedAt via
getSession() and pass it through explicitly.
2. **Missing new sessions**: Zero-turn, zero-prompt, inactive sessions
were filtered out, hiding newly created sessions that hadn't completed
their first turn yet. Fix: keep sessions visible for 1 hour after
creation, then apply the filter.
Fixes session list showing all sessions with same "18m ago" timestamp
and newly created sessions disappearing before first message completes.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix(server): address PR #326 review — hoist constant + add test coverage
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(server): hoist ZERO_TURN_GRACE_MS constant and optimize Date.now() call
Addresses Centaur review feedback on PR #326:
- Move ZERO_TURN_GRACE_MS from chat.ts to constants.ts for better discoverability and reuse
- Extract Date.now() before filter loop to avoid redundant calls on each iteration
Tests remain passing (session-cache.test.ts covers grace period logic).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 288d3b2 commit 57f27ab
3 files changed
Lines changed: 116 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
220 | 265 | | |
221 | 266 | | |
222 | 267 | | |
| |||
347 | 392 | | |
348 | 393 | | |
349 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
350 | 452 | | |
351 | 453 | | |
352 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
689 | 690 | | |
690 | 691 | | |
691 | 692 | | |
| 693 | + | |
692 | 694 | | |
| 695 | + | |
693 | 696 | | |
694 | 697 | | |
695 | 698 | | |
| |||
698 | 701 | | |
699 | 702 | | |
700 | 703 | | |
| 704 | + | |
701 | 705 | | |
702 | 706 | | |
703 | 707 | | |
| |||
1506 | 1510 | | |
1507 | 1511 | | |
1508 | 1512 | | |
| 1513 | + | |
1509 | 1514 | | |
1510 | 1515 | | |
1511 | 1516 | | |
1512 | | - | |
1513 | | - | |
1514 | | - | |
1515 | | - | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
1516 | 1522 | | |
1517 | 1523 | | |
1518 | 1524 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
0 commit comments