Skip to content

Commit ac11ff3

Browse files
Restore compact fallback and fix Python RPC tests
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent cb3c273 commit ac11ff3

File tree

9 files changed

+173
-25
lines changed

9 files changed

+173
-25
lines changed

dotnet/src/Generated/Rpc.cs

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/rpc/generated_rpc.go

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nodejs/src/generated/rpc.ts

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/copilot/generated/rpc.py

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/e2e/test_agent_and_compact_rpc.py

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

55
from copilot import CopilotClient
66
from copilot.client import SubprocessConfig
7-
from copilot.generated.rpc import SessionAgentSelectParams
7+
from copilot.generated.rpc import AgentSelectRequest
88
from copilot.session import PermissionHandler
99

1010
from .testharness import CLI_PATH, E2ETestContext
@@ -99,7 +99,7 @@ async def test_should_select_and_get_current_agent(self):
9999

100100
# Select the agent
101101
select_result = await session.rpc.agent.select(
102-
SessionAgentSelectParams(name="test-agent")
102+
AgentSelectRequest(name="test-agent")
103103
)
104104
assert select_result.agent is not None
105105
assert select_result.agent.name == "test-agent"
@@ -135,7 +135,7 @@ async def test_should_deselect_current_agent(self):
135135
)
136136

137137
# Select then deselect
138-
await session.rpc.agent.select(SessionAgentSelectParams(name="test-agent"))
138+
await session.rpc.agent.select(AgentSelectRequest(name="test-agent"))
139139
await session.rpc.agent.deselect()
140140

141141
# Verify no agent is selected

python/e2e/test_rpc.py

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

55
from copilot import CopilotClient
66
from copilot.client import SubprocessConfig
7-
from copilot.generated.rpc import PingParams
7+
from copilot.generated.rpc import PingRequest
88
from copilot.session import PermissionHandler
99

1010
from .testharness import CLI_PATH, E2ETestContext
@@ -21,7 +21,7 @@ async def test_should_call_rpc_ping_with_typed_params(self):
2121
try:
2222
await client.start()
2323

24-
result = await client.rpc.ping(PingParams(message="typed rpc test"))
24+
result = await client.rpc.ping(PingRequest(message="typed rpc test"))
2525
assert result.message == "pong: typed rpc test"
2626
assert isinstance(result.timestamp, (int, float))
2727

@@ -150,7 +150,7 @@ async def test_get_and_set_session_mode(self):
150150
@pytest.mark.asyncio
151151
async def test_read_update_and_delete_plan(self):
152152
"""Test reading, updating, and deleting plan"""
153-
from copilot.generated.rpc import SessionPlanUpdateParams
153+
from copilot.generated.rpc import PlanUpdateRequest
154154

155155
client = CopilotClient(SubprocessConfig(cli_path=CLI_PATH, use_stdio=True))
156156

@@ -167,7 +167,7 @@ async def test_read_update_and_delete_plan(self):
167167

168168
# Create/update plan
169169
plan_content = "# Test Plan\n\n- Step 1\n- Step 2"
170-
await session.rpc.plan.update(SessionPlanUpdateParams(content=plan_content))
170+
await session.rpc.plan.update(PlanUpdateRequest(content=plan_content))
171171

172172
# Verify plan exists and has correct content
173173
after_update = await session.rpc.plan.read()
@@ -191,8 +191,8 @@ async def test_read_update_and_delete_plan(self):
191191
async def test_create_list_and_read_workspace_files(self):
192192
"""Test creating, listing, and reading workspace files"""
193193
from copilot.generated.rpc import (
194-
SessionWorkspaceCreateFileParams,
195-
SessionWorkspaceReadFileParams,
194+
WorkspaceCreateFileRequest,
195+
WorkspaceReadFileRequest,
196196
)
197197

198198
client = CopilotClient(SubprocessConfig(cli_path=CLI_PATH, use_stdio=True))
@@ -210,7 +210,7 @@ async def test_create_list_and_read_workspace_files(self):
210210
# Create a file
211211
file_content = "Hello, workspace!"
212212
await session.rpc.workspace.create_file(
213-
SessionWorkspaceCreateFileParams(content=file_content, path="test.txt")
213+
WorkspaceCreateFileRequest(content=file_content, path="test.txt")
214214
)
215215

216216
# List files
@@ -219,13 +219,13 @@ async def test_create_list_and_read_workspace_files(self):
219219

220220
# Read file
221221
read_result = await session.rpc.workspace.read_file(
222-
SessionWorkspaceReadFileParams(path="test.txt")
222+
WorkspaceReadFileRequest(path="test.txt")
223223
)
224224
assert read_result.content == file_content
225225

226226
# Create nested file
227227
await session.rpc.workspace.create_file(
228-
SessionWorkspaceCreateFileParams(content="Nested content", path="subdir/nested.txt")
228+
WorkspaceCreateFileRequest(content="Nested content", path="subdir/nested.txt")
229229
)
230230

231231
after_nested = await session.rpc.workspace.list_files()

python/test_rpc_timeout.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
from copilot.generated.rpc import (
88
FleetApi,
9+
FleetStartRequest,
910
ModeApi,
1011
ModeSetRequest,
1112
PlanApi,
1213
ServerModelsApi,
1314
ServerToolsApi,
14-
SessionFleetStartParams,
1515
SessionMode,
16-
ToolsListParams,
16+
ToolsListRequest,
1717
)
1818

1919

@@ -33,7 +33,7 @@ async def test_default_timeout_not_forwarded(self):
3333
client.request = AsyncMock(return_value={"started": True})
3434
api = FleetApi(client, "sess-1")
3535

36-
await api.start(SessionFleetStartParams(prompt="go"))
36+
await api.start(FleetStartRequest(prompt="go"))
3737

3838
client.request.assert_called_once()
3939
_, kwargs = client.request.call_args
@@ -45,7 +45,7 @@ async def test_custom_timeout_forwarded(self):
4545
client.request = AsyncMock(return_value={"started": True})
4646
api = FleetApi(client, "sess-1")
4747

48-
await api.start(SessionFleetStartParams(prompt="go"), timeout=600.0)
48+
await api.start(FleetStartRequest(prompt="go"), timeout=600.0)
4949

5050
_, kwargs = client.request.call_args
5151
assert kwargs["timeout"] == 600.0
@@ -93,7 +93,7 @@ async def test_timeout_on_server_params_method(self):
9393
client.request = AsyncMock(return_value={"tools": []})
9494
api = ServerToolsApi(client)
9595

96-
await api.list(ToolsListParams(), timeout=60.0)
96+
await api.list(ToolsListRequest(), timeout=60.0)
9797

9898
_, kwargs = client.request.call_args
9999
assert kwargs["timeout"] == 60.0
@@ -104,7 +104,7 @@ async def test_default_timeout_on_server_params_method(self):
104104
client.request = AsyncMock(return_value={"tools": []})
105105
api = ServerToolsApi(client)
106106

107-
await api.list(ToolsListParams())
107+
await api.list(ToolsListRequest())
108108

109109
_, kwargs = client.request.call_args
110110
assert "timeout" not in kwargs

test/snapshots/agent_and_compact_rpc/should_compact_session_history_after_messages.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,58 @@ conversations:
88
content: What is 2+2?
99
- role: assistant
1010
content: 2+2 = 4
11+
- role: user
12+
content: ${compaction_prompt}
13+
- role: assistant
14+
content: >-
15+
<overview>
16+
17+
The user asked a simple arithmetic question: "What is 2+2?" This was answered directly (4). No technical work,
18+
coding tasks, or file modifications were performed. This appears to have been a minimal test interaction with
19+
no substantive goals or technical requirements.
20+
21+
</overview>
22+
23+
24+
<history>
25+
26+
1. The user asked "What is 2+2?"
27+
- Provided the answer: 4
28+
- No further actions were taken or requested
29+
</history>
30+
31+
32+
<work_done>
33+
34+
No files were created, modified, or deleted. No technical tasks were performed. The conversation consisted
35+
solely of answering a basic arithmetic question.
36+
37+
38+
Current state: No active work in progress.
39+
40+
</work_done>
41+
42+
43+
<technical_details>
44+
45+
No technical concepts, decisions, or issues were encountered in this conversation. This was a straightforward
46+
arithmetic question with no technical context.
47+
48+
</technical_details>
49+
50+
51+
<important_files>
52+
53+
No files were involved in this conversation.
54+
55+
</important_files>
56+
57+
58+
<next_steps>
59+
60+
No pending work or tasks. The user's question was fully addressed. Awaiting new requests or instructions.
61+
62+
</next_steps>
63+
64+
65+
<checkpoint_title>Simple arithmetic question answered</checkpoint_title>

test/snapshots/session_fs/should_succeed_with_compaction_while_using_sessionfs.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,62 @@ conversations:
88
content: What is 2+2?
99
- role: assistant
1010
content: 2 + 2 = 4
11+
- role: user
12+
content: ${compaction_prompt}
13+
- role: assistant
14+
content: >-
15+
<overview>
16+
17+
The user asked a simple arithmetic question ("What is 2+2?") which I answered correctly (4). No coding work,
18+
file modifications, or technical implementation was requested or performed. This appears to be a minimal test
19+
interaction before the conversation history is compacted.
20+
21+
</overview>
22+
23+
24+
<history>
25+
26+
1. The user asked "What is 2+2?"
27+
- I provided the arithmetic answer: 4
28+
- No follow-up questions or additional requests were made
29+
30+
2. The user requested a detailed summary for conversation compaction
31+
- Currently preparing this checkpoint summary
32+
</history>
33+
34+
35+
<work_done>
36+
37+
No files were created, modified, or deleted. No code changes were made. No tasks were assigned or completed
38+
beyond answering a basic arithmetic question.
39+
40+
41+
Current state: No active work in progress. The conversation consisted only of a single question and answer
42+
exchange.
43+
44+
</work_done>
45+
46+
47+
<technical_details>
48+
49+
No technical work was performed. No issues were encountered. No architectural decisions were made. No code was
50+
explored or modified.
51+
52+
</technical_details>
53+
54+
55+
<important_files>
56+
57+
No files were accessed or are relevant to this conversation.
58+
59+
</important_files>
60+
61+
62+
<next_steps>
63+
64+
No pending work. No tasks were assigned. The user may continue with new requests after the history compaction.
65+
66+
</next_steps>
67+
68+
69+
<checkpoint_title>Answered arithmetic question</checkpoint_title>

0 commit comments

Comments
 (0)