Skip to content

Commit c633dac

Browse files
committed
fix(delegation): guard concurrent rollback pop and add transition tests
1 parent d07701a commit c633dac

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/core/webview/ClineProvider.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3552,7 +3552,11 @@ export class ClineProvider
35523552
}`,
35533553
)
35543554
try {
3555-
await this.removeClineFromStack({ skipDelegationRepair: true })
3555+
// Only pop the stack if the child we just created is still on top.
3556+
// A concurrent delegation could have pushed another child since we created ours.
3557+
if (this.getCurrentTask()?.taskId === child.taskId) {
3558+
await this.removeClineFromStack({ skipDelegationRepair: true })
3559+
}
35563560
} catch (cleanupError) {
35573561
this.log(
35583562
`[delegateParentAndOpenChild] Failed to close paused child ${child.taskId} during rollback: ${

0 commit comments

Comments
 (0)