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
fix(sse): emit servers.changed event after tool discovery completes (#292)
* fix(sse): emit servers.changed event after tool discovery completes
Fix race condition where tool counts in Web UI showed stale data after
enabling/disabling servers. The issue was that SSE events were emitted
before the asynchronous tool discovery completed, causing the frontend
to fetch stats from StateView before it was updated.
Changes:
- Move emitServersChanged() inside the tool discovery goroutine in both
HandleUpstreamServerChange() and RestartServer()
- Add "reason": "tool_discovery_complete" to event payload for clarity
- Change HandleUpstreamServerChange event type from "upstream_change"
to "tools_indexed" to better reflect when it's emitted
The frontend now receives the SSE event only after tool counts are
accurate, ensuring consistent UI updates within ~3-5 seconds.
Fixes#285
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(stats): TotalTools only counts enabled servers' tools (#285)
Root cause fixes for stale tool counts:
- TotalTools stat now excludes disabled servers' tool counts
- DeleteServerTools called when server is disabled to remove from index
Tests added:
- Unit test: TotalTools excludes disabled servers (service_test.go)
- Unit test: Disabled server removes tools from index (tool_invalidation_test.go)
- E2E test: Full disable/enable cycle with search verification
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(ui): totalTools only counts enabled servers' tools (#285)
The frontend was summing all servers' tool_count regardless of enabled
status, causing Total Tools to show stale counts when servers are
disabled.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
0 commit comments