You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
core: located Bus events visit unrelated Location subscribers #52921
User impact: With many project directories loaded, compaction can leave TUI
refreshes and live updates seconds behind. CodeNomad can suffer even more:
background recovery can load many old directories, and its extra event relay
can further delay updates, making conversations appear frozen while the server
is still working.
Location-scoped Bus subscriptions filter after shared PubSub delivery. Events
therefore visit unrelated loaded Location consumers, increasing native CPU and
delaying network-backed TUI operations during streaming/compaction.
A real PubSub regression with 220 unrelated Locations, 24 consumers each and
30 located publications records 159,180 subscriber visits on the baseline,
versus 780 with pre-delivery Location/type routing (zero unrelated visits).
Three alternating real CLI/ConPTY pairs under the same synthetic shared-server
recipe reduced Worktrees Ctrl+R from 3.626/12.736/13.438 s to
0.805/0.566/1.394 s. Those runs deliberately preloaded 220 native graphs and ran
22 traffic sessions; they do not represent ordinary two-tab startup. Local
input did not improve, and five restored tabs loaded only five graphs.
Related to #36443, but this is the narrower internal Location fanout bug,
not the requested public SSE client-interest API or a complete freeze fix.
Plugins
No additional plugins in the isolated reproduction.
Keep many native Location graphs loaded and stream events at one Location.
Refresh Worktrees in the real TUI during that streaming/compaction workload.
Compare native subscriber visits and network latency with few loaded graphs.
The deterministic regression is available on pascalandr:bus-location-fanout:
from packages/core, run bun test test/bus-fanout.test.ts.
Running its two unrelated-visit checks against the original Bus fails; the
candidate passes while preserving all matching/global deliveries.
Screenshot and/or share link
Logic/network issue; the proposed fix changes no TUI layout.
Potential overlap with existing event fan-out work—please compare:
2.0: Scope event subscriptions by client interest #36443: scopes /api/event delivery by client interest to avoid unrelated-location delivery. This report focuses on internal Location-scoped Bus/PubSub subscriber visits, so please confirm whether the fixes overlap.
Thanks for the detailed write-up and the measurements!
In short, you're asking for the core Bus to route Location-scoped events by Location and event type before PubSub delivery. Right now every live event goes through one shared PubSub and each Location subscriber filters afterwards, so unrelated loaded Locations still get visited. I checked packages/core/src/bus.ts and that's how it works today. Delivery is still correct, so I've filed this as a performance improvement rather than a bug. Maintainers will consider it, and your branch and the test/bus-fanout.test.ts regression test should make it easy to evaluate.
Activity
github-actions commentedon Oct 3, 2026
Potential overlap with existing event fan-out work—please compare:
/api/eventdelivery by client interest to avoid unrelated-location delivery. This report focuses on internal Location-scoped Bus/PubSub subscriber visits, so please confirm whether the fixes overlap.For keybind-related issues, please also check our pinned keybinds documentation: #4997
opencodejr commentedon Oct 27, 2026
Thanks for the detailed write-up and the measurements!
In short, you're asking for the core Bus to route Location-scoped events by Location and event type before PubSub delivery. Right now every live event goes through one shared PubSub and each Location subscriber filters afterwards, so unrelated loaded Locations still get visited. I checked
packages/core/src/bus.tsand that's how it works today. Delivery is still correct, so I've filed this as a performance improvement rather than a bug. Maintainers will consider it, and your branch and thetest/bus-fanout.test.tsregression test should make it easy to evaluate.Related:
/api/eventsubscriptions by client interest. As you noted, this issue is the narrower internal Location fanout part.