fix(coding-agent): mark retrying agent end events
This commit is contained in:
@@ -113,14 +113,13 @@ describe("AgentSession auto-compaction queue resume", () => {
|
||||
|
||||
const runAutoCompaction = (
|
||||
session as unknown as {
|
||||
_runAutoCompaction: (reason: "overflow" | "threshold", willRetry: boolean) => Promise<void>;
|
||||
_runAutoCompaction: (reason: "overflow" | "threshold", willRetry: boolean) => Promise<boolean>;
|
||||
}
|
||||
)._runAutoCompaction.bind(session);
|
||||
|
||||
await runAutoCompaction("threshold", false);
|
||||
await vi.advanceTimersByTimeAsync(100);
|
||||
await expect(runAutoCompaction("threshold", false)).resolves.toBe(true);
|
||||
|
||||
expect(continueSpy).toHaveBeenCalledTimes(1);
|
||||
expect(continueSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should not compact repeatedly after overflow recovery already attempted", async () => {
|
||||
|
||||
@@ -47,6 +47,7 @@ describe("AgentSession retry and event characterization", () => {
|
||||
await harness.session.prompt("test");
|
||||
|
||||
expect(retryEvents).toEqual(["start:1", "end:true"]);
|
||||
expect(harness.eventsOfType("agent_end").map((event) => event.willRetry)).toEqual([true, false]);
|
||||
expect(harness.faux.state.callCount).toBe(2);
|
||||
expect(harness.session.isRetrying).toBe(false);
|
||||
});
|
||||
@@ -90,6 +91,7 @@ describe("AgentSession retry and event characterization", () => {
|
||||
await harness.session.prompt("test");
|
||||
|
||||
expect(retryEvents).toEqual(["start:1", "start:2", "end:false"]);
|
||||
expect(harness.eventsOfType("agent_end").map((event) => event.willRetry)).toEqual([true, true, false]);
|
||||
expect(harness.faux.state.callCount).toBe(3);
|
||||
expect(harness.session.isRetrying).toBe(false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user