Commit 8100ef1
committed
🤖 Replace time-based hack with explicit pendingStreamStart tracking
The original fix used time-based hacks (checking message age, forced
re-renders with timers) to prevent retry barrier flash. This was janky
and semantically incorrect.
New approach:
- Track pendingStreamStart flag in StreamingMessageAggregator
- Set true when user message is received
- Set false when stream-start arrives
- 30s timeout if stream never starts (safety net)
- hasInterruptedStream() checks this flag instead of message age
Benefits:
- Semantically correct: explicitly tracks "waiting for stream-start"
- No frontend timer hacks - state updates drive UI naturally
- Cleaner: removed ~24 LoC of hacky code, added ~60 LoC of proper state
- The 30s timeout is meaningful (truly stuck) vs arbitrary ("hide for 2s")
Changes:
- StreamingMessageAggregator: +25 LoC (flag, timer, handlers)
- WorkspaceStore: +3 LoC (expose via state)
- retryEligibility: -14 LoC (removed time checks, added flag param)
- AIView: -27 LoC (removed timer hack)
- Tests: Updated to use flag instead of timestamps
Net: +40 LoC but much cleaner architecture.1 parent 44f2d45 commit 8100ef1
File tree
6 files changed
+62
-57
lines changed- src
- components
- hooks
- stores
- utils/messages
6 files changed
+62
-57
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 55 | | |
59 | 56 | | |
60 | 57 | | |
| |||
214 | 211 | | |
215 | 212 | | |
216 | 213 | | |
217 | | - | |
| 214 | + | |
| 215 | + | |
218 | 216 | | |
219 | 217 | | |
220 | 218 | | |
| |||
245 | 243 | | |
246 | 244 | | |
247 | 245 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | 246 | | |
273 | 247 | | |
274 | 248 | | |
| |||
287 | 261 | | |
288 | 262 | | |
289 | 263 | | |
290 | | - | |
| 264 | + | |
| 265 | + | |
291 | 266 | | |
292 | 267 | | |
293 | 268 | | |
294 | 269 | | |
295 | 270 | | |
296 | 271 | | |
297 | | - | |
| 272 | + | |
298 | 273 | | |
299 | 274 | | |
300 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
| 349 | + | |
348 | 350 | | |
349 | 351 | | |
350 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
| |||
184 | 189 | | |
185 | 190 | | |
186 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
187 | 215 | | |
188 | 216 | | |
189 | 217 | | |
| |||
254 | 282 | | |
255 | 283 | | |
256 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
257 | 288 | | |
258 | 289 | | |
259 | 290 | | |
| |||
559 | 590 | | |
560 | 591 | | |
561 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
562 | 598 | | |
563 | 599 | | |
564 | 600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
| 131 | + | |
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
| |||
156 | 155 | | |
157 | 156 | | |
158 | 157 | | |
159 | | - | |
160 | 158 | | |
161 | 159 | | |
162 | | - | |
| 160 | + | |
163 | 161 | | |
164 | 162 | | |
165 | | - | |
166 | | - | |
| 163 | + | |
167 | 164 | | |
168 | 165 | | |
169 | 166 | | |
| |||
190 | 187 | | |
191 | 188 | | |
192 | 189 | | |
193 | | - | |
194 | 190 | | |
195 | 191 | | |
196 | | - | |
| 192 | + | |
197 | 193 | | |
198 | 194 | | |
199 | | - | |
200 | | - | |
| 195 | + | |
201 | 196 | | |
202 | 197 | | |
203 | 198 | | |
204 | 199 | | |
205 | 200 | | |
206 | 201 | | |
207 | 202 | | |
208 | | - | |
209 | 203 | | |
210 | 204 | | |
211 | | - | |
| 205 | + | |
212 | 206 | | |
213 | 207 | | |
214 | | - | |
215 | | - | |
| 208 | + | |
216 | 209 | | |
217 | 210 | | |
218 | 211 | | |
219 | 212 | | |
220 | 213 | | |
221 | 214 | | |
222 | 215 | | |
223 | | - | |
224 | 216 | | |
225 | 217 | | |
226 | | - | |
| 218 | + | |
227 | 219 | | |
228 | 220 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 30 | + | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
0 commit comments