Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(chatRuntime): cover detached approval not displacing parent turn

Steven Enamakel11ce53e1eb70
diff --git a/app/src/store/chatRuntimeSlice.test.ts b/app/src/store/chatRuntimeSlice.test.ts
index b48cfb8c28..1299f8a8ec 100644
--- a/app/src/store/chatRuntimeSlice.test.ts
+++ b/app/src/store/chatRuntimeSlice.test.ts
@@ -1081,6 +1081,20 @@ describe('detached approvals', () => {
expect(shown(store)).toBeUndefined();
});
+ it("never displaces the parent turn's waiting approval with a detached one", () => {
+ const store = makeStore();
+ store.dispatch(
+ setPendingApprovalForThread({
+ threadId: 't1',
+ approval: { requestId: 'req-main', toolName: 'shell', message: 'Run ls' },
+ })
+ );
+ store.dispatch(setPendingApprovalForThread({ threadId: 't1', approval: detached }));
+ expect(shown(store)).toBe('req-main');
+ store.dispatch(clearTurnApprovalForThread({ threadId: 't1' }));
+ expect(shown(store)).toBe('req-sub');
+ });
+
it("shows the parent turn's own approval first and keeps the detached one queued", () => {
const store = makeStore();
store.dispatch(setPendingApprovalForThread({ threadId: 't1', approval: detached }));