From 240e8892bcd78bf3e95bffec357101bfc4daa5aa Mon Sep 17 00:00:00 2001 From: qqqys Date: Wed, 17 Jun 2026 16:26:00 +0800 Subject: [PATCH] fix(loop): update Session token-limit test for the disable() breaker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI regression from the disable() refactor (7f488e6c6): the token-limit breaker now calls scheduler.disable() instead of stop(), but the cron-fired token-limit test still asserted scheduler.stop and its mock scheduler had no disable() — so the call hit an undefined method and the stop spy saw 0 calls. Missed because the prior change ran core tests + cli tsc but not the cli test suite (Session.test.ts is cli). Add disable() to the mock and assert it's called once. The breaker disables (permanent for the session, so a later LoopWakeup is rejected), which internally stops too. Co-authored-by: Qwen-Coder --- packages/cli/src/acp-integration/session/Session.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/acp-integration/session/Session.test.ts b/packages/cli/src/acp-integration/session/Session.test.ts index f720b4cbba..354c01699b 100644 --- a/packages/cli/src/acp-integration/session/Session.test.ts +++ b/packages/cli/src/acp-integration/session/Session.test.ts @@ -3259,6 +3259,7 @@ describe('Session', () => { callback({ prompt: 'scheduled prompt' }); }), stop: vi.fn(), + disable: vi.fn(), getExitSummary: vi.fn().mockReturnValue(undefined), }; mockConfig.isCronEnabled = vi.fn().mockReturnValue(true); @@ -3308,7 +3309,9 @@ describe('Session', () => { }, }, }); - expect(scheduler.stop).toHaveBeenCalledTimes(1); + // Token limit disables the scheduler (permanent for the session, so + // a later LoopWakeup is rejected), not just stops it. + expect(scheduler.disable).toHaveBeenCalledTimes(1); await vi.waitFor(() => { expect(mockClient.sessionUpdate).toHaveBeenCalledWith({ sessionId: 'test-session-id',