cmux NEXT Inspector: background task rows keep their node when the registry lists them (no flicker)
Leo, 2026-10-22: "why's the diff viewer not opening up in the right split tab? what about the existing diff viewer elsewhere that was previously made? also wtf this sidebar like ik we're fixing it not being a whole fucking sidebar and shit but why does it FLICKER AND WHY DOES IT STAY ON IN THESE RANDOM SITUATIONS WITHOUT BEING CLOSABLE!?"
This PR fixes the flicker. The full-height card and closing it are separate PRs.
Cause. Background task rows (Inspector TasksSection.tsx, summary card SummaryTasks.tsx) were keyed by command.id. That id is the transcript's tool call id until acpmux's process registry lists the command, and the registry's process id after that (processes.ts backgroundCommands). So when the registry caught up, every such row was a new React key: it remounted and could replay its arrival. In a busy chat (175 background tasks) this happens over and over while it streams.
Ruled out, at origin/feat-cmux-next:
- The panel itself stays mounted. It's the same
InspectorPresencein the same slot, and itsusePresencestarts "shown". - The header's
inspectorflag keeps its last value when a message omits it. key={snapshot.sessionId}doesn't change while one chat streams.
Fix. Rows are keyed by arrivalKey(command), the call that started the command. The arrival animation already used that key.
Test (red first). In webviews/test/chat-inspector-motion.test.tsx, "open, the Inspector and its task rows survive 50 streamed updates without a remount": a background tsc --watch call and a reply that streams over 50 updates, with the registry listing the command from update 20. Each update checks the same <aside>, data-presence="shown" and the same task-row node.
- Red at base: updates 20–50 fail with
row: false(the row is remounted). - Green: all 5 motion tests pass, plus 46 Inspector and summary tests.
summary-background-work.test.tsx"the card lists running commands…" fails the same way on base.
No capture: the flicker was a DOM remount (a row replaced, sometimes with its arrival replayed). The test records it node by node; a still before/after would show nothing.
🤖 Generated with Claude Code
Agent session: huge-blue
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the Inspector flicker where background task rows remounted (and could replay their arrival) during streaming. Rows were keyed by command.id, which changes from the transcript's tool call id to the registry's process id once acpmux's registry lists the command; they're now keyed by arrivalKey (the call that started the command), which the arrival animation already used. Applies to the Inspector TasksSection and the summary card SummaryTasks.
A new test streams 50 snapshot updates, with the registry listing the command from update 20, and asserts the same panel, presence, and task-row node throughout.