fix(coding-agent): make /new create a new session file

fixes #649
This commit is contained in:
Mario Zechner 2026-01-12 17:06:33 +01:00
parent 638fbc459b
commit 234f367d0d

View file

@ -658,7 +658,9 @@ export class SessionManager {
this._buildIndex();
this.flushed = true;
} else {
const explicitPath = this.sessionFile;
this.newSession();
this.sessionFile = explicitPath; // preserve explicit path from --session flag
}
}
@ -675,11 +677,11 @@ export class SessionManager {
};
this.fileEntries = [header];
this.byId.clear();
this.labelsById.clear();
this.leafId = null;
this.flushed = false;
// Only generate filename if persisting and not already set (e.g., via --session flag)
if (this.persist && !this.sessionFile) {
if (this.persist) {
const fileTimestamp = timestamp.replace(/[:.]/g, "-");
this.sessionFile = join(this.getSessionDir(), `${fileTimestamp}_${this.sessionId}.jsonl`);
}