mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 19:30:23 +00:00
fix(gateway): honor retainAttachmentsOnKeep in TTL sweep + start sweeper on restore
1. Guard safeRemoveAttachmentsDir with retainAttachmentsOnKeep check in the session-mode TTL sweep, matching the existing pattern in finalizeSubagentCleanup (Codex P1) 2. Start sweeper unconditionally in restoreSubagentRunsOnce(), matching the register paths — ensures TTL cleanup runs after restart even when all restored entries are session-mode (Codex P2) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -436,9 +436,8 @@ function restoreSubagentRunsOnce() {
|
|||||||
}
|
}
|
||||||
// Resume pending work.
|
// Resume pending work.
|
||||||
ensureListener();
|
ensureListener();
|
||||||
if ([...subagentRuns.values()].some((entry) => entry.archiveAtMs)) {
|
// Always start sweeper — session-mode runs (no archiveAtMs) also need TTL cleanup.
|
||||||
startSweeper();
|
startSweeper();
|
||||||
}
|
|
||||||
for (const runId of subagentRuns.keys()) {
|
for (const runId of subagentRuns.keys()) {
|
||||||
resumeSubagentRun(runId);
|
resumeSubagentRun(runId);
|
||||||
}
|
}
|
||||||
@@ -495,7 +494,9 @@ async function sweepSubagentRuns() {
|
|||||||
});
|
});
|
||||||
subagentRuns.delete(runId);
|
subagentRuns.delete(runId);
|
||||||
mutated = true;
|
mutated = true;
|
||||||
await safeRemoveAttachmentsDir(entry);
|
if (!entry.retainAttachmentsOnKeep) {
|
||||||
|
await safeRemoveAttachmentsDir(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user