

























@@ -409,6 +409,7 @@ describe("stuck session diagnostics threshold", () => {
409409it("reports long-running sessions separately when active work is making progress", () => {
410410const events: DiagnosticEventPayload[] = [];
411411const recoverStuckSession = vi.fn();
412+const warnSpy = vi.spyOn(diagnosticLogger, "warn").mockImplementation(() => undefined);
412413const unsubscribe = onDiagnosticEvent((event) => {
413414events.push(event);
414415});
@@ -439,6 +440,7 @@ describe("stuck session diagnostics threshold", () => {
439440reason: "active_work",
440441activeWorkKind: "embedded_run",
441442});
443+expect(warnSpy).not.toHaveBeenCalledWith(expect.stringContaining("long-running session:"));
442444expect(recoverStuckSession).not.toHaveBeenCalled();
443445});
444446@@ -671,6 +673,41 @@ describe("stuck session diagnostics threshold", () => {
671673);
672674});
673675676+it("keeps transient event-loop max spikes debug-only when only background work is active", () => {
677+const warnSpy = vi.spyOn(diagnosticLogger, "warn").mockImplementation(() => undefined);
678+679+startDiagnosticHeartbeat(
680+{
681+diagnostics: {
682+enabled: true,
683+},
684+},
685+{
686+emitMemorySample: createEmitMemorySampleMock(),
687+sampleLiveness: () => ({
688+reasons: ["event_loop_delay"],
689+intervalMs: 30_000,
690+eventLoopDelayP99Ms: 21,
691+eventLoopDelayMaxMs: 1_500,
692+}),
693+},
694+);
695+696+logSessionStateChange({ sessionId: "s1", sessionKey: "main", state: "processing" });
697+vi.advanceTimersByTime(30_000);
698+699+expect(warnSpy).not.toHaveBeenCalledWith(expect.stringContaining("liveness warning:"));
700+expect(getDiagnosticStabilitySnapshot({ limit: 10 }).events).toContainEqual(
701+expect.objectContaining({
702+type: "diagnostic.liveness.warning",
703+level: "warning",
704+active: 1,
705+waiting: 0,
706+queued: 0,
707+}),
708+);
709+});
710+674711it("does not let idle liveness samples suppress later active-work warnings", () => {
675712const warnSpy = vi.spyOn(diagnosticLogger, "warn").mockImplementation(() => undefined);
676713此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。