Skip to content

Commit e15e830

Browse files
Formatting
Co-Authored-By: SteveSandersonMS <1101362+SteveSandersonMS@users.noreply.github.com>
1 parent fba31eb commit e15e830

3 files changed

Lines changed: 25 additions & 11 deletions

File tree

go/internal/e2e/session_fs_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestSessionFs(t *testing.T) {
3636
ctx.ConfigureForTest(t)
3737

3838
session, err := client.CreateSession(t.Context(), &copilot.SessionConfig{
39-
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
39+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
4040
CreateSessionFsHandler: createSessionFsHandler,
4141
})
4242
if err != nil {
@@ -71,7 +71,7 @@ func TestSessionFs(t *testing.T) {
7171
ctx.ConfigureForTest(t)
7272

7373
session1, err := client.CreateSession(t.Context(), &copilot.SessionConfig{
74-
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
74+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
7575
CreateSessionFsHandler: createSessionFsHandler,
7676
})
7777
if err != nil {
@@ -99,7 +99,7 @@ func TestSessionFs(t *testing.T) {
9999
}
100100

101101
session2, err := client.ResumeSession(t.Context(), sessionID, &copilot.ResumeSessionConfig{
102-
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
102+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
103103
CreateSessionFsHandler: createSessionFsHandler,
104104
})
105105
if err != nil {
@@ -159,7 +159,7 @@ func TestSessionFs(t *testing.T) {
159159

160160
suppliedFileContent := strings.Repeat("x", 100_000)
161161
session, err := client.CreateSession(t.Context(), &copilot.SessionConfig{
162-
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
162+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
163163
CreateSessionFsHandler: createSessionFsHandler,
164164
Tools: []copilot.Tool{
165165
copilot.DefineTool("get_big_string", "Returns a large string",
@@ -204,7 +204,7 @@ func TestSessionFs(t *testing.T) {
204204
ctx.ConfigureForTest(t)
205205

206206
session, err := client.CreateSession(t.Context(), &copilot.SessionConfig{
207-
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
207+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
208208
CreateSessionFsHandler: createSessionFsHandler,
209209
})
210210
if err != nil {

python/copilot/session.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class SessionFsConfig(TypedDict):
7373
session_state_path: str
7474
conventions: SessionFsConventions
7575

76+
7677
# ============================================================================
7778
# Attachment Types
7879
# ============================================================================

python/e2e/test_session_fs.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737

3838
@pytest_asyncio.fixture(scope="module", loop_scope="module")
3939
async def session_fs_client(ctx: E2ETestContext):
40-
github_token = "fake-token-for-e2e-tests" if os.environ.get("GITHUB_ACTIONS") == "true" else None
40+
github_token = (
41+
"fake-token-for-e2e-tests" if os.environ.get("GITHUB_ACTIONS") == "true" else None
42+
)
4143
client = CopilotClient(
4244
SubprocessConfig(
4345
cli_path=ctx.cli_path,
@@ -70,7 +72,9 @@ async def test_should_route_file_operations_through_the_session_fs_provider(
7072
assert "300" in msg.data.content
7173
await session.disconnect()
7274

73-
events_path = provider_path(provider_root, session.session_id, "/session-state/events.jsonl")
75+
events_path = provider_path(
76+
provider_root, session.session_id, "/session-state/events.jsonl"
77+
)
7478
assert "300" in events_path.read_text(encoding="utf-8")
7579

7680
async def test_should_load_session_data_from_fs_provider_on_resume(
@@ -106,7 +110,9 @@ async def test_should_load_session_data_from_fs_provider_on_resume(
106110
await session2.disconnect()
107111

108112
async def test_should_reject_setprovider_when_sessions_already_exist(self, ctx: E2ETestContext):
109-
github_token = "fake-token-for-e2e-tests" if os.environ.get("GITHUB_ACTIONS") == "true" else None
113+
github_token = (
114+
"fake-token-for-e2e-tests" if os.environ.get("GITHUB_ACTIONS") == "true" else None
115+
)
110116
client1 = CopilotClient(
111117
SubprocessConfig(
112118
cli_path=ctx.cli_path,
@@ -158,7 +164,9 @@ def get_big_string() -> str:
158164
tools=[get_big_string],
159165
)
160166

161-
await session.send_and_wait("Call the get_big_string tool and reply with the word DONE only.")
167+
await session.send_and_wait(
168+
"Call the get_big_string tool and reply with the word DONE only."
169+
)
162170

163171
messages = await session.get_messages()
164172
tool_result = find_tool_call_result(messages, "get_big_string")
@@ -192,7 +200,9 @@ def on_event(event: SessionEvent):
192200

193201
await session.send_and_wait("What is 2+2?")
194202

195-
events_path = provider_path(provider_root, session.session_id, "/session-state/events.jsonl")
203+
events_path = provider_path(
204+
provider_root, session.session_id, "/session-state/events.jsonl"
205+
)
196206
await wait_for_path(events_path)
197207
assert "checkpointNumber" not in events_path.read_text(encoding="utf-8")
198208

@@ -297,7 +307,10 @@ def provider_path(provider_root: Path, session_id: str, path: str) -> Path:
297307

298308
def find_tool_call_result(messages: list[SessionEvent], tool_name: str) -> str | None:
299309
for message in messages:
300-
if message.type.value == "tool.execution_complete" and message.data.tool_call_id is not None:
310+
if (
311+
message.type.value == "tool.execution_complete"
312+
and message.data.tool_call_id is not None
313+
):
301314
if find_tool_name(messages, message.data.tool_call_id) == tool_name:
302315
return message.data.result.content if message.data.result is not None else None
303316
return None

0 commit comments

Comments
 (0)