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(notch-hud): reading is per row — opening the panel marks nothing read

enes1f9d3b262cf9
diff --git a/docs/notch-hud.md b/docs/notch-hud.md
index ddf431dc2..bb556b770 100644
--- a/docs/notch-hud.md
+++ b/docs/notch-hud.md
@@ -48,10 +48,12 @@ Row shape sent to the HUD:
prompt?, activity?, contextPercent?,
subagents: [{ id, label?, state: 'working'|'done' }] }
```
-- **done latch + clear**: `done` state is latched by the mirror already; clear a node's done
- highlight when the user focuses that node in nodeterm (reuse `app:focus-node`) OR after the HUD
- panel is opened — a nodeterm-native "you looked at it" signal (better than agent-notch's
- terminal-bundle-id sniff). Drop a node from the HUD when it's gone + idle > 6 h.
+- **done latch + clear**: `done` state is latched by the mirror already. Clearing is **strictly per
+ row**: clicking/Go-ing a row (`hudFocusNode` → `model.noteFocus`) clears THAT node, and reading the
+ session inside nodeterm clears it through the mirror's read-ack (`state:'done', ack:true`). Opening
+ or closing the panel clears NOTHING — an earlier "the panel was opened, so you looked at it"
+ blanket clear meant that with three finished sessions waiting, opening the panel and clicking one
+ silently swallowed the other two. Drop a node from the HUD when it's gone + idle > 6 h.
## Indicator + panel (hud renderer) — the DynamicNotch capsule
diff --git a/src/main/notch-hud-model.test.ts b/src/main/notch-hud-model.test.ts
index eeb91ae29..014150462 100644
--- a/src/main/notch-hud-model.test.ts
+++ b/src/main/notch-hud-model.test.ts
@@ -85,16 +85,20 @@ describe('createHudModel — state → bucket', () => {
})
describe('done latch', () => {
- it('is cleared by noteFocus and by notePanelOpened', () => {
+ it('is cleared PER ROW by noteFocus, leaving the others unread', () => {
const m = createHudModel()
m.applyStateChange(stateChange({ nodeId: 'a', state: 'done' }))
m.applyStateChange(stateChange({ nodeId: 'b', state: 'done' }))
+ m.applyStateChange(stateChange({ nodeId: 'c', state: 'done' }))
expect(rowFor(m.buildRows(T0, titleOf), 'a')?.state).toBe('done')
m.noteFocus('a')
expect(rowFor(m.buildRows(T0, titleOf), 'a')).toBeUndefined()
+ // Reading one finished session must not swallow the two the user hasn't looked at yet.
expect(rowFor(m.buildRows(T0, titleOf), 'b')?.state).toBe('done')
- m.notePanelOpened()
+ expect(rowFor(m.buildRows(T0, titleOf), 'c')?.state).toBe('done')
+ m.noteFocus('b')
expect(rowFor(m.buildRows(T0, titleOf), 'b')).toBeUndefined()
+ expect(rowFor(m.buildRows(T0, titleOf), 'c')?.state).toBe('done')
})
it('an explicit read-ack end does not raise the highlight', () => {
diff --git a/src/main/notch-hud-model.ts b/src/main/notch-hud-model.ts
index faf031e68..528480313 100644
--- a/src/main/notch-hud-model.ts
+++ b/src/main/notch-hud-model.ts
@@ -95,10 +95,9 @@ export interface HudModel {
applyAgentEvent(ev: NormalizedAgentEvent): void
/** A context-update {sessionId, model, usedPercent} — the ONLY source of the model name. */
applyContextUpdate(p: { sessionId?: string; model?: string; usedPercent?: number }): void
- /** Clear a node's done highlight (the user looked at it). */
+ /** Clear ONE node's done highlight (the user opened that row). Read is per row on purpose:
+ * a blanket "the panel was opened, so everything is read" loses sessions the user never saw. */
noteFocus(nodeId: string): void
- /** Clear EVERY node's done highlight (the panel was opened — "you looked at it"). */
- notePanelOpened(): void
/** Hide a row by hand (a stuck session). It returns if its state genuinely changes. */
dismiss(nodeId: string): void
/** Drop nodes gone from the mirror + idle > 6h. Returns true if anything changed. */
@@ -230,10 +229,6 @@ export function createHudModel(): HudModel {
if (a && a.state === 'done') a.doneSeen = true
}
- function notePanelOpened(): void {
- for (const a of nodes.values()) if (a.state === 'done') a.doneSeen = true
- }
-
function dismiss(nodeId: string): void {
const a = nodes.get(nodeId)
if (!a) return
@@ -295,7 +290,6 @@ export function createHudModel(): HudModel {
applyAgentEvent,
applyContextUpdate,
noteFocus,
- notePanelOpened,
dismiss,
prune,
buildRows
diff --git a/src/main/notch-hud.ts b/src/main/notch-hud.ts
index 7c247e5ed..468dc5d4c 100644
--- a/src/main/notch-hud.ts
+++ b/src/main/notch-hud.ts
@@ -35,8 +35,6 @@ const NOTCH_WIDTH = 168
/** Bounds for the user-tunable notch width (settings.notchWidth). */
export const NOTCH_WIDTH_MIN = 100
export const NOTCH_WIDTH_MAX = 320
-/** How long the panel must stay open before closing it counts as "read" (clears done latches). */
-const PANEL_READ_MS = 700
/**
* A top inset (`workArea.y - bounds.y`) at least this tall (px) means a PHYSICAL notch is present:
* a notched Mac's menu bar is ~37 px, a notchless display's is ~24–25 px. Below this we treat the
@@ -118,10 +116,8 @@ class NotchHudController {
private ipcBound = false
private readonly onSetIgnoreMouse: (_e: unknown, ignore: boolean) => void
private readonly onFocusNode: (_e: unknown, nodeId: string) => void
- private readonly onExpanded: (_e: unknown, expanded: boolean) => void
+ private readonly onExpanded: () => void
private readonly onDismiss: (_e: unknown, nodeId: string) => void
- /** When the panel was opened (epoch ms), 0 while collapsed — gates the read-clear below. */
- private panelOpenedAt = 0
private readonly onDisplayChange: () => void
constructor(
@@ -153,21 +149,12 @@ class NotchHudController {
this.model.dismiss(nodeId)
this.schedulePush()
}
- this.onExpanded = (_e, expanded) => {
- // The done latch clears when the panel CLOSES, not when it opens — and only after it was
- // open long enough to read (field bug: with hover-to-open the green blob vanished the instant
- // the pointer arrived, before anything could be read). So: hover, read, leave → it clears.
- if (expanded) {
- this.panelOpenedAt = Date.now()
- return
- }
- const openFor = this.panelOpenedAt ? Date.now() - this.panelOpenedAt : 0
- this.panelOpenedAt = 0
- if (openFor >= PANEL_READ_MS) {
- this.model.notePanelOpened()
- this.schedulePush()
- }
- }
+ // NOTE: opening/closing the panel deliberately marks NOTHING as read. It used to clear every
+ // done latch on close ("you looked at it"), which lost the plot with three finished sessions
+ // waiting: open the panel, click one, and the other two silently vanished unread. Read is now
+ // strictly per row — clicking/Go-ing a row clears that row (onFocusNode), and the × dismisses
+ // one by hand. The event is still wired because the renderer's expand state may drive more here.
+ this.onExpanded = () => {}
this.onDisplayChange = () => this.reposition()
}