diff options
Diffstat (limited to 'src/core/metrics')
| -rw-r--r-- | src/core/metrics/cache-timer.test.ts | 15 | ||||
| -rw-r--r-- | src/core/metrics/cache-timer.ts | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/core/metrics/cache-timer.test.ts b/src/core/metrics/cache-timer.test.ts index e55eff4..d450135 100644 --- a/src/core/metrics/cache-timer.test.ts +++ b/src/core/metrics/cache-timer.test.ts @@ -32,6 +32,11 @@ const ev = { turnId, delta: "x", }), + reasoningEnd: (turnId: string): AgentEvent => ({ + type: "reasoning-end", + conversationId: C, + turnId, + }), call: (turnId: string, stepId: string, toolCallId: string): AgentEvent => ({ type: "tool-call", conversationId: C, @@ -151,6 +156,16 @@ describe("foldCacheTimerEvent — step gaps", () => { expect(s.stepStamps.get("t1#0")).toBe(8_000); }); + it("treats a reasoning-end boundary as resumed output too", () => { + const s = run([ + [0, ev.call("t1", "t1#0", "a")], + [1_000, ev.stepComplete("t1", "t1#0")], + [9_000, ev.reasoningEnd("t1")], + ]); + expect(s.running).toBeNull(); + expect(s.stepStamps.get("t1#0")).toBe(8_000); + }); + it("stops on a tool-call or usage from a DIFFERENT step, not its own", () => { const base = run([ [0, ev.call("t1", "t1#0", "a")], diff --git a/src/core/metrics/cache-timer.ts b/src/core/metrics/cache-timer.ts index 66d5fac..3d7270d 100644 --- a/src/core/metrics/cache-timer.ts +++ b/src/core/metrics/cache-timer.ts @@ -208,6 +208,7 @@ export function foldCacheTimerEvent( case "text-delta": case "reasoning-delta": + case "reasoning-end": case "provider-retry": // Output (or a retry) from the next request: the gap is over. return r?.kind === "step" ? stopStep(state, now) : state; |
