mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-14 18:51:04 +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.
|
||||
ensureListener();
|
||||
if ([...subagentRuns.values()].some((entry) => entry.archiveAtMs)) {
|
||||
startSweeper();
|
||||
}
|
||||
// Always start sweeper — session-mode runs (no archiveAtMs) also need TTL cleanup.
|
||||
startSweeper();
|
||||
for (const runId of subagentRuns.keys()) {
|
||||
resumeSubagentRun(runId);
|
||||
}
|
||||
@@ -495,7 +494,9 @@ async function sweepSubagentRuns() {
|
||||
});
|
||||
subagentRuns.delete(runId);
|
||||
mutated = true;
|
||||
await safeRemoveAttachmentsDir(entry);
|
||||
if (!entry.retainAttachmentsOnKeep) {
|
||||
await safeRemoveAttachmentsDir(entry);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user