Prevent stale session overwrite on new tasks

This commit is contained in:
wuyang6
2026-06-12 16:51:17 +08:00
parent a2f39e7312
commit 384e92e961
4 changed files with 47 additions and 37 deletions
+7
View File
@@ -50,6 +50,13 @@ export function clearActiveSessionId() {
);
}
export function createLocalSessionId() {
if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
return `__LOCALID_${crypto.randomUUID().replace(/-/g, "").slice(0, 8)}`;
}
return `__LOCALID_${Math.random().toString(36).slice(2, 10)}`;
}
export function writePendingWorkspaceSessionId(
sessionId: string | null | undefined,
) {