refactor: harden session store updates

Co-authored-by: Tyler Yust <tyler6204@users.noreply.github.com>
This commit is contained in:
Peter SteinbergerandTyler Yust committed 2026-01-15 23:41:34 +00:00
1 parent 35492f8513
commit 688a0ce439
24 files changed
+441 -215

No files matched your search

+4 -2
View File
@@ -25,7 +25,7 @@ import {
loadSessionStore,
resolveStorePath,
type SessionEntry,
saveSessionStore,
updateSessionStore,
} from "../../config/sessions.js";
import {
formatUsageSummaryLine,
@@ -263,7 +263,9 @@ export function createSessionStatusTool(opts?: {
delete nextEntry.authProfileOverride;
}
store[resolved.key] = nextEntry;
await saveSessionStore(storePath, store);
await updateSessionStore(storePath, (nextStore) => {
nextStore[resolved.key] = nextEntry;
});
resolved.entry = nextEntry;
changedModel = true;
}