Commit 5f68516
committed
fix: prevent empty history corruption during cancel/resume operations
- Make resume tolerant of empty API conversation history
- Standardize reads using helper functions instead of direct JSON.parse
- Add transaction helper for safe read-modify-write operations
- Guard against unintentional empty writes with allowEmpty flag
This fixes the issue where canceling during model's thinking/streaming
phase could leave the API history file as an empty array ([]), causing
the chat to lock when resuming.
Fixes #8153 and #53331 parent 87b45de commit 5f68516
File tree
5 files changed
+82
-13
lines changed- src/core
- task-persistence
- task
- webview
- __tests__
5 files changed
+82
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 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 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
586 | 595 | | |
587 | 596 | | |
588 | 597 | | |
| |||
1436 | 1445 | | |
1437 | 1446 | | |
1438 | 1447 | | |
1439 | | - | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
1440 | 1457 | | |
1441 | 1458 | | |
1442 | 1459 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
918 | 918 | | |
919 | 919 | | |
920 | 920 | | |
| 921 | + | |
921 | 922 | | |
922 | 923 | | |
| 924 | + | |
923 | 925 | | |
924 | 926 | | |
925 | 927 | | |
| |||
1453 | 1455 | | |
1454 | 1456 | | |
1455 | 1457 | | |
| 1458 | + | |
1456 | 1459 | | |
1457 | 1460 | | |
1458 | 1461 | | |
1459 | 1462 | | |
1460 | 1463 | | |
1461 | 1464 | | |
1462 | 1465 | | |
1463 | | - | |
| 1466 | + | |
| 1467 | + | |
1464 | 1468 | | |
1465 | 1469 | | |
1466 | 1470 | | |
| |||
Lines changed: 13 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
207 | 210 | | |
208 | 211 | | |
209 | 212 | | |
| |||
248 | 251 | | |
249 | 252 | | |
250 | 253 | | |
251 | | - | |
| 254 | + | |
252 | 255 | | |
253 | 256 | | |
254 | 257 | | |
| |||
385 | 388 | | |
386 | 389 | | |
387 | 390 | | |
388 | | - | |
| 391 | + | |
389 | 392 | | |
390 | 393 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
| |||
0 commit comments