mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-03 14:09:42 +02:00
COD-142 retain pin when a pinned session is killed
A killed session was full-deleted from state.json (removeSession), dropping the COD-139 pinned/pinnedAt fields, so the session vanished from the session-manager pinned group. cleanupStaleSessions also reaped any persisted record with no live session on boot, which would have wiped a preserved pin on the next restart. Fix (state-store): - demoteOrRemoveSession(id): on kill, demote a *pinned* record to a lightweight stopped record (status=stopped, pid=null, pin retained) instead of deleting; unpinned records are removed as before. - cleanupStaleSessions skips pinned records so the pin survives restart. - server _doCleanupSession calls demoteOrRemoveSession on the killMux path (shutdown path unchanged). Restoration iterates live mux sessions, not state.json, so a stopped+ pinned record is never auto-revived. Unit-tested on the real StateStore path (state-store.test.ts +4); session-cleanup/session-pin regress green. (cherry picked from commit 86f183eacfc3f2f6ac28499fb1ae2d21eef2bbed)
This commit is contained in:
+1
-1
@@ -1185,7 +1185,7 @@ export class WebServer extends EventEmitter {
|
||||
// Only remove from state.json if we're also killing the mux session.
|
||||
// When killMux=false (server shutdown), preserve state for recovery.
|
||||
if (killMux) {
|
||||
this.store.removeSession(sessionId);
|
||||
this.store.demoteOrRemoveSession(sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user