Commit b493236
🤖 fix: make code review diff refresh robust and predictable (#1296)
Makes the Code Review "diff refresh" mechanism robust and predictable,
driven by file-modifying tool-call events (`bash`, `file_edit_*`) rather
than polling or filesystem watchers.
## Key Changes
### RefreshController improvements
- **Coalescing rate-limit** instead of resetting debounce — prevents
starvation when tool events are frequent
- **Manual refresh always works** — `requestImmediate()` bypasses pause,
hidden, and min-interval checks
- **Loop prevention** — 500ms minimum interval between refreshes
(scheduled events only, not manual)
- **Trigger tracking** — `LastRefreshInfo` records what caused each
refresh
### Review panel refresh
- **Non-blocking manual refresh** — immediately bumps `refreshTrigger`,
origin fetch runs in background
- **Origin fetch deduplication** — file tree and diff loads share the
same `git fetch` call
- **Refresh tooltip** — shows "Last: 2m ago via manual" for debugging
### GitStatusStore
- **Active workspace priority** — 1s debounce vs 3s for background
workspaces
- **File modification subscription** — refreshes on tool completion
events
## Bug Fixes
- Fixed storybook test failure: `requestImmediate()` was blocked by
MIN_REFRESH_INTERVAL when components subscribed immediately after
`syncWorkspaces()` — now bypasses interval check for manual/immediate
requests
Signed-off-by: Thomas Kosiewski <tk@coder.com>
---
_Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking:
`high`_1 parent 5eff3c6 commit b493236
File tree
12 files changed
+779
-266
lines changed- src/browser
- components/RightSidebar/CodeReview
- hooks
- stores
- stories
- utils
- ui
12 files changed
+779
-266
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
136 | 142 | | |
137 | 143 | | |
138 | 144 | | |
| |||
Lines changed: 30 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
16 | 32 | | |
17 | 33 | | |
18 | 34 | | |
| |||
76 | 92 | | |
77 | 93 | | |
78 | 94 | | |
79 | | - | |
80 | | - | |
81 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
82 | 108 | | |
83 | 109 | | |
84 | 110 | | |
| |||
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
86 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
87 | 97 | | |
88 | 98 | | |
89 | 99 | | |
| |||
Lines changed: 105 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
97 | 122 | | |
98 | 123 | | |
99 | 124 | | |
| |||
118 | 143 | | |
119 | 144 | | |
120 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
121 | 193 | | |
122 | 194 | | |
123 | 195 | | |
| |||
161 | 233 | | |
162 | 234 | | |
163 | 235 | | |
| 236 | + | |
164 | 237 | | |
165 | 238 | | |
166 | 239 | | |
| |||
309 | 382 | | |
310 | 383 | | |
311 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
312 | 394 | | |
313 | 395 | | |
314 | 396 | | |
| |||
420 | 502 | | |
421 | 503 | | |
422 | 504 | | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
423 | 514 | | |
424 | 515 | | |
425 | 516 | | |
| |||
458 | 549 | | |
459 | 550 | | |
460 | 551 | | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
465 | 565 | | |
466 | 566 | | |
467 | 567 | | |
| |||
811 | 911 | | |
812 | 912 | | |
813 | 913 | | |
| 914 | + | |
814 | 915 | | |
815 | 916 | | |
816 | 917 | | |
| |||
0 commit comments