fix: prevent sending control request when query is closed

This commit is contained in:
mingholy.lmh
2025-12-05 18:46:51 +08:00
parent 46478e5dd3
commit c218048551
3 changed files with 20 additions and 24 deletions

View File

@@ -555,6 +555,15 @@ describe('Permission Control (E2E)', () => {
...SHARED_TEST_OPTIONS,
cwd: testDir,
permissionMode: 'default',
timeout: {
/**
* We use a short control request timeout and
* wait till the time exceeded to test if
* an immediate close() will raise an query close
* error and no other uncaught timeout error
*/
controlRequest: 5000,
},
},
});
@@ -563,7 +572,9 @@ describe('Permission Control (E2E)', () => {
await expect(q.setPermissionMode('yolo')).rejects.toThrow(
'Query is closed',
);
});
await new Promise((resolve) => setTimeout(resolve, 8000));
}, 10_000);
});
describe('canUseTool and setPermissionMode integration', () => {