Repository navigation
Optimize hidden chat subscriptions and tab projections - #36047
Conversation
… rescanning every layout The shared TabBar agent projection rebuilt agent types and tab-wide chat fallback safety from every terminal layout (~2.5k at the captured scale) and every status row whenever either map's identity changed. Status pings that keep each pane's agent type now reuse the cached projection, and layout edits re-resolve only the added, replaced or removed tabs. Key reorders, agent-type changes and added/removed status rows still take the full projection.
…very agent conversation The AI Vault title subscription ran two full agent-conversation collections (every terminal tab, retained, sleeping and live record) whenever any owner input changed identity, including worktree rank/unread patches and unrelated settings writes. Compare worktree rows through the existing owner-rows token so rank-only patches skip the check, and reuse the conversation workspace set while the agent/tab maps it reads are unchanged, so owner-only updates compare only those workspaces' hosts. Real host moves still schedule a title rescan.
… feed ticks Each host status feed tick re-captured every structured chat member on that host (hundreds at the captured scale), resolving each tab's owner about three times plus companion pin checks, even though a status event names one session. Members whose feed facts (summary, observation, failure, sleep and launch directory) and tab are unchanged since their last consumed capture are now skipped, and tab owners are cached until an owner input changes, with worktree rows compared through the rank-insensitive owner-rows token. An input is marked consumed only after projection returns normally, so a throwing store commit still retries on the next emission. The bridge remains the only writer of slept-at and launch-directory pins, so skipping unchanged members does not drop a needed re-assertion.
…idden chats The transcript window re-read its scroll margin through an offsetTop walk in a dependency-free layout effect, so every render of every retained chat forced a synchronous layout read, including display:none panes where the walk cannot produce a margin. The read now runs only while the pane is visible; becoming visible re-renders and measures, and mount/resize measurements are unchanged.
…y mounted chat useNativeChatImageRuntimeContext shallow-subscribed each chat root to worktree rows, runtime environments, SSH state and other owner maps, then resolved the context in render. A worktree rank patch or a host catalog timestamp refresh replaced one of those maps and re-rendered the whole NativeChatStructuredSession of every mounted chat, hidden ones included (57 of 57 probes per write in the subscription benchmark). The selector now resolves the context itself and keeps the previous identity while the result is shallow-equal, so chats re-render only when their route or path changes.
- Use a stable PRNG that exercises the full operation space - Assert tab, agent, layout, and operation coverage
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThis PR reduces repeated work in retained chats and tab bars.
No actionable issues were found. Tests were inspected but not run. Reviews (1) · Last reviewed commit: "Strengthen tab agent projection fuzz cov..." · Reviewed by Greptile |
|
No actionable comments were generated in the recent review.
|
Problem
Hidden chats and large tab layouts were doing repeated work for updates that did not affect them, causing unnecessary rerenders, layout reads, and rescans.
Solution
Only update the chat or tab whose relevant data changed. Cache unchanged ownership and request data, skip hidden-pane layout reads, and reuse shared layout diffs.
ELI5
Hidden chats now stay quiet unless something relevant to that specific chat changes.
What Changed
Why
This prevents broad status, rank, catalog, and layout updates from making every retained chat or tab redo work when only one item changed.
Linked Issue
Fixes #
Visual Proof
N/A — no visual or interaction change; this is an internal performance optimization.
Testing
Automated tests added/updated for subscription fanout, hidden transcript behavior, projection diffs, AI Vault cache cleanup, and fuzz equivalence.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Considered security, cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, backwards compatibility, and performance. No user-facing behavior change intended.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)