Skip to content

Commit ce6b64d

Browse files
Copilotstephentoub
andauthored
Update tests and docs: compaction.compact → history.compact
Agent-Logs-Url: https://github.com/github/copilot-sdk/sessions/3afab108-c1a1-4942-9bce-f4c96ce1936a Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
1 parent d978741 commit ce6b64d

9 files changed

Lines changed: 10 additions & 10 deletions

File tree

docs/troubleshooting/compatibility.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The Copilot SDK communicates with the CLI via JSON-RPC protocol. Features must b
8686
| **Experimental** | | |
8787
| Agent management | `session.rpc.agent.*` | List, select, deselect, get current agent |
8888
| Fleet mode | `session.rpc.fleet.start()` | Parallel sub-agent execution |
89-
| Manual compaction | `session.rpc.compaction.compact()` | Trigger compaction on demand |
89+
| Manual compaction | `session.rpc.history.compact()` | Trigger compaction on demand |
9090

9191
### ❌ Not Available in SDK (CLI-Only)
9292

@@ -222,7 +222,7 @@ const session = await client.createSession({
222222
});
223223

224224
// Manual compaction (experimental)
225-
const result = await session.rpc.compaction.compact();
225+
const result = await session.rpc.history.compact();
226226
console.log(`Removed ${result.tokensRemoved} tokens, ${result.messagesRemoved} messages`);
227227
```
228228

dotnet/test/AgentAndCompactRpcTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public async Task Should_Compact_Session_History_After_Messages()
135135
await session.SendAndWaitAsync(new MessageOptions { Prompt = "What is 2+2?" });
136136

137137
// Compact the session
138-
var result = await session.Rpc.Compaction.CompactAsync();
138+
var result = await session.Rpc.History.CompactAsync();
139139
Assert.NotNull(result);
140140
}
141141
}

dotnet/test/SessionFsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public async Task Should_Succeed_With_Compaction_While_Using_SessionFs()
211211
var contentBefore = await ReadAllTextSharedAsync(eventsPath);
212212
Assert.DoesNotContain("checkpointNumber", contentBefore);
213213

214-
await session.Rpc.Compaction.CompactAsync();
214+
await session.Rpc.History.CompactAsync();
215215
await WaitForConditionAsync(() => compactionEvent is not null, TimeSpan.FromSeconds(30));
216216
Assert.True(compactionEvent!.Data.Success);
217217

go/internal/e2e/agent_and_compact_rpc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func TestSessionCompactionRpc(t *testing.T) {
281281
}
282282

283283
// Compact the session
284-
result, err := session.RPC.Compaction.Compact(t.Context())
284+
result, err := session.RPC.History.Compact(t.Context())
285285
if err != nil {
286286
t.Fatalf("Failed to compact session: %v", err)
287287
}

go/internal/e2e/session_fs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func TestSessionFs(t *testing.T) {
233233
t.Fatalf("Expected events file to not contain checkpointNumber before compaction")
234234
}
235235

236-
compactionResult, err := session.RPC.Compaction.Compact(t.Context())
236+
compactionResult, err := session.RPC.History.Compact(t.Context())
237237
if err != nil {
238238
t.Fatalf("Failed to compact session: %v", err)
239239
}

nodejs/test/e2e/agent_and_compact_rpc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe("Session Compact RPC", async () => {
139139
await session.sendAndWait({ prompt: "What is 2+2?" });
140140

141141
// Compact the session
142-
const result = await session.rpc.compaction.compact();
142+
const result = await session.rpc.history.compact();
143143
expect(typeof result.success).toBe("boolean");
144144
expect(typeof result.tokensRemoved).toBe("number");
145145
expect(typeof result.messagesRemoved).toBe("number");

nodejs/test/e2e/session_fs.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe("Session Fs", async () => {
139139
const contentBefore = await provider.readFile(eventsPath, "utf8");
140140
expect(contentBefore).not.toContain("checkpointNumber");
141141

142-
await session.rpc.compaction.compact();
142+
await session.rpc.history.compact();
143143
await expect.poll(() => compactionEvent).toBeDefined();
144144
expect(compactionEvent!.data.success).toBe(true);
145145

python/e2e/test_agent_and_compact_rpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ async def test_should_compact_session_history_after_messages(self, ctx: E2ETestC
185185
await session.send_and_wait("What is 2+2?")
186186

187187
# Compact the session
188-
result = await session.rpc.compaction.compact()
188+
result = await session.rpc.history.compact()
189189
assert isinstance(result.success, bool)
190190
assert isinstance(result.tokens_removed, (int, float))
191191
assert isinstance(result.messages_removed, (int, float))

python/e2e/test_session_fs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def on_event(event: SessionEvent):
206206
await wait_for_path(events_path)
207207
assert "checkpointNumber" not in events_path.read_text(encoding="utf-8")
208208

209-
result = await session.rpc.compaction.compact()
209+
result = await session.rpc.history.compact()
210210
await asyncio.wait_for(compaction_event.wait(), timeout=5.0)
211211
assert result.success is True
212212
assert compaction_success is True

0 commit comments

Comments
 (0)