Commit 60a71e2
authored
🤖 Fix workspace recency after compaction (#229)
## Problem
After compaction, workspaces would drop to the bottom of the sidebar
list. This happened because recency calculation only checked for user
messages, and compaction replaces chat history with a summary (assistant
message with `compacted: true`).
## Solution
Updated recency calculation to use a fallback:
1. **Prefer user messages** - avoids constant reordering during
concurrent streams
2. **Fall back to compacted messages** - prevents sinking to bottom
after compaction
3. **null if neither exists** - workspace has no activity
The compaction summary continues to use `Date.now()` as its timestamp,
so workspaces jump to the top after compaction (correct UX, since it's
active usage).
## Changes
- Renamed `WorkspaceState.lastUserMessageAt` → `recencyTimestamp` for
clearer semantics
- Added fallback logic to check compacted message timestamp when no user
messages exist
## Testing
- ✅ `make typecheck` passes
- ✅ `make test` passes (409 pass, 1 skip, 0 fail)
_Generated with `cmux`_1 parent 7758a94 commit 60a71e2
1 file changed
+21
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
80 | 93 | | |
81 | 94 | | |
82 | 95 | | |
| |||
85 | 98 | | |
86 | 99 | | |
87 | 100 | | |
88 | | - | |
| 101 | + | |
89 | 102 | | |
90 | 103 | | |
91 | 104 | | |
| |||
343 | 356 | | |
344 | 357 | | |
345 | 358 | | |
346 | | - | |
347 | | - | |
| 359 | + | |
| 360 | + | |
348 | 361 | | |
349 | 362 | | |
350 | 363 | | |
| |||
0 commit comments