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.

perf(canvas): working glow settles after four pulses

enes267acd8293fd
diff --git a/CLAUDE.md b/CLAUDE.md
index 66f709f08..83f6657dd 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -5235,6 +5235,16 @@ glow that says "this agent finished while you were away" is still on screen when
look for it. `hud.css` is deliberately excluded: the notch HUD's window is never focused, so the
shared gate would freeze it permanently rather than while nobody is looking.
+**The working glow is BOUNDED; the unread and attention glows are not.** The idle gate only helps an
+unfocused window, and an agent mid-turn in a FOCUSED one kept `nt-working-glow` looping for the
+whole turn — MEASURED (production build, M2, focused): one visible working node cost **+3 points
+total CPU and ~25 style recalcs/s** for as long as it ran. It now runs 4 cycles of 2.6 s (~10 s) and
+rests at `opacity: 0.7`, the same static-lit value the idle gate and Reduce Motion already hold it
+at; the keyframes start and end at 0.7, so the settle is seamless. A new turn re-adds `.working`,
+which restarts the pulse. Unread and attention stay infinite on purpose — they exist to pull the
+eye, and the idle gate covers the unfocused case. `styles.animation-gate.test.ts` pins the bounded
+shorthand, the resting opacity and the keyframe endpoints.
+
**A camera move freezes the viewport's raster scale, and only for the move.** `onCanvasMoveStart`
adds `canvas-camera-moving` to the flow wrapper in EVERY appearance (before the glass-only
early-return — it is not a glass feature), and `.canvas-camera-moving .react-flow__viewport` sets
diff --git a/src/renderer/styles.animation-gate.test.ts b/src/renderer/styles.animation-gate.test.ts
index 3a71474f8..e6ba1d78b 100644
--- a/src/renderer/styles.animation-gate.test.ts
+++ b/src/renderer/styles.animation-gate.test.ts
@@ -31,6 +31,8 @@ const PLAY_STATE = 'animation-play-state: var(--nt-anim-state)'
*/
const STATIC_WHEN_IDLE: Record<string, string> = {
'nt-unread-glow': 'rests at opacity 0; pausing could hide the "finished while you were away" glow',
+ // Bounded (4 cycles) since the CPU/GPU pass, so the infinite scan no longer sees it; the entry
+ // stays because its idle and Reduce Motion rules still hold it lit mid-pulse.
'nt-working-glow': 'held lit rather than frozen mid-cycle, alongside its two siblings',
'nt-attention-glow': 'held lit rather than frozen mid-cycle, alongside its two siblings'
}
@@ -41,6 +43,20 @@ function readStyles(): string {
return fs.readFileSync(STYLES, 'utf8').replace(/\r\n/g, '\n')
}
+/** The body of the first rule whose selector is exactly `sel` (up to its closing brace). */
+function ruleBody(css: string, sel: string): string {
+ const i = css.indexOf(sel + ' {')
+ expect(i, `no rule for ${sel}`).toBeGreaterThanOrEqual(0)
+ return css.slice(i, css.indexOf('}', i))
+}
+
+/** The body of `@keyframes name`, up to its closing brace at column 0. */
+function keyframesBody(css: string, name: string): string {
+ const i = css.indexOf(`@keyframes ${name}`)
+ expect(i, `no @keyframes ${name}`).toBeGreaterThanOrEqual(0)
+ return css.slice(i, css.indexOf('\n}', i))
+}
+
/** Every `animation:` shorthand in the file that runs forever, with its line number. */
function infiniteAnimationLines(css: string): { line: number; text: string }[] {
return css
@@ -101,6 +117,19 @@ describe('idle-window animation gate', () => {
}
})
+ it('the working glow is bounded and rests at the static-lit opacity', () => {
+ // An infinite pulse kept the compositor at display rate for a whole agent turn while the
+ // window was focused (measured +3 points CPU, ~25 style recalcs/s per visible working node).
+ // Four cycles keep the "it just started working" signal; the rest is the idle gate's 0.7.
+ const rule = ruleBody(css, '.react-flow__node:has(.term-node.working)::after')
+ expect(rule).toMatch(/animation:\s*nt-working-glow\s+2\.6s\s+ease-in-out\s+4\b/)
+ expect(rule).not.toMatch(/infinite/)
+ expect(rule).toMatch(/opacity:\s*0\.7/)
+ const kf = keyframesBody(css, 'nt-working-glow')
+ // Starts and ends at the resting value, so the settle is seamless.
+ expect(kf).toMatch(/0%,\s*100%\s*\{\s*opacity:\s*0\.7/)
+ })
+
it('never pauses the notch HUD, whose window is never focused', () => {
// hud.css belongs to a separate always-on-top panel window that by design never takes focus,
// so the shared gate would freeze it permanently rather than while nobody is looking.
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 8923ca7aa..5e36a0915 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -1630,8 +1630,10 @@ body,
/* Working (agent mid-turn): a soft clay glow — the spinner's #d97757 — behind the node.
Same opacity-pulse-on-wrapper-pseudo technique as the unread glow above (never animate
box-shadow), but calmer: lower intensity, slower cycle, and it never fully disappears so
- the node reads "alive" rather than "blinking". Mutually exclusive with .unread (isUnread
- is false while working). Shadows only — the top border keeps the node's own color. */
+ the node reads "alive" rather than "blinking". Unlike its two siblings the pulse is BOUNDED:
+ four cycles mark "it just started working", then it rests lit at 0.7 for the rest of the turn.
+ Mutually exclusive with .unread (isUnread is false while working). Shadows only — the top
+ border keeps the node's own color. */
.term-node.working {
box-shadow:
0 0 0 1px color-mix(in srgb, var(--state-working) 35%, transparent),
@@ -1649,17 +1651,23 @@ body,
box-shadow:
0 0 0 1px color-mix(in srgb, var(--state-working) 45%, transparent),
0 0 22px 3px color-mix(in srgb, var(--state-working) 35%, transparent);
- opacity: 0.25;
- animation: nt-working-glow 2.6s ease-in-out infinite;
+ opacity: 0.7;
+ animation: nt-working-glow 2.6s ease-in-out 4;
will-change: opacity;
}
+/* Bounded (4 cycles, ~10 s) and resting at 0.7 — the static-lit value the idle gate and Reduce
+ Motion use. An infinite pulse kept the compositor at display rate for the whole turn (measured
+ +3 points CPU per visible working node, focused). A new turn re-adds `.working` and restarts it. */
@keyframes nt-working-glow {
0%,
100% {
+ opacity: 0.7;
+ }
+ 35% {
opacity: 0.25;
}
- 50% {
+ 70% {
opacity: 1;
}
}