Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix: mint closed-session ids with lib/uuid, not crypto.randomUUID

Mina Sameh7d5251af9433
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index d7133a919..b09e620c8 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -386,6 +386,7 @@ import { pushSessionRename } from '../lib/sessionRename'
import { useReopenHistory, type ReopenEntry } from '../state/reopenHistory'
import { snapshotNode, recreateNodeFromSnapshot } from '../lib/reopenNode'
import { buildClosedSessionEntries, stateToReopenSnapshot } from '../lib/closedHistory'
+import { uuid } from '../lib/uuid'
import { planReopen, type ReopenPlan } from '../lib/reopenPlan'
import { oneLine } from '@shared/one-line'
import { parseLenses, verifyLensPrompt, verifySynthesisPrompt } from '../lib/verifyPanel'
@@ -4574,12 +4575,12 @@ export function Canvas() {
})
}
const deletedAt = Date.now()
- const closedEntries = buildClosedSessionEntries(
- set,
- nodesRef.current,
- deletedAt,
- () => crypto.randomUUID()
- )
+ // `uuid()`, NOT crypto.randomUUID: the latter exists only in a SECURE context, so it is
+ // undefined in the Server Edition served over plain HTTP on a LAN — and this call sits at
+ // the TOP of deleteNodes, before transport.destroy/setNodes, so a throw here would make
+ // Delete do nothing at all on that surface. See lib/uuid.ts (the same call already broke
+ // "Add agent" once).
+ const closedEntries = buildClosedSessionEntries(set, nodesRef.current, deletedAt, uuid)
if (closedEntries.length) {
useProjects.getState().recordClosedSessions(
useProjects.getState().activeProjectId ?? '',
diff --git a/src/renderer/canvas/canvas-wiring.test.tsx b/src/renderer/canvas/canvas-wiring.test.tsx
index d4666873d..455b9b474 100644
--- a/src/renderer/canvas/canvas-wiring.test.tsx
+++ b/src/renderer/canvas/canvas-wiring.test.tsx
@@ -171,8 +171,19 @@ describe('breadcrumb wiring the CLAUDE.md bullet calls load-bearing', () => {
describe('deleteNodes also records persisted closed-session history', () => {
it('builds entries from the full pre-delete tree and the same "now"/ids used for reopenHistory', () => {
expect(CANVAS_SRC).toContain('const deletedAt = Date.now()')
- expect(CANVAS_SRC).toContain('buildClosedSessionEntries(')
- expect(CANVAS_SRC).toContain('set,\n nodesRef.current,\n deletedAt,')
+ expect(CANVAS_SRC).toContain(
+ 'buildClosedSessionEntries(set, nodesRef.current, deletedAt, uuid)'
+ )
+ })
+
+ it('mints entry ids with lib/uuid, never crypto.randomUUID', () => {
+ // crypto.randomUUID exists only in a SECURE context, so it is undefined in the Server Edition
+ // served over plain HTTP on a LAN. This call sits at the TOP of deleteNodes — before
+ // transport.destroy and setNodes — so a throw there makes Delete do nothing at all on that
+ // surface. The same call already broke "Add agent" once; see lib/uuid.ts.
+ // The CALL form, so the explanatory comment beside the fixed line can keep naming it.
+ expect(CANVAS_SRC).not.toContain('crypto.randomUUID(')
+ expect(CANVAS_SRC).toContain("import { uuid } from '../lib/uuid'")
})
it('records into the store only when entries were actually built', () => {