Commit c8911ca
committed
fix(orchestrator): always restore parent mode after subtask completion
Previously, when an orchestrated workflow dispatched a subtask (e.g., in code or architect mode) and the subtask completed, the parent orchestrator task would resume execution but remain in the child mode instead of reverting to orchestrator mode. This caused confusion and improper workflows, as documented in issues #4896, #5478, and #5747.
The fix ensures that, upon subtask completion (including cancellations or API aborts), the parent task's mode is explicitly restored to the `pausedModeSlug` saved before launching the subtask. All possible subtask completion and stack handling code paths are covered, making regressions unlikely.
Also adds a focused test to verify mode restoration logic.
Rationale: Correct orchestrator handoff is critical to multi-mode workflows. This change ensures state isn't leaked between parent/child, and is robust against all completion/cancellation scenarios.1 parent 2c8c140 commit c8911ca
File tree
2 files changed
+76
-0
lines changed- src/core/task
- __tests__
2 files changed
+76
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1623 | 1623 | | |
1624 | 1624 | | |
1625 | 1625 | | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
1626 | 1631 | | |
1627 | 1632 | | |
1628 | 1633 | | |
| |||
Lines changed: 71 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
0 commit comments