Commit 6716e41
committed
Fix: Ensure correct mode is persisted for resumed tasks
Introduces a `modeIsFrozen` flag in the Task class. This flag is
set to `true` when a task completes or a completed task is resumed.
When `modeIsFrozen` is true, the task's `currentModeSlug` is
prevented from being updated if the user only changes the mode in
the UI without sending a new message. This avoids saving accidental
mode changes during history browsing.
If a new message is sent to continue a task that was frozen:
1. `modeIsFrozen` is reset to `false`.
2. The task's `currentModeSlug` is updated to match the actual
mode selected in the UI (obtained from `ClineProvider.getState()`).
3. This updated `currentModeSlug` is then used when saving task
messages and metadata, ensuring the persisted history accurately
reflects the mode in which the interaction occurred.
This resolves a bug where re-opening a completed task, changing the
mode, and then sending a message would result in the original (stale)
mode being persisted in the task history, instead of the new mode
used for the interaction.1 parent 694bfd0 commit 6716e41
1 file changed
+32
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
306 | 310 | | |
307 | | - | |
| 311 | + | |
308 | 312 | | |
309 | 313 | | |
310 | 314 | | |
| |||
484 | 488 | | |
485 | 489 | | |
486 | 490 | | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
487 | 499 | | |
488 | 500 | | |
489 | 501 | | |
| |||
1081 | 1093 | | |
1082 | 1094 | | |
1083 | 1095 | | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1084 | 1110 | | |
1085 | 1111 | | |
1086 | 1112 | | |
| |||
0 commit comments