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(kanban): review fixes for the card actions

review5d2f8b6a7296
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 989f3cd14..011d2fd9e 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -115,7 +115,11 @@ import { Dock } from '../components/Dock'
import { TabBar } from '../components/TabBar'
import { ContextMenu, type MenuItem } from '../components/ContextMenu'
import { tidySeparators } from '../lib/tidySeparators'
-import { createNodeWriteRouter, type NodeWrites } from '../lib/nodeWriteRouter'
+import {
+ createNodeWriteRouter,
+ ICON_PICKER_FAILED_MESSAGE,
+ type NodeWrites
+} from '../lib/nodeWriteRouter'
import {
BOARD_NODE_ACTION_IDS,
buildNodeActionItems,
@@ -8832,7 +8836,15 @@ export function Canvas() {
nodeId,
title: (node.data.title as string) ?? '',
icon: node.data.icon as NodeIcon | undefined
- }).then((choice) => applyIconChoice(choice, (icon) => setNodeIcon(nodeId, icon)))
+ }).then(
+ (choice) => applyIconChoice(choice, (icon) => setNodeIcon(nodeId, icon)),
+ // A picker that fails to open is reported, the same sentence the off-canvas path uses —
+ // an unanswered rejection here was a click that did nothing at all.
+ () =>
+ window.dispatchEvent(
+ new CustomEvent('nodeterm:toast', { detail: { kind: 'error', message: ICON_PICKER_FAILED_MESSAGE } })
+ )
+ )
},
[setNodeIcon]
)
@@ -8850,20 +8862,23 @@ export function Canvas() {
storedNode: (nodeId) =>
useProjects.getState().getProject(projectId)?.nodes.find((n) => n.id === nodeId),
recolorStored: (nodeId, color) => useProjects.getState().recolorNode(projectId, nodeId, color),
- setStoredIcon: (nodeId, icon) =>
- useProjects.setState((s) => ({
- projects: s.projects.map((p) =>
- p.id === projectId
- ? { ...p, nodes: p.nodes.map((n) => (n.id === nodeId ? ({ ...n, icon } as never) : n)) }
- : p
- )
- })),
- persist: writeDisk,
+ // Through the store's own-write path (like `recolorNode`), never a raw setState: that is
+ // what marks the write as ours and publishes it to a stored canvas with an authority (a
+ // hosted team), so a later saved overlay cannot quietly drop the icon.
+ setStoredIcon: (nodeId, icon) => {
+ const st = useProjects.getState()
+ const node = st.getProject(projectId)?.nodes.find((n) => n.id === nodeId)
+ if (node) st.applyOwnNodeMutation(projectId, { op: 'upsert', node: { ...node, icon } })
+ },
+ // `persist`, not `writeDisk`: the snapshot must carry the live canvas too. `writeDisk`
+ // alone writes the store's copy and then clears `dirty` — so a live edit still inside the
+ // autosave debounce was marked saved without ever reaching disk.
+ persist,
iconDialog: nodeIconDialog,
toast: (message) =>
window.dispatchEvent(new CustomEvent('nodeterm:toast', { detail: { kind: 'error', message } }))
}),
- [setNodesColor, setNodeIcon, pickNodeIcon, writeDisk]
+ [setNodesColor, setNodeIcon, pickNodeIcon, persist]
)
const alignToGrid = useCallback(
@@ -10402,6 +10417,12 @@ export function Canvas() {
(nodeId: string, color: string) => setCardColor(activeProjectId, nodeId, color),
[setCardColor, activeProjectId]
)
+ // The per-project board's card-modal icon, through the same router as its card menu's icon row
+ // (a gone node or a save that fails is reported instead of silently doing nothing).
+ const setActiveCardIcon = useCallback(
+ (nodeId: string, icon: NodeIcon | undefined) => nodeWritesFor(activeProjectId).setIcon(nodeId, icon),
+ [nodeWritesFor, activeProjectId]
+ )
// Stable identity for the memoized per-project board, which only ever shows the active project.
const activeBoardNodeActionItems = useCallback(
(nodeId: string): MenuItem[] => boardNodeActionItems(nodeId, activeProjectId),
@@ -15796,7 +15817,10 @@ export function Canvas() {
const agentId = (liveNode?.data.agentId as AgentId | undefined) ?? storedNode?.agentId
const name = title.trim()
if (agentId && canRename(agentId) && name) {
- void pushSessionRename(api.pty, id, name, prevTitle)
+ // The NODE's core, not the active tab's: the sidebar and the Omni board rename nodes of
+ // every project, and a relay- or hosted-bound project's session lives on another core —
+ // the active tab's `api` would type `/rename` into a same-named session on the wrong one.
+ void pushSessionRename(sessionForProject(projectId).api.pty, id, name, prevTitle)
}
},
[activeProjectId, setNodes, markDirty, writeDisk]
@@ -15962,7 +15986,9 @@ export function Canvas() {
.getState()
.projects.find((p) => p.id === projectId)
?.nodes.find((n) => n.id === id)?.accountId
- const r = await api.pty.generateName(id, cwd ?? '', accountId)
+ // The node's own core (see `renameSession`): the capture must read the session where it
+ // actually runs, not a same-named one on the active tab's core.
+ const r = await sessionForProject(projectId).api.pty.generateName(id, cwd ?? '', accountId)
if (r.ok) renameSession(projectId, id, r.message)
else failed(r.message)
} catch (e) {
@@ -18530,7 +18556,7 @@ export function Canvas() {
onDeleteNode={deleteNodeFromKanban}
onModalNodeChange={setKanbanModalNode}
onBrowserNav={browserNavFromKanban}
- onSetIcon={setNodeIcon}
+ onSetIcon={setActiveCardIcon}
nodeActionItems={activeBoardNodeActionItems}
onAiName={aiNameFromActiveKanban}
onSetColor={setActiveCardColor}
diff --git a/src/renderer/canvas/kanban-node-writes-wiring.source.test.ts b/src/renderer/canvas/kanban-node-writes-wiring.source.test.ts
new file mode 100644
index 000000000..a7c795351
--- /dev/null
+++ b/src/renderer/canvas/kanban-node-writes-wiring.source.test.ts
@@ -0,0 +1,77 @@
+import { describe, it, expect } from 'vitest'
+import { readFileSync } from 'node:fs'
+
+/**
+ * STRUCTURAL pins for the kanban/Omni write paths that Canvas wires — source-level because the
+ * wiring sits inside a 19,000-line component with no render harness. The router's own BEHAVIOUR
+ * is unit-tested in `lib/nodeWriteRouter.test.ts`; what is pinned here is what Canvas hands it and
+ * which core the naming funnels talk to, where a mistake is silent:
+ *
+ * - the router's save must COMMIT the live canvas first (`persist`): `writeDisk` alone writes the
+ * store's copy and then clears `dirty`, marking a live edit still in the autosave debounce as
+ * saved without it ever reaching disk;
+ * - a stored icon write must go through the store's own-write path, or a hosted team's saved
+ * overlay drops it;
+ * - "Name with AI" and the `/rename` push must reach the NODE's core — the sidebar and the Omni
+ * board act on relay/hosted projects whose sessions are not on the active tab's core.
+ */
+const src = readFileSync(new URL('./Canvas.tsx', import.meta.url), 'utf8').replace(/\r\n/g, '\n')
+
+/** The body of `const <name> = useCallback(` up to the next top-level `const` in the component. */
+function callbackBody(name: string): string {
+ const start = src.indexOf(`const ${name} = useCallback(`)
+ expect(start, name).toBeGreaterThan(-1)
+ const end = src.indexOf('\n const ', start + 10)
+ return src.slice(start, end === -1 ? undefined : end)
+}
+
+describe('kanban / Omni node writes (Canvas wiring)', () => {
+ it('the write router saves through `persist`, never a bare `writeDisk`', () => {
+ const body = callbackBody('nodeWritesFor')
+ expect(body).toMatch(/\n\s+persist,\n/)
+ expect(body).not.toContain('persist: writeDisk')
+ })
+
+ it('a stored icon write takes the store own-write path, not a raw setState', () => {
+ const body = callbackBody('nodeWritesFor')
+ expect(body).toContain("applyOwnNodeMutation(projectId, { op: 'upsert'")
+ expect(body).not.toContain('useProjects.setState(')
+ })
+
+ it('the per-project board modal icon goes through the router too', () => {
+ expect(src).toContain('onSetIcon={setActiveCardIcon}')
+ expect(src).not.toContain('onSetIcon={setNodeIcon}')
+ expect(callbackBody('setActiveCardIcon')).toContain('nodeWritesFor(activeProjectId).setIcon(')
+ })
+
+ it('a live icon picker that fails to open is reported', () => {
+ expect(callbackBody('pickNodeIcon')).toContain('ICON_PICKER_FAILED_MESSAGE')
+ })
+
+ it('"Name with AI" asks the node own core, not the active tab core', () => {
+ const body = callbackBody('aiNameSession')
+ expect(body).toContain('sessionForProject(projectId).api.pty.generateName(')
+ expect(body).not.toMatch(/[^.]\bapi\.pty\.generateName\(/)
+ })
+
+ it('the `/rename` push reaches the node own core', () => {
+ const body = callbackBody('renameSession')
+ expect(body).toContain('pushSessionRename(sessionForProject(projectId).api.pty,')
+ expect(body).not.toContain('pushSessionRename(api.pty,')
+ })
+})
+
+describe('Omni board rename (GlobalKanbanView)', () => {
+ const omni = readFileSync(
+ new URL('../components/kanban/GlobalKanbanView.tsx', import.meta.url),
+ 'utf8'
+ ).replace(/\r\n/g, '\n')
+
+ it('renames in the LANE project, never by looking the node up in the stored projects', () => {
+ // A live-lane node created since the last autosave is not in the store yet, so a store lookup
+ // dropped its rename without a word. Every sibling handler already takes the lane's id.
+ expect(omni).toContain('rename: (id, title) => onRenameNode(projectId, id, title)')
+ expect(omni).toContain('onRename={(t) => onRenameNode(projectId, modalNodeId, t)}')
+ expect(omni).not.toContain('nodeOwner(')
+ })
+})
diff --git a/src/renderer/components/kanban/CardModal.actions.test.tsx b/src/renderer/components/kanban/CardModal.actions.test.tsx
index bbaff1b37..ee9736de0 100644
--- a/src/renderer/components/kanban/CardModal.actions.test.tsx
+++ b/src/renderer/components/kanban/CardModal.actions.test.tsx
@@ -7,16 +7,25 @@ import { createRoot, type Root } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { ProjectKanban } from '@shared/types'
import { resetDialogStack } from '../dialog-stack'
+import { useSessionNaming } from '../../state/sessionNaming'
import { CardModal } from './CardModal'
import type { KanbanSession } from './KanbanView'
+const generateName = vi.fn()
vi.mock('../../session/session', () => ({
- useSession: () => ({ api: { pty: { generateName: vi.fn() }, shell: { openExternal: vi.fn() } } })
+ useSession: () => ({ api: { pty: { generateName }, shell: { openExternal: vi.fn() } } })
}))
vi.mock('./BoardLogPanel', () => ({ BoardLogPanel: () => null }))
vi.mock('./CardMetaBar', () => ({ CardMetaBar: () => null }))
vi.mock('../ContextMeter', () => ({ ContextMeter: () => null }))
-vi.mock('./ModalTerminal', () => ({ ModalTerminal: () => <div className="kanban-modal__term" /> }))
+// Every `covered` the live viewer was rendered with, in order — the ⌘M view is laid OVER it.
+const coveredLog = vi.hoisted(() => [] as (boolean | undefined)[])
+vi.mock('./ModalTerminal', () => ({
+ ModalTerminal: (p: { covered?: boolean }) => {
+ coveredLog.push(p.covered)
+ return <div className="kanban-modal__term" />
+ }
+}))
vi.mock('../../nodes/TerminalMarkdownView', () => ({
TerminalMarkdownView: () => <div className="md-view-mock" />
}))
@@ -99,3 +108,98 @@ describe('CardModal — node actions in the header', () => {
expect(button('Delete')).toBeNull()
})
})
+
+describe('CardModal — review fixes (header Color, ✦, ⌘M first paint)', () => {
+ const blue = (): HTMLButtonElement | null =>
+ document.body.querySelector<HTMLButtonElement>('button[aria-label="Blue"]')
+ const esc = (): void => {
+ act(() => {
+ window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))
+ })
+ }
+
+ it('Esc with the swatches open closes the swatches, not the modal', () => {
+ const onClose = vi.fn()
+ render({ onSetColor: vi.fn(), onClose })
+ act(() => button('Color')!.click())
+ expect(blue()).not.toBeNull()
+ esc()
+ expect(blue()).toBeNull()
+ expect(onClose).not.toHaveBeenCalled()
+ // …and the next Esc is the modal's again.
+ esc()
+ expect(onClose).toHaveBeenCalledTimes(1)
+ })
+
+ it('swatches opened for one card never recolor the card the modal stepped to', () => {
+ const onSetColor = vi.fn()
+ render({ onSetColor })
+ act(() => button('Color')!.click())
+ expect(blue()).not.toBeNull()
+ // J/K re-renders the SAME modal with the next card (it is not remounted per card).
+ render({ onSetColor, session: { ...session, id: 'n2', title: 'Other' } })
+ expect(blue()).toBeNull()
+ expect(onSetColor).not.toHaveBeenCalled()
+ })
+
+ it('✦ goes through the board funnel when there is one, and shows its progress', () => {
+ const onAiName = vi.fn()
+ render({ onAiName })
+ const star = (): HTMLButtonElement =>
+ document.body.querySelector<HTMLButtonElement>('button[title="Name with AI (from terminal output)"]')!
+ act(() => star().click())
+ expect(onAiName).toHaveBeenCalledTimes(1)
+ expect(generateName).not.toHaveBeenCalled()
+ // The funnel's spinner is per node and shared with the card menu's row.
+ act(() => useSessionNaming.getState().set('n1', true))
+ expect(star().disabled).toBe(true)
+ act(() => useSessionNaming.getState().set('n1', false))
+ expect(star().disabled).toBe(false)
+ })
+
+ it('✦ without a funnel reports a rejected request and never leaves the spinner on', async () => {
+ generateName.mockRejectedValueOnce(new Error('connection dropped'))
+ const toasts: string[] = []
+ const onToast = (e: Event): void => {
+ toasts.push((e as CustomEvent<{ message: string }>).detail.message)
+ }
+ window.addEventListener('nodeterm:toast', onToast)
+ render()
+ const star = (): HTMLButtonElement =>
+ document.body.querySelector<HTMLButtonElement>('button[title="Name with AI (from terminal output)"]')!
+ await act(async () => {
+ star().click()
+ })
+ window.removeEventListener('nodeterm:toast', onToast)
+ expect(toasts).toEqual(["Couldn't name this session with AI: connection dropped"])
+ expect(star().disabled).toBe(false)
+ })
+
+ it('✦ without a funnel reports a refused request (ok:false) instead of doing nothing', async () => {
+ generateName.mockResolvedValueOnce({ ok: false, message: 'no output to name from' })
+ const onRename = vi.fn()
+ const toasts: string[] = []
+ const onToast = (e: Event): void => {
+ toasts.push((e as CustomEvent<{ message: string }>).detail.message)
+ }
+ window.addEventListener('nodeterm:toast', onToast)
+ render({ onRename })
+ await act(async () => {
+ document.body
+ .querySelector<HTMLButtonElement>('button[title="Name with AI (from terminal output)"]')!
+ .click()
+ })
+ window.removeEventListener('nodeterm:toast', onToast)
+ expect(toasts).toEqual(["Couldn't name this session with AI: no output to name from"])
+ expect(onRename).not.toHaveBeenCalled()
+ })
+
+ it('a card opened on the ⌘M view is covered from its very first paint', () => {
+ // The live viewer stays mounted under the ⌘M face by design; what must not happen is a first
+ // frame with it UNcovered (the view used to arrive one effect later).
+ coveredLog.length = 0
+ render({ initialView: 'md' })
+ expect(coveredLog[0]).toBe(true)
+ expect(document.querySelector('.md-view-mock')).not.toBeNull()
+ })
+})
diff --git a/src/renderer/components/kanban/CardModal.tsx b/src/renderer/components/kanban/CardModal.tsx
index 09834b7f0..75b17ba87 100644
--- a/src/renderer/components/kanban/CardModal.tsx
+++ b/src/renderer/components/kanban/CardModal.tsx
@@ -35,6 +35,7 @@ import type { TeamStation } from '../../lib/teamProgress'
import { sessionNameRepeatsTitle } from '../../lib/cardRedundancy'
import type { IssueRef } from '@shared/github-issue-ref'
import { useAgentStatus } from '../../state/agentStatus'
+import { useSessionNaming } from '../../state/sessionNaming'
import { useCardPanel } from '../../state/cardPanel'
import {
useCardModalSize,
@@ -129,13 +130,17 @@ interface CardModalProps {
/** Delete the node through the board's own confirm-first Delete. The modal closes FIRST, so the
* confirm is never drawn over a live view of the session it is about to end. Absent = no button. */
onDelete?: () => void
+ /** "Name with AI" through the board's funnel (Canvas `aiNameSession`) — the one the card menu's
+ * row uses, so the header ✦ and the menu row cannot disagree: it reports a failure, asks the
+ * card's OWN core, and drives the shared per-node naming spinner. */
+ onAiName?: () => void
}
/** Trello-style card popup over the board. Scrim click / Esc close it; the board (and the
* canvas under it) stay mounted. Terminal cards carry the node header's actions too:
* search / dictate / AI-name / the ⌘M view — ChatPanel or the output markdown, the same face the
* canvas node shows (the node itself is hidden under the board). */
-export function CardModal({ session, projectId, projectName, projectColor, columnTitle, board, onChangeBoard, onClose, portsProjectId, onOpenCanvas, onRename, onEditSticky, onBrowserNav, onSetIcon, onOpenIssue, mentionables, team, onTravel, initialView, onSetColor, onDelete }: CardModalProps) {
+export function CardModal({ session, projectId, projectName, projectColor, columnTitle, board, onChangeBoard, onClose, portsProjectId, onOpenCanvas, onRename, onEditSticky, onBrowserNav, onSetIcon, onOpenIssue, mentionables, team, onTravel, initialView, onSetColor, onDelete, onAiName }: CardModalProps) {
const { api } = useSession()
// The header slot decides "icon or smiley" on the NORMALIZED value, the answer NodeIconView
// itself gives — on the raw one, an invalid stored icon drew an empty, un-muted slot.
@@ -177,8 +182,13 @@ export function CardModal({ session, projectId, projectName, projectColor, colum
const portsRemote = useProjects((s) => !!(portsProjectId && s.getProject(portsProjectId)?.ssh))
const accountChip = useAccountChip(session.spawn.accountId, observedAccount)
const [naming, setNaming] = useState(false)
- // The header Color button's swatch menu, anchored under the button.
- const [colorMenu, setColorMenu] = useState<{ x: number; y: number } | null>(null)
+ // The board funnel's progress for this node (`onAiName`), shared with the card menu's row.
+ const funnelNaming = useSessionNaming((st) => !!st.byId[session.id])
+ // The header Color button's swatch menu, anchored under the button. Keyed by node id like the ⌘M
+ // view below: the modal is not remounted per card, and swatches left open across a J/K step
+ // would recolor the card the modal moved TO, not the one the menu was opened for.
+ const [colorMenu, setColorMenu] = useState<{ x: number; y: number; id: string } | null>(null)
+ const colorMenuOpen = colorMenu !== null && colorMenu.id === session.id
// Comments & activity panel: OPEN by default in the modal; the header 💬 collapses it. The
// choice is remembered (localStorage) — once collapsed, later cards open collapsed too.
const panelOpen = useCardPanel((s) => s.open)
@@ -190,7 +200,9 @@ export function CardModal({ session, projectId, projectName, projectColor, colum
// MODAL-LOCAL on purpose, never `data.mdMode`: flipping the node's flag would also flip the
// canvas node under the board. Keyed by node id (this component is not remounted per card, so
// a bare boolean would carry the open view onto the next card the user opens).
- const [mdFor, setMdFor] = useState<string | null>(null)
+ // Seeded from `initialView` so a card opened on the ⌘M view does not paint (and start a viewer
+ // for) the live terminal for a frame before the effect below swaps it.
+ const [mdFor, setMdFor] = useState<string | null>(initialView === 'md' ? session.id : null)
const mdOpen = isTerminal && mdFor === session.id
// Per OPENING, not sticky per card: showing another card resets it, so A → B → A comes back to
// A's live terminal. (The id key above is what keeps the render between the switch and this
@@ -303,11 +315,33 @@ export function CardModal({ session, projectId, projectName, projectColor, colum
const RESIZE_DIRS = ['n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw']
const nameWithAi = async () => {
+ if (onAiName) {
+ onAiName()
+ return
+ }
+ // No board funnel: the modal names the session itself — and still reports a failure, and never
+ // leaves the spinner on when the request rejects.
+ const failed = (reason: string): void => {
+ const why = reason.trim()
+ const message = why ? `Couldn't name this session with AI: ${why}` : "Couldn't name this session with AI"
+ window.dispatchEvent(new CustomEvent('nodeterm:toast', { detail: { kind: 'error', message } }))
+ }
setNaming(true)
- const r = await api.pty.generateName(session.id, session.spawn.cwd ?? '', session.spawn.accountId)
- setNaming(false)
- if (r.ok) onRename(r.message)
+ try {
+ const r = await api.pty.generateName(session.id, session.spawn.cwd ?? '', session.spawn.accountId)
+ if (r.ok) onRename(r.message)
+ else failed(r.message)
+ } catch (e) {
+ failed(e instanceof Error ? e.message : String(e))
+ } finally {
+ setNaming(false)
+ }
}
+ // Mirror for the capture-phase Escape listener below (it closes over stale state otherwise).
+ const colorMenuOpenRef = useRef(false)
+ useEffect(() => {
+ colorMenuOpenRef.current = colorMenuOpen
+ }, [colorMenuOpen])
// Ref mirrors: the capture-phase listener below closes over stale state otherwise.
const editingTitleRef = useRef(false)
useEffect(() => {
@@ -330,6 +364,14 @@ export function CardModal({ session, projectId, projectName, projectColor, colum
// modal (raised), the drawer is not a dialog, so this modal is still the top one. Not consumed —
// the drawer's own rule decides (unpinned: close the drawer; pinned: nothing).
if (inLiveChatDrawer(e.target) || inLiveChatDrawer(document.activeElement)) return
+ // The header Color swatches own Esc first: close the menu, not the whole modal. (The menu is
+ // not a dialog-stack entry, so this modal still reads as the top dialog while it is open.)
+ if (colorMenuOpenRef.current) {
+ e.preventDefault()
+ e.stopPropagation()
+ setColorMenu(null)
+ return
+ }
// A rename in progress owns Esc first (cancel the edit, not the modal).
if (editingTitleRef.current) {
e.preventDefault()
@@ -558,10 +600,10 @@ export function CardModal({ session, projectId, projectName, projectColor, colum
<button
className="kanban-modal__action"
title="Name with AI (from terminal output)"
- disabled={naming}
+ disabled={naming || funnelNaming}
onClick={nameWithAi}
>
- {naming ? '…' : '✦'}
+ {naming || funnelNaming ? '…' : '✦'}
</button>
{/* Share a live link to this terminal — the canvas node menu's row, as a header action.
The canvas opens the dialog (`nodeterm:live-link`) after re-checking availability
@@ -592,7 +634,7 @@ export function CardModal({ session, projectId, projectName, projectColor, colum
aria-label="Color"
onClick={(e) => {
const r = e.currentTarget.getBoundingClientRect()
- setColorMenu({ x: r.left, y: r.bottom })
+ setColorMenu({ x: r.left, y: r.bottom, id: session.id })
}}
>
<IconColor />
@@ -634,7 +676,7 @@ export function CardModal({ session, projectId, projectName, projectColor, colum
<IconClose />
</button>
</div>
- {colorMenu && onSetColor && (
+ {colorMenu && colorMenuOpen && onSetColor && (
<ContextMenu
x={colorMenu.x}
y={colorMenu.y}
diff --git a/src/renderer/components/kanban/GlobalKanbanView.tsx b/src/renderer/components/kanban/GlobalKanbanView.tsx
index fb3f9c1ad..f6bb82f3a 100644
--- a/src/renderer/components/kanban/GlobalKanbanView.tsx
+++ b/src/renderer/components/kanban/GlobalKanbanView.tsx
@@ -32,7 +32,6 @@ import type { NodeIcon } from '@shared/node-icon'
import { columnCategory } from '@shared/kanban-category'
import { NO_STATIONS, stationsByOpener, type TeamStation } from '../../lib/teamProgress'
import { stationNodeFromState } from '../../state/teamStations'
-import { nodeOwner } from '../../lib/nodeOwner'
/**
* Global (Omni) Kanban overview — one swimlane per open project.
@@ -69,7 +68,7 @@ interface SwimlaneProps {
onOpenNode: (nodeId: string, projectId: string) => void
onCreateNode: (projectId: string, choice: KanbanCreateChoice, columnId: string | null) => void
onDeleteNode: (projectId: string, nodeId: string) => void
- onRenameNode: (nodeId: string, title: string) => void
+ onRenameNode: (projectId: string, nodeId: string, title: string) => void
onEditSticky: (projectId: string, nodeId: string, text: string) => void
onBrowserNav: (projectId: string, nodeId: string, patch: { url?: string; title?: string }) => void
onSetIcon: (projectId: string, nodeId: string, icon: NodeIcon | undefined) => void
@@ -268,7 +267,7 @@ const Swimlane = memo(function Swimlane({
commit,
openCard: setModalNodeId,
openOnCanvas: (id) => onOpenNode(id, projectId),
- rename: onRenameNode,
+ rename: (id, title) => onRenameNode(projectId, id, title),
aiName: onAiName ? (id) => onAiName(projectId, id) : undefined,
nodeActions: nodeActionItems ? (id) => nodeActionItems(id, projectId) : undefined,
remove: (id) => onDeleteNode(projectId, id)
@@ -350,12 +349,13 @@ const Swimlane = memo(function Swimlane({
initialView={modalView}
portsProjectId={projectId === activePortsProjectId ? projectId : undefined}
onOpenCanvas={() => { setModalNodeId(null); onOpenNode(modalNodeId, projectId) }}
- onRename={(t) => onRenameNode(modalNodeId, t)}
+ onRename={(t) => onRenameNode(projectId, modalNodeId, t)}
onEditSticky={(t) => onEditSticky(projectId, modalNodeId, t)}
onBrowserNav={(patch) => onBrowserNav(projectId, modalNodeId, patch)}
onSetIcon={(icon) => onSetIcon(projectId, modalNodeId, icon)}
onSetColor={onSetColor ? (color) => onSetColor(projectId, modalNodeId, color) : undefined}
onDelete={() => onDeleteNode(projectId, modalNodeId)}
+ onAiName={onAiName ? () => onAiName(projectId, modalNodeId) : undefined}
team={teams.get(modalNodeId) ?? NO_STATIONS}
onTravel={(nodeId) => { setModalNodeId(null); travel(nodeId) }}
/>
@@ -469,12 +469,11 @@ export const GlobalKanbanView = memo(function GlobalKanbanView({ live = null, on
window.dispatchEvent(new CustomEvent('nodeterm:global-delete', { detail: { projectId, nodeId } }))
}, [])
- const onRenameNode = useCallback((nodeId: string, title: string) => {
- // The board lists open projects, and `nodeOwner` prefers an open one over a closed, handed-off
- // SSH project holding the same node id.
- const proj = nodeOwner(useProjects.getState().projects, nodeId)
- if (!proj) return
- window.dispatchEvent(new CustomEvent('nodeterm:global-rename', { detail: { projectId: proj.id, nodeId, title } }))
+ const onRenameNode = useCallback((projectId: string, nodeId: string, title: string) => {
+ // The LANE's project, like every sibling here: it is known, and looking the node up in the
+ // STORED projects instead dropped a rename of a live-lane node created since the last autosave
+ // (not in the store yet) without a word — and could pick the wrong owner for a reused node id.
+ window.dispatchEvent(new CustomEvent('nodeterm:global-rename', { detail: { projectId, nodeId, title } }))
}, [])
const onEditSticky = useCallback((projectId: string, nodeId: string, text: string) => {
diff --git a/src/renderer/components/kanban/KanbanView.tsx b/src/renderer/components/kanban/KanbanView.tsx
index b07efaf48..8a2be9084 100644
--- a/src/renderer/components/kanban/KanbanView.tsx
+++ b/src/renderer/components/kanban/KanbanView.tsx
@@ -1288,6 +1288,7 @@ export const KanbanView = memo(function KanbanView({
onSetIcon={(icon) => onSetIcon(modalNodeId, icon)}
onSetColor={onSetColor ? (color) => onSetColor(modalNodeId, color) : undefined}
onDelete={() => onDeleteNode(modalNodeId)}
+ onAiName={onAiName ? () => onAiName(modalNodeId) : undefined}
onOpenIssue={(ref) => {
// The issue summary is its own modal: close the card, then ask for the issue (the same
// request the session card's `#N` makes — summary if the lane has it, else GitHub).
diff --git a/src/renderer/lib/nodeWriteRouter.ts b/src/renderer/lib/nodeWriteRouter.ts
index 7718163de..ea00e4223 100644
--- a/src/renderer/lib/nodeWriteRouter.ts
+++ b/src/renderer/lib/nodeWriteRouter.ts
@@ -38,7 +38,7 @@ export interface NodeWriteRouterDeps {
storedNode: (nodeId: string) => CanvasNodeState | undefined
recolorStored: (nodeId: string, color: string) => void
setStoredIcon: (nodeId: string, icon: NodeIcon | undefined) => void
- /** Canvas `writeDisk`: false when the save was refused. */
+ /** Canvas `persist` (commit the live canvas, then write): false when the save was refused. */
persist: () => Promise<boolean>
iconDialog: (opts: { nodeId: string; title: string; icon?: NodeIcon }) => Promise<NodeIconChoice>
toast: (message: string) => void
@@ -87,10 +87,14 @@ export function createNodeWriteRouter(d: NodeWriteRouterDeps): NodeWrites {
d.toast(NODE_GONE_MESSAGE)
return
}
+ // The rejection handler covers the DIALOG only: a failure after a successful pick is not "the
+ // picker failed to open", and the write path reports its own failures (NODE_GONE / save).
void d
.iconDialog({ nodeId, title: node.title ?? '', icon: node.icon })
- .then((choice) => applyIconChoice(choice, (icon) => setIcon(nodeId, icon)))
- .catch(() => d.toast(ICON_PICKER_FAILED_MESSAGE))
+ .then(
+ (choice) => applyIconChoice(choice, (icon) => setIcon(nodeId, icon)),
+ () => d.toast(ICON_PICKER_FAILED_MESSAGE)
+ )
}
}
}