


























@@ -219,8 +219,28 @@ describe("runReplyAgent heartbeat followup guard", () => {
219219expect(state.runEmbeddedPiAgentMock).not.toHaveBeenCalled();
220220});
221221222+it("keeps typing alive when a followup is queued behind a live active run", async () => {
223+const { run, typing } = createMinimalRun({
224+opts: { isHeartbeat: false },
225+isActive: true,
226+isRunActive: () => true,
227+shouldFollowup: true,
228+resolvedQueueMode: "collect",
229+});
230+231+const result = await run();
232+233+expect(result).toBeUndefined();
234+expect(vi.mocked(enqueueFollowupRun)).toHaveBeenCalledTimes(1);
235+expect(vi.mocked(scheduleFollowupDrain)).not.toHaveBeenCalled();
236+expect(state.runEmbeddedPiAgentMock).not.toHaveBeenCalled();
237+expect(typing.startTypingLoop).toHaveBeenCalledTimes(1);
238+expect(typing.refreshTypingTtl).toHaveBeenCalledTimes(1);
239+expect(typing.cleanup).not.toHaveBeenCalled();
240+});
241+222242it("starts draining immediately when the active snapshot is already stale", async () => {
223-const { run } = createMinimalRun({
243+const { run, typing } = createMinimalRun({
224244opts: { isHeartbeat: false },
225245isActive: true,
226246isRunActive: () => false,
@@ -234,6 +254,7 @@ describe("runReplyAgent heartbeat followup guard", () => {
234254expect(vi.mocked(enqueueFollowupRun)).toHaveBeenCalledTimes(1);
235255expect(vi.mocked(scheduleFollowupDrain)).toHaveBeenCalledTimes(1);
236256expect(state.runEmbeddedPiAgentMock).not.toHaveBeenCalled();
257+expect(typing.cleanup).toHaveBeenCalledTimes(1);
237258});
238259239260it("drains followup queue when an unexpected exception escapes the run path", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。