Skip to content

Commit 886e5aa

Browse files
Fix flaky abort test: approve permissions to avoid race with deny-by-default
The test_should_abort_a_session test relies on the shell tool actually starting execution before the abort is sent. With deny-by-default permissions (github#509), a race exists: if the permission denial response arrives before the abort, the tool result becomes 'Permission denied' instead of the snapshotted 'interrupted' message, causing the replay proxy to fail matching subsequent requests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 970db18 commit 886e5aa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/e2e/test_session.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pytest
66

7-
from copilot import CopilotClient
7+
from copilot import CopilotClient, PermissionHandler
88
from copilot.types import Tool
99

1010
from .testharness import E2ETestContext, get_final_assistant_message, get_next_event_of_type
@@ -333,7 +333,9 @@ async def test_should_resume_session_with_custom_provider(self, ctx: E2ETestCont
333333
async def test_should_abort_a_session(self, ctx: E2ETestContext):
334334
import asyncio
335335

336-
session = await ctx.client.create_session()
336+
session = await ctx.client.create_session(
337+
{"on_permission_request": PermissionHandler.approve_all}
338+
)
337339

338340
# Set up event listeners BEFORE sending to avoid race conditions
339341
wait_for_tool_start = asyncio.create_task(

0 commit comments

Comments
 (0)