Repository navigation
fix(runtime): emit servers.changed after tool approval (#438) - #444
Merged
Merged
Conversation
Companion to PR #443 (frontend mergeServers stale-field clear). Background — issue #438: when a user clicks "Approve all tools" on the Server Detail page, the Servers/overview page (open in another tab, or reached via client-side navigation) keeps showing the "N pending approval" quarantine badge until a manual reload. PR #443 fixes the specific case where the user navigates to Servers in the SAME session, because the click handler explicitly calls serversStore.fetchServers(). This PR fixes the cross-tab / cross-session case: ApproveTools now publishes a servers.changed runtime event with reason="tools_approved" after successfully updating tool approval records. The event already exists for every other server-state mutation (enable/disable, restart, quarantine toggle, sync, server connected/disconnected, tools indexed — see internal/runtime/lifecycle.go); this fills in the one missing call site so any subscribed UI surface (web UI in another tab, tray, future clients) re-fetches authoritative state without depending on the acting tab to broadcast. The emit: - happens once per ApproveTools call, after the loop, gated on approved > 0 — bulk approval of 50 tools doesn't spam 50 events; a no-op call (e.g. tools that don't have records) emits nothing - includes server, approved_count, and approved_by in the payload so consumers can render targeted toasts ("3 tools approved on github by user@…") without needing a follow-up GET Tests in internal/runtime/tool_approval_event_test.go: * TestApproveTools_EmitsServersChanged — pre-seed a pending record, subscribe to the bus, call ApproveTools, assert one servers.changed (reason=tools_approved) within 2s, with the expected payload fields. * TestApproveTools_NoEventOnNoOp — call ApproveTools on a tool with no record (warn-and-continue path), assert NO event is published. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Deploying mcpproxy-docs with
|
| Latest commit: |
477c480
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2693d96c.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://fix-tool-approval-emit-serve.mcpproxy-docs.pages.dev |
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 25181025260 --repo smart-mcp-proxy/mcpproxy-go
|
1 of 2 tasks
Dumbris
added a commit
that referenced
this pull request
May 2, 2026
…#445) The release-notes generator (scripts/generate-release-notes.sh) feeds commit subjects to Claude with no edition context, and Claude has been inventing edition annotations from thin air: - v0.29.0: "*Note: The onboarding improvements primarily affect the **Personal Edition** desktop application.*" - v0.29.1: "**Personal Edition (macOS)**" header - v0.29.2: "*Note: All changes in this release apply to the Teams edition only.*" — wrong, all three PRs (#442, #443, #444) modify shared code (internal/runtime/, frontend/) and ship in both editions This patch updates the prompt to: 1. Briefly explain the two-edition build model so the model doesn't have to guess from training data. 2. Forbid edition-only annotations unless a commit subject explicitly says so (e.g. contains "(server)", "(teams)", "server-only"). 3. Forbid speculation from subject keywords (ui/runtime/oauth/etc). 4. Use "Server edition", not "Teams edition" — Teams is an internal package name. 5. Default to BOTH editions when unsure. The v0.29.2 release body has been hand-corrected separately. Co-authored-by: Claude Code <[email protected]>
13 of 18 tasks
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.
Companion to #443 (frontend mergeServers stale-field clear). Together they close #438.
Background
Issue #438 — when a user clicks Approve all tools on the Server Detail page, the Servers/overview page kept showing the "N pending approval" quarantine badge until a manual reload.
Fix
`Runtime.ApproveTools` (`internal/runtime/tool_quarantine.go`) now publishes a `servers.changed` runtime event with `reason="tools_approved"` after successfully updating approval records. The event is already emitted for every other server-state mutation in this codebase (enable/disable, restart, quarantine toggle, sync, server connected/disconnected, tools indexed — see `internal/runtime/lifecycle.go`); this fills in the one missing call site.
Properties of the emit:
```go
if approved > 0 {
r.emitServersChanged("tools_approved", map[string]any{
"server": serverName,
"approved_count": approved,
"approved_by": approvedBy,
})
}
```
Tests (`internal/runtime/tool_approval_event_test.go`)
Test plan
Why split from #443
The frontend merge fix is necessary on its own (without it, even the same-tab Approve flow leaves a stale badge after `fetchServers`). The SSE emit is purely additive and could ship independently. Per project convention, keeping the surface of each PR small.
🤖 Generated with Claude Code