Skip to content

Commit f8b1c57

Browse files
authored
test(agent): strengthen compact continuation coverage
Document why cloud compaction needs a hidden follow-up and assert the command returns the continuation turn's final stop reason. Generated-By: PostHog Code Task-Id: 233a983e-daa3-4d81-af56-bb43488687ab
1 parent e22ec02 commit f8b1c57

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

packages/agent/src/server/agent-server.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,10 @@ describe("AgentServer HTTP Mode", () => {
14631463
});
14641464

14651465
expect(response.status).toBe(200);
1466+
const body = (await response.json()) as {
1467+
result?: { stopReason?: string };
1468+
};
1469+
expect(body.result?.stopReason).toBe("end_turn");
14661470
expect(prompt).toHaveBeenCalledTimes(2);
14671471
expect(prompt.mock.calls[0]?.[0].prompt).toEqual([
14681472
{

packages/agent/src/server/agent-server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,8 @@ export class AgentServer {
969969
result.stopReason === "end_turn" &&
970970
isManualCompactPrompt(prompt)
971971
) {
972+
// `/compact` is an SDK-local command, so without a follow-up the
973+
// cloud run reports completion before the model resumes the task.
972974
this.recordTurnUsage(result.usage);
973975
result = await this.promptWithUpstreamRetry({
974976
sessionId: this.session.acpSessionId,

0 commit comments

Comments
 (0)