feat(cli): cleanup activity logs alongside session files (#16399)

This commit is contained in:
Sandy Tao
2026-01-13 09:12:35 +08:00
committed by GitHub
parent 8d3e93cdb0
commit c572b9e9ac

View File

@@ -86,6 +86,18 @@ export async function cleanupExpiredSessions(
const sessionPath = path.join(chatsDir, sessionToDelete.fileName);
await fs.unlink(sessionPath);
// ALSO cleanup Activity logs in the project logs directory
const sessionId = sessionToDelete.sessionInfo?.id;
if (sessionId) {
const logsDir = path.join(config.storage.getProjectTempDir(), 'logs');
const logPath = path.join(logsDir, `session-${sessionId}.jsonl`);
try {
await fs.unlink(logPath);
} catch {
/* ignore if log doesn't exist */
}
}
if (config.getDebugMode()) {
if (sessionToDelete.sessionInfo === null) {
debugLogger.debug(