style: biome fixes
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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 () => ({
|
||||
|
||||
@@ -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}`,
|
||||
|
||||
Reference in New Issue
Block a user