fix(client): refresh only loaded catalogs on location events - #47443
Open
Hona wants to merge 1 commit into
Open
Conversation
Every Location booted on the server emits catalog, agent, command, skill, reference, integration, websearch and MCP events, including Locations this client never opened. Each event eagerly re-fetched that location's catalog, producing request waves across hundreds of directories. Events still invalidate so the next explicit read is fresh, but only catalogs a consumer already read are re-fetched, mirroring the existing config.updated guard. credential.* events apply the same rule per stored location key. Websearch providers have no explicit reader; the TUI's integration dialog relies on events to fill them, so that refresh is gated on the location having been opened (syncInfo) instead of on a prior read.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
createDatare-fetches a location's catalog on everycatalog / agent / command / skill / reference / integration / websearch / mcp.*event for any Location the server emits about — including Locations this client never opened. On a shared server that is every Location another client booted. A Desktop capture showed 1,679 request jobs in 99 s across 118 directories from this path alone; the TUI does the same work silently because Bun has no per-origin socket limit.Change
flowchart LR E[location event] --> I[invalidate catalog] I --> G{loaded? read before or reading now} G -->|yes| R[re-fetch] G -->|no| N[nothing: next explicit sync fetches fresh]locationResourcegainsloaded(ref):store.location[key][field] !== undefined || sync.has(key). This is the testconfig.updatedwas already doing inline (data.ts:1219-1222onv2), now named and applied to every per-location refresh, including thecredential.*loop over stored location keys.dialog-integration.tsx:102) relies on events to fill them. That refresh is gated on the location having been opened (infopresent aftersyncInfo) instead of on a prior read, so first population still happens.TUI
No behaviour change for what the TUI displays:
context/location.tsx→location.sync)loaded()syncInfo+vcs.synconly;vcs.branch.updatedis a store write, never a fetchsync()on openmini/catalog.shared.tsWhat it stops doing: re-fetching agents/models/MCP for Locations other clients booted on the same server. It never displayed that data.
Companion to #47441 (app-side).