Fix --session flag to use provided filename

When --session path was provided for a non-existent file, _initNewSession() was overwriting the path with an auto-generated one. Now it only generates a filename if sessionFile wasn't already set.
This commit is contained in:
Mario Zechner 2025-12-26 00:35:55 +01:00
parent 9478a3c1f5
commit 77595b97f9

View file

@ -411,8 +411,11 @@ export class SessionManager {
this.byId.clear();
this.leafId = "";
this.flushed = false;
const fileTimestamp = timestamp.replace(/[:.]/g, "-");
this.sessionFile = join(this.getSessionDir(), `${fileTimestamp}_${this.sessionId}.jsonl`);
// Only generate filename if not already set (e.g., via --session flag)
if (!this.sessionFile) {
const fileTimestamp = timestamp.replace(/[:.]/g, "-");
this.sessionFile = join(this.getSessionDir(), `${fileTimestamp}_${this.sessionId}.jsonl`);
}
}
private _migrateToV2(): void {