Repository navigation
feat(web): list-changed handling — indicator, pull-on-demand default, and per-server auto-refresh opt-in (#1402) - #1443
Conversation
The per-screen list-changed indicator was hardcoded false in InspectorView for Tools, Apps, Prompts, and Resources, so it could never light up. Source it from the managed-state layer instead. Each ManagedXState now tracks a listChanged flag: set true when its */list_changed notification arrives (the existing auto-refresh leaves it set), exposed via getListChanged()/a listChangedChange event, and cleared by clearListChanged() or on disconnect. The useManagedX hooks surface the flag and clear it on a user-initiated refresh (the indicator's Refresh button = acknowledge). App threads the three flags to InspectorView, which maps them to the screens — Apps shares the tools flag since apps are a filtered view of tools. Tests cover set/clear/disconnect at the state-manager layer, the hook subscription + refresh-clears behavior, and the InspectorView routing (including Apps sharing the tools flag and no cross-wiring between screens). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
@claude review |
|
Claude finished @cliffhall's task in 1m 50s —— View job Review: wire the listChanged indicator across all screens (#1402)
Overall this is a clean, well-scoped, and well-tested change. The design — source the flag in the managed-state layer, set on notification, clear on user refresh or disconnect — matches what #1402 asks for, and the Things I checked and liked
Minor observations (non-blocking)
TestsCoverage is thorough: state-manager set/clear/no-op/disconnect, hook initial/event/refresh-clears/null-state, and InspectorView routing for all four screens plus the negative case. Nothing obviously missing for this change. No blocking issues — the minor race in (1) is the only item I'd consider tightening, and it's optional. |
…review) The useManagedX refresh() callbacks cleared the listChanged flag AFTER awaiting the fetch. If a */list_changed arrived mid-fetch, the state re-set the flag (and auto-refreshed), then the trailing clear wiped that genuinely-new signal. Clear BEFORE the await instead: the user's refresh acknowledges only the change in hand, and a mid-fetch change re-sets the flag and survives. Adds a race regression test on the tools hook. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Thanks for the thorough review! Addressed the actionable item; notes on the rest below. 1. Clear-after-await race — fixed ( Good catch — this was a real gap. Rather than capture-and-conditionally-clear, I moved the managedToolsState.clearListChanged(); // acknowledge the change in hand
const next = await managedToolsState.refresh();
setTools(next);The user's refresh acknowledges only the change they're looking at; if a Minor observations — acknowledged, no change:
|
|
@claude review |
|
Claude finished @cliffhall's task in 1m 4s —— View job Re-review: wire the listChanged indicator across all screens (#1402)
The race fix from the prior round is correct and the right call. Moving The new race-regression test ( Things I re-verified
One small optional note (non-blocking)
Nothing blocking — the prior observations (shared-flag UX, triplication, resources-vs-templates) were all addressed/acknowledged appropriately. LGTM. ✅ |
|
Thanks — glad the race fix landed cleanly. On the optional note (optimistic clear over a rejected refresh): I considered restore-on-failure but decided to leave it as-is, which matches your own criterion ("I wouldn't bother unless Restoring the flag on failure also has its own small wrinkle: the indicator label is literally "List updated", so re-showing it after a fetch that failed (the list did not update) would itself be slightly misleading. The clean time to add restore-on-failure is if/when these refreshes start surfacing errors to the UI the way tasks does — at which point the indicator and the error toast would be designed together. Flagging that as the natural follow-up rather than pre-building it here. No code change for this one. Everything else from the prior rounds remains addressed. |
|
@claude review |
|
Claude finished @cliffhall's task in 52s —— View job Re-review: wire the listChanged indicator across all screens (#1402)
This is the third pass, and the current state of the branch is solid — the two prior rounds' items are all landed or consciously deferred. Nothing new to flag. Re-verifying the end-to-end behavior against State managers (
Hooks — the race fix ( Wiring — all four
Tests — manager set/clear/no-op/disconnect, hook initial/event/refresh-clears/null-state + the mid-flight race regression on the tools hook, and InspectorView routing for all four screens plus the no-cross-wiring negative case. Thorough and appropriately scoped (one representative race test for shared logic). Standing trade-offs (already discussed, no change expected)
No blocking issues. LGTM. ✅ |
AppControls uniquely had a standalone toolbar Refresh button AND the ListChangedIndicator on a separate row, so once the indicator could actually appear (this PR), the Apps screen showed two Refresh buttons. Match the other three controls (Tools/Prompts/Resources): the indicator is the single header-right refresh affordance. Updates AppControls and AppsScreen tests to assert exactly one Refresh (and none when the list hasn't changed). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Pushed @claude review |
|
Claude finished @cliffhall's task in 1m 4s —— View job Re-review: drop duplicate Refresh on the Apps screen (
|
… Refresh (#1402) With auto-refresh on, the list was already current by the time the list-changed indicator appeared, making its Refresh button moot. Now the managed Tools/Prompts/Resources state managers only flag the change on */list_changed (they no longer auto-refresh); the list stays as-is until the user clicks Refresh, which fetches the new list and clears the indicator. The connect-time initial load is unchanged. Resource templates (no own indicator, part of the Resources screen) also stop auto-refreshing; onRefreshResources now refreshes both resources and templates, since a single resources/list_changed covers both. Tasks are left auto-refreshing — they have no list-changed indicator and need live status updates. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Pushed Previously the managed state auto-refreshed on every
Tests: the four " @claude review |
|
Claude finished @cliffhall's task in 1m 12s —— View job Re-review: stop auto-invoking
|
review) The class no longer subscribes to resourceTemplatesListChanged; update the stale file/class docstrings that still claimed it syncs on that notification to reflect connect + statusChange only. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Fixed the stale docstrings in `managedResourceTemplatesState.ts` (`19692cc9`) — the file header and class docstring no longer claim a `resourceTemplatesListChanged` subscription; they now describe connect + statusChange only, with a note that templates are pulled on demand via the Resources Refresh. On the standing trade-off you noted (lists can be stale until Refresh — e.g. invoking a removed tool from a stale list errors until the user refreshes): agreed it's the deliberate, expected consequence of pull-on-demand, and as you say arguably better than the list silently changing under the user. No change. @claude review |
|
Claude finished @cliffhall's task in 33s —— View job Re-review: correct ManagedResourceTemplatesState docstrings (
|
…' option (#1402) New Options section in ServerSettingsForm with a single checkbox. When checked, the managed Tools/Prompts/Resources (and resource templates) state auto-refreshes on */list_changed notifications; when unchecked (default) the notification only lights the list-changed indicator and the user pulls via Refresh. Plumbing: new optional autoRefreshOnListChanged on InspectorServerSettings and StoredMCPServer, round-tripped through serverList (lifted with a false default, persisted only when true, added to the exhaustive field-key map); surfaced from InspectorClient via a new getServerSettings() on the protocol; the state managers read it live at notification time to decide auto-refresh vs flag-only. Resource templates re-subscribe to their list_changed but only auto-refresh when the option is on (they have no indicator of their own). Tests cover the round-trip (true persists, false omitted), the form section (render/checked/toggle), and each state manager's on/off branch. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Pushed End-to-end plumbing:
Tests: serverList round-trip (true persists / false omitted, with the lift-default cases updated), the form section (renders, reflects checked state, fires @claude review |
|
Claude finished @cliffhall's task in 2m 37s —— View job Re-review: per-server "Auto Refresh on List Changed Notifications" option (
|
#1402) The PUT /api/servers write path runs settings through validateSettings, which rebuilds the value from explicitly-named fields and silently drops unknown keys — so autoRefreshOnListChanged never reached disk (the serverList round-trip test passed because it calls inspectorSettingsToStoredFields directly, bypassing this path). Validate it as an optional boolean and include it in the built value; false is omitted on disk by inspectorSettingsToStoredFields as before. Adds integration tests over the real PUT path: true persists, false is omitted, and a non-boolean is rejected (400). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Good LGTM, but a real bug slipped past both of us: the setting wasn't actually persisting (caught by manual testing). Fixed in Root cause: the Fix: On your connect-time-vs-live note: agreed and confirmed — the persisted value is picked up on the next
@claude review |
|
Claude finished @cliffhall's task in 1m 1s —— View job Re-review: persist
|
…1402) Open 'Options' instead of 'Custom Headers' when the Server Settings modal first opens, so the new Auto Refresh toggle is the first thing surfaced. Updates the modal default-expanded section, the modal test's initial-state assertions, the three header tests (now expand 'Custom Headers' first since it's no longer open by default), and the story defaults. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Pushed
@claude review |
|
Claude finished @cliffhall's task in 1m 17s —— View job Re-review: default Server Settings modal to the Options section (
|
…the class 8307644 swept an exported Inspector message-history JSON (manual-testing artifact at the repo root) into the tree via git add -A. Untrack it and extend the existing repo-root debug-artifact .gitignore block (alongside /*.png) to cover /inspector-history-*.json so these can't be re-added. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Good catch — that was a real mistake. My Thanks for verifying the actual modal change too (default → Options as the first accordion item, @claude review |
|
Claude finished @cliffhall's task in 38s —— View job Re-review: drop accidentally-committed history dump; gitignore the class (
|
Summary
Closes #1402.
This started as "wire the
listChangedsidebar indicator across all screens" and grew into the full list-changed handling story for Tools, Apps, Prompts, and Resources. The throughline: make the list-changed indicator meaningful (the server changed its list since you last looked), make manual Refresh the default way to pull the new list, and give servers/users an opt-in to restore eager auto-refresh.What changed
1. Wire the
listChangedindicator across all screensInspectorViewhardcodedlistChanged={false}for Tools, Apps, Prompts, and Resources, so the indicator could never light up. The flag is now sourced from the managed-state layer:ManagedXStatetracks alistChangedboolean — exposed viagetListChanged()+ alistChangedChangeevent, cleared byclearListChanged()or on disconnect.useManagedXhooks surface the flag and clear it on a user-initiatedrefresh()(clearing before the awaited fetch so a notification arriving mid-fetch isn't lost — race fix).Appthreads the three flags toInspectorView, which maps them to screens. Apps shares the Tools flag (apps are a filtered view of tools); Resources usesresourcesListChanged(the single server notification that covers resources + templates).2. Drop the duplicate Refresh on the Apps screen
AppControlsuniquely had a standalone toolbar Refresh and the indicator on a separate row — so once the indicator could appear, Apps showed two Refresh buttons. Aligned it with the other three controls: the indicator is the single header-right refresh affordance.3. Pull-on-demand by default (stop auto-invoking
*/listonlist_changed)With auto-refresh on, the list was already current by the time "List updated" appeared, making Refresh a no-op re-fetch (confirmed by capturing two
tools/listcalls — byte-identical results). Now the managed Tools/Prompts/Resources state only flags the change; the list stays as-is until the user pulls it. The connect-time initial load is unchanged. Resource templates stop auto-refreshing too;onRefreshResourcesrefreshes both resources and templates (templates had no user-facing refresh wired before — gap closed). Tasks are intentionally left auto-refreshing (no indicator, need live status).4. Per-server "Auto Refresh on List Changed Notifications" opt-in
A new Options section in
ServerSettingsFormwith a single checkbox (default off) restores eager auto-refresh per server. Plumbed end-to-end:autoRefreshOnListChangedonInspectorServerSettings+StoredMCPServer, round-tripped throughserverList(lift-defaultfalse, persist only whentrue, added to the exhaustiveINSPECTOR_FIELD_KEY_MAP) and the server-sidevalidateSettingswrite path.InspectorClient.getServerSettings()added toInspectorClientProtocol; the state managers read it live at notification time to choose auto-refresh vs flag-only.rootsapplies live).5. Default the Server Settings modal to the Options section
The modal now opens to Options instead of Custom Headers, surfacing the new toggle first.
Testing
InspectorViewrouting for all four screens + no-cross-wiring;AppControls/AppsScreensingle-Refresh;ServerSettingsFormOptions section (render/checked/toggle); modal default-section.serverListround-trip (true persists / false omitted) and integration tests over the realPUT /api/serverspath (the unit round-trip bypassedvalidateSettings, where the persistence bug lived).npm run validate(lint/build/format/typecheck + unit & integration coverage gate) andnpm run test:storybookgreen.Notes / deliberate trade-offs
setServerSettings-on-the-live-client follow-up is a reasonable future enhancement.🤖 Generated with Claude Code