style: biome fixes
This commit is contained in:
@@ -226,7 +226,7 @@ describe("isContextOverflowError", () => {
|
|||||||
describe("isCompactionFailureError", () => {
|
describe("isCompactionFailureError", () => {
|
||||||
it("matches compaction overflow failures", () => {
|
it("matches compaction overflow failures", () => {
|
||||||
const samples = [
|
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",
|
"auto-compaction failed due to context overflow",
|
||||||
"Compaction failed: prompt is too long",
|
"Compaction failed: prompt is too long",
|
||||||
];
|
];
|
||||||
@@ -236,9 +236,9 @@ describe("isCompactionFailureError", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("ignores non-compaction overflow errors", () => {
|
it("ignores non-compaction overflow errors", () => {
|
||||||
expect(
|
expect(isCompactionFailureError("Context overflow: prompt too large")).toBe(
|
||||||
isCompactionFailureError("Context overflow: prompt too large"),
|
false,
|
||||||
).toBe(false);
|
);
|
||||||
expect(isCompactionFailureError("rate limit exceeded")).toBe(false);
|
expect(isCompactionFailureError("rate limit exceeded")).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ describe("runReplyAgent typing (heartbeat)", () => {
|
|||||||
runEmbeddedPiAgentMock
|
runEmbeddedPiAgentMock
|
||||||
.mockImplementationOnce(async () => {
|
.mockImplementationOnce(async () => {
|
||||||
throw new Error(
|
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 () => ({
|
.mockImplementationOnce(async () => ({
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ import { DEFAULT_CONTEXT_TOKENS } from "../../agents/defaults.js";
|
|||||||
import { resolveModelAuthMode } from "../../agents/model-auth.js";
|
import { resolveModelAuthMode } from "../../agents/model-auth.js";
|
||||||
import { runWithModelFallback } from "../../agents/model-fallback.js";
|
import { runWithModelFallback } from "../../agents/model-fallback.js";
|
||||||
import { isCliProvider } from "../../agents/model-selection.js";
|
import { isCliProvider } from "../../agents/model-selection.js";
|
||||||
import {
|
|
||||||
isCompactionFailureError,
|
|
||||||
isContextOverflowError,
|
|
||||||
} from "../../agents/pi-embedded-helpers.js";
|
|
||||||
import {
|
import {
|
||||||
queueEmbeddedPiMessage,
|
queueEmbeddedPiMessage,
|
||||||
runEmbeddedPiAgent,
|
runEmbeddedPiAgent,
|
||||||
} from "../../agents/pi-embedded.js";
|
} from "../../agents/pi-embedded.js";
|
||||||
|
import {
|
||||||
|
isCompactionFailureError,
|
||||||
|
isContextOverflowError,
|
||||||
|
} from "../../agents/pi-embedded-helpers.js";
|
||||||
import { hasNonzeroUsage, type NormalizedUsage } from "../../agents/usage.js";
|
import { hasNonzeroUsage, type NormalizedUsage } from "../../agents/usage.js";
|
||||||
import type { ClawdbotConfig } from "../../config/config.js";
|
import type { ClawdbotConfig } from "../../config/config.js";
|
||||||
import {
|
import {
|
||||||
@@ -237,7 +237,7 @@ export async function runReplyAgent(params: {
|
|||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
let activeSessionEntry = sessionEntry;
|
let activeSessionEntry = sessionEntry;
|
||||||
let activeSessionStore = sessionStore;
|
const activeSessionStore = sessionStore;
|
||||||
let activeIsNewSession = isNewSession;
|
let activeIsNewSession = isNewSession;
|
||||||
|
|
||||||
const isHeartbeat = opts?.isHeartbeat === true;
|
const isHeartbeat = opts?.isHeartbeat === true;
|
||||||
@@ -429,7 +429,10 @@ export async function runReplyAgent(params: {
|
|||||||
startedAt,
|
startedAt,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const cliSessionId = getCliSessionId(activeSessionEntry, provider);
|
const cliSessionId = getCliSessionId(
|
||||||
|
activeSessionEntry,
|
||||||
|
provider,
|
||||||
|
);
|
||||||
return runCliAgent({
|
return runCliAgent({
|
||||||
sessionId: followupRun.run.sessionId,
|
sessionId: followupRun.run.sessionId,
|
||||||
sessionKey,
|
sessionKey,
|
||||||
@@ -709,7 +712,12 @@ export async function runReplyAgent(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Auto-recover from Gemini session corruption by resetting the session
|
// Auto-recover from Gemini session corruption by resetting the session
|
||||||
if (isSessionCorruption && sessionKey && activeSessionStore && storePath) {
|
if (
|
||||||
|
isSessionCorruption &&
|
||||||
|
sessionKey &&
|
||||||
|
activeSessionStore &&
|
||||||
|
storePath
|
||||||
|
) {
|
||||||
const corruptedSessionId = activeSessionEntry?.sessionId;
|
const corruptedSessionId = activeSessionEntry?.sessionId;
|
||||||
defaultRuntime.error(
|
defaultRuntime.error(
|
||||||
`Session history corrupted (Gemini function call ordering). Resetting session: ${sessionKey}`,
|
`Session history corrupted (Gemini function call ordering). Resetting session: ${sessionKey}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user