mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 20:35:39 -06:00
fix(agents): persist spill metadata for elision recovery
Preserve fullOutputPath plus partial-spill metadata when oversized tool-result details are summarized for persistence. This keeps aggregate elision from relabeling capped or source-truncated web_fetch spill files as complete after reload.
This commit is contained in:
@@ -437,6 +437,8 @@ describe("tool_result_persist hook", () => {
|
||||
cwd: "/tmp/".concat("workspace/".repeat(400)),
|
||||
name: "oversized fallback command ".repeat(200),
|
||||
fullOutputPath: "/tmp/".concat("output/".repeat(400)),
|
||||
spilledChars: 2_000_000,
|
||||
spillTruncated: true,
|
||||
aggregated: "x".repeat(120_000),
|
||||
tail: "tail ".repeat(800),
|
||||
sessions: Array.from({ length: 10 }, (_, i) => ({
|
||||
@@ -453,6 +455,8 @@ describe("tool_result_persist hook", () => {
|
||||
expect(details.persistedDetailsTruncated).toBe(true);
|
||||
expect(details.finalDetailsTruncated).toBe(true);
|
||||
expect(details.status?.token).toBe("***");
|
||||
expect(details.spilledChars).toBe(2_000_000);
|
||||
expect(details.spillTruncated).toBe(true);
|
||||
expect(serialized).not.toContain(tokenValue);
|
||||
});
|
||||
|
||||
|
||||
@@ -344,7 +344,17 @@ function buildPersistedDetailsFallback(
|
||||
}
|
||||
if (src) {
|
||||
fallback.originalDetailKeys = redactedOriginalDetailKeys(src, redactionConfig);
|
||||
for (const key of ["status", "sessionId", "pid", "exitCode", "exitSignal", "truncated"]) {
|
||||
for (const key of [
|
||||
"status",
|
||||
"sessionId",
|
||||
"pid",
|
||||
"exitCode",
|
||||
"exitSignal",
|
||||
"truncated",
|
||||
"fullOutputPath",
|
||||
"spilledChars",
|
||||
"spillTruncated",
|
||||
]) {
|
||||
const field = src[key];
|
||||
if (field !== undefined) {
|
||||
fallback[key] = redactPersistedSummaryField(
|
||||
@@ -470,6 +480,8 @@ function sanitizeToolResultDetailsForPersistence(
|
||||
"totalChars",
|
||||
"truncated",
|
||||
"fullOutputPath",
|
||||
"spilledChars",
|
||||
"spillTruncated",
|
||||
"truncation",
|
||||
]) {
|
||||
const field = src[key];
|
||||
|
||||
Reference in New Issue
Block a user