diff --git a/src/agents/pi-embedded-helpers.test.ts b/src/agents/pi-embedded-helpers.test.ts index 3b3f5e3fb..c7d06d416 100644 --- a/src/agents/pi-embedded-helpers.test.ts +++ b/src/agents/pi-embedded-helpers.test.ts @@ -226,7 +226,7 @@ describe("isContextOverflowError", () => { describe("isCompactionFailureError", () => { it("matches compaction overflow failures", () => { const samples = [ - "Context overflow: Summarization failed: 400 {\"message\":\"prompt is too long\"}", + 'Context overflow: Summarization failed: 400 {"message":"prompt is too long"}', "auto-compaction failed due to context overflow", "Compaction failed: prompt is too long", ]; @@ -236,9 +236,9 @@ describe("isCompactionFailureError", () => { }); it("ignores non-compaction overflow errors", () => { - expect( - isCompactionFailureError("Context overflow: prompt too large"), - ).toBe(false); + expect(isCompactionFailureError("Context overflow: prompt too large")).toBe( + false, + ); expect(isCompactionFailureError("rate limit exceeded")).toBe(false); }); }); diff --git a/src/auto-reply/reply/agent-runner.heartbeat-typing.test.ts b/src/auto-reply/reply/agent-runner.heartbeat-typing.test.ts index 4375d44b1..556e223c6 100644 --- a/src/auto-reply/reply/agent-runner.heartbeat-typing.test.ts +++ b/src/auto-reply/reply/agent-runner.heartbeat-typing.test.ts @@ -393,7 +393,7 @@ describe("runReplyAgent typing (heartbeat)", () => { runEmbeddedPiAgentMock .mockImplementationOnce(async () => { throw new Error( - "Context overflow: Summarization failed: 400 {\"message\":\"prompt is too long\"}", + 'Context overflow: Summarization failed: 400 {"message":"prompt is too long"}', ); }) .mockImplementationOnce(async () => ({ diff --git a/src/auto-reply/reply/agent-runner.ts b/src/auto-reply/reply/agent-runner.ts index 7721cb164..6b3229286 100644 --- a/src/auto-reply/reply/agent-runner.ts +++ b/src/auto-reply/reply/agent-runner.ts @@ -7,14 +7,14 @@ import { DEFAULT_CONTEXT_TOKENS } from "../../agents/defaults.js"; import { resolveModelAuthMode } from "../../agents/model-auth.js"; import { runWithModelFallback } from "../../agents/model-fallback.js"; import { isCliProvider } from "../../agents/model-selection.js"; -import { - isCompactionFailureError, - isContextOverflowError, -} from "../../agents/pi-embedded-helpers.js"; import { queueEmbeddedPiMessage, runEmbeddedPiAgent, } from "../../agents/pi-embedded.js"; +import { + isCompactionFailureError, + isContextOverflowError, +} from "../../agents/pi-embedded-helpers.js"; import { hasNonzeroUsage, type NormalizedUsage } from "../../agents/usage.js"; import type { ClawdbotConfig } from "../../config/config.js"; import { @@ -237,7 +237,7 @@ export async function runReplyAgent(params: { } = params; let activeSessionEntry = sessionEntry; - let activeSessionStore = sessionStore; + const activeSessionStore = sessionStore; let activeIsNewSession = isNewSession; const isHeartbeat = opts?.isHeartbeat === true; @@ -429,7 +429,10 @@ export async function runReplyAgent(params: { startedAt, }, }); - const cliSessionId = getCliSessionId(activeSessionEntry, provider); + const cliSessionId = getCliSessionId( + activeSessionEntry, + provider, + ); return runCliAgent({ sessionId: followupRun.run.sessionId, sessionKey, @@ -709,7 +712,12 @@ export async function runReplyAgent(params: { } // Auto-recover from Gemini session corruption by resetting the session - if (isSessionCorruption && sessionKey && activeSessionStore && storePath) { + if ( + isSessionCorruption && + sessionKey && + activeSessionStore && + storePath + ) { const corruptedSessionId = activeSessionEntry?.sessionId; defaultRuntime.error( `Session history corrupted (Gemini function call ordering). Resetting session: ${sessionKey}`,