mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 20:40:23 +00:00
fix(agents): surface disk full session write errors (#61264)
This commit is contained in:
@@ -191,6 +191,16 @@ describe("formatAssistantErrorText", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it.each(["disk full", "ENOSPC: no space left on device, write"])(
|
||||
"returns a friendly disk-space message for %s",
|
||||
(errorMessage) => {
|
||||
const msg = makeAssistantError(errorMessage);
|
||||
expect(formatAssistantErrorText(msg)).toBe(
|
||||
"OpenClaw could not write local session data because the disk is full. Free some disk space and try again.",
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
it("returns a DNS-specific message for provider lookup failures", () => {
|
||||
const msg = makeAssistantError("dial tcp: lookup api.example.com: no such host (ENOTFOUND)");
|
||||
expect(formatAssistantErrorText(msg)).toBe(
|
||||
|
||||
@@ -149,6 +149,15 @@ describe("sanitizeUserFacingText", () => {
|
||||
).toBe("LLM request failed: connection refused by the provider endpoint.");
|
||||
});
|
||||
|
||||
it.each(["disk full", "ENOSPC: no space left on device"])(
|
||||
"rewrites disk-space failures with errorContext: %s",
|
||||
(input) => {
|
||||
expect(sanitizeUserFacingText(input, { errorContext: true })).toBe(
|
||||
"OpenClaw could not write local session data because the disk is full. Free some disk space and try again.",
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
it("sanitizes invalid streaming event order errors", () => {
|
||||
expect(
|
||||
sanitizeUserFacingText(
|
||||
|
||||
@@ -167,6 +167,24 @@ function formatTransportErrorCopy(raw: string): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function formatDiskSpaceErrorCopy(raw: string): string | undefined {
|
||||
if (!raw) {
|
||||
return undefined;
|
||||
}
|
||||
const lower = raw.toLowerCase();
|
||||
if (
|
||||
/\benospc\b/i.test(raw) ||
|
||||
lower.includes("no space left on device") ||
|
||||
lower.includes("disk full")
|
||||
) {
|
||||
return (
|
||||
"OpenClaw could not write local session data because the disk is full. " +
|
||||
"Free some disk space and try again."
|
||||
);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function isReasoningConstraintErrorMessage(raw: string): boolean {
|
||||
if (!raw) {
|
||||
return false;
|
||||
@@ -925,6 +943,11 @@ export function formatAssistantErrorText(
|
||||
}
|
||||
}
|
||||
|
||||
const diskSpaceCopy = formatDiskSpaceErrorCopy(raw);
|
||||
if (diskSpaceCopy) {
|
||||
return diskSpaceCopy;
|
||||
}
|
||||
|
||||
if (isContextOverflowError(raw)) {
|
||||
return (
|
||||
"Context overflow: prompt too large for the model. " +
|
||||
@@ -1023,6 +1046,11 @@ export function sanitizeUserFacingText(text: unknown, opts?: { errorContext?: bo
|
||||
return execDeniedMessage;
|
||||
}
|
||||
|
||||
const diskSpaceCopy = formatDiskSpaceErrorCopy(trimmed);
|
||||
if (diskSpaceCopy) {
|
||||
return diskSpaceCopy;
|
||||
}
|
||||
|
||||
if (/incorrect role information|roles must alternate/i.test(trimmed)) {
|
||||
return (
|
||||
"Message ordering conflict - please try again. " +
|
||||
|
||||
Reference in New Issue
Block a user