fix: use sessionFile from entry for threaded sessions

Address Codex review: prefer previousSessionEntry.sessionFile which
includes thread suffix for topic sessions, fall back to
resolveSessionTranscriptPath for legacy sessions.
This commit is contained in:
zhixian 2026-01-26 19:40:54 +09:00
parent c5ddd12612
commit 5cf0584068

View File

@ -130,9 +130,13 @@ export async function getReplyFromConfig(
// Handle /reset prune - delete session entry and transcript, then return confirmation
if (resetTriggered && pruneRequested && previousSessionEntry) {
const transcriptPath = previousSessionEntry.sessionId
? resolveSessionTranscriptPath(previousSessionEntry.sessionId, agentId)
: undefined;
// Prefer sessionFile from entry (includes thread suffix for topics),
// fall back to resolveSessionTranscriptPath for legacy sessions
const transcriptPath =
previousSessionEntry.sessionFile?.trim() ||
(previousSessionEntry.sessionId
? resolveSessionTranscriptPath(previousSessionEntry.sessionId, agentId)
: undefined);
await deleteSessionEntry({
storePath,
sessionKey,