Repository navigation
fix: quarantined servers over-report available tools (#1064) + three Web UI presentation defects (#1065) - #1072
Merged
Merged
Conversation
…ble (#1064) A quarantined server kept reporting its tools as available. `tool_count` stayed at its pre-quarantine value, `GET /api/v1/tools` returned every one of them, and the Servers page rendered the total under "Available across all servers" — while the search index correctly excluded them (#1061) and every call to those tools was refused with a SECURITY BLOCK. Two surfaces describing the same catalog disagreed, and the one an operator reads was the wrong one. Quarantine is neither "disabled" nor "disconnected": a quarantined server stays dialed with status ready on purpose, so the tray and Web UI can inspect it for review. It therefore passed the existing disabled/not-connected guard untouched. The stale count also survives the supervisor's disconnect-zeroing, because LoadConfiguredServers re-dials the server and the next reconcile re-sticks the retained snapshot. Adds one shared predicate, config.ServerContributesTools(enabled, quarantined), mirroring the answers runtime.serverEligibleForIndexing already gives the index writer and preflight.ClassifyTool gives dispatch, and adopts it at the surfaces that were each re-deriving "available" from a different field: - Projections zero the per-server count at the wire boundary: Runtime.GetAllServers, Server.GetAllServers, and both GetUpstreamStats paths (including the manager fallback, whose cached tool count no quarantine path invalidates). - Aggregates gate the sum: management.ListServers, Server.GetUpstreamStats, Manager.GetTotalToolCount. - GET /api/v1/tools and GET /api/v1/annotations/coverage skip quarantined servers. Skipping is a deliberate exclusion, not a fetch failure, so neither sets `partial`/`failed_servers`. - getVisibleToolCount returns 0 for a quarantined server. - The Web UI's totalTools excludes them too. Deliberately unchanged: - GET /api/v1/servers/{id}/tools still returns the full list. That is the review surface — it is how an operator inspects and approves a quarantined server, and after #1061 the StateView is its only source. Same for Server.GetQuarantinedServers, which exists to say how many tools await review. - isToolCallable stays quarantine-blind. It is the *search* filter and must reproduce merge-base semantics exactly (Spec 085 FR-006/FR-011), which require retrieve_tools to keep surfacing a quarantined server's lingering indexed tools; the stricter toolVisibleToSession applies the quarantine gate. TestVisibleToolCount_QuarantinedServer pins both halves so the two cannot be collapsed again. - stats.quarantined_servers and health admin_state=quarantined are untouched — they are the counterpart that must still show a non-zero number. Behaviour change worth calling out at review: users with quarantined servers will now report lower tool counts in /api/v1/status, the SSE servers.changed embed, /api/v1/profiles, the Prometheus tools-total gauge, the telemetry heartbeat, and the TOOLS column of `mcpproxy upstream list`.
…, stale auth error (#1065) 1. A server card asserted two contradictory security states at once The card rendered a green "Clean" scan verdict directly above a yellow "Quarantined — needs security review" banner. Both are individually true, but stacked as peers they tell the operator opposite things: the scan verdict is about CONTENT, quarantine is about REVIEW STATE. While quarantined, the standalone verdict badge is suppressed and the verdict is folded into the banner as a subordinate clause ("Last scan: clean — still needs review"), so the card carries exactly one security headline. This is the subordination ServerDetail's spec-088 banner already does, and the same shape as the #938 held-tools downgrade one level up. Nothing changes when the server is not quarantined. Every verdict still ends in a request to review, including the failed case, which is an INCOMPLETE scan and never a threat verdict. The Servers v-memo key gains security_scan.status and finding_counts.warning: the store updates server objects in place to preserve identity, so without them a scan settling on an already-quarantined server left a stale verdict. 2. The Activity Type column mixed two vocabularies formatType fell through `|| type` for anything unmapped, so raw snake_case landed in a column otherwise full of title-cased prose. Four backend types had no label, not the one reported: tool_quarantine_change, security_scan (already rendering raw today — it has had a findings drawer since #1046), credential_broker and prompt_get. The map is completed and exported as ACTIVITY_TYPE_LABELS, and the passthrough is replaced with a snake_case -> Title Case fallback so an unmapped value can never leak raw again. Server-level and tool-level quarantine keep distinct labels. The filter dropdown is derived from the same map instead of being hand-copied (it was three types short), and ActivityWidget's duplicate icon map is deleted in favour of the shared one. The recurrence guard lives in Go, not vitest: internal/storage/activity_label_parity_test.go fails when a backend type has no Web-UI label. .github/workflows/frontend.yml is path-filtered to frontend/**, so a vitest-only guard would never run on the Go-only change that adds a type. A second test asserts ValidActivityTypes covers every declared constant, so the first cannot go vacuously green. 3. A stale auth error survived a successful sign-in With no stored key, /ui/activity showed the auth modal, an inline red "Invalid or missing API key" panel behind it, and a Disconnected chip. Entering a valid key re-authenticated the header — counts and the Live badge came back — but the view body kept the red panel and rendered zero rows until the user clicked Retry by hand. Every view holds its load error in a component-local ref that nothing outside the component can reach, and no auth-recovered signal existed to reach it. Adds a monotonic authEpoch to the system store, bumped by markAuthRecovered() only on a genuine failed->ok transition. App.vue keys <router-view> on it, so a repaired auth remounts the current view and its error, loading state and data reset to their declared initial values while onMounted re-runs. Keyed on authEpoch alone: folding in the route path would remount ServerDetail on every :serverName change and break the Dashboard's single instance across /, /usage and /overview. reloadAfterAuth() re-primes the surfaces the key cannot reach (fetchInfo, fetchRouting, checkAuth — the router guard does not run for a key-driven remount), and SidebarNav watches the epoch for its badge counts rather than being remounted, which would also reset its open submenu and scroll. AuthErrorModal's "Refresh & Retry" now validates the reloaded key before reporting success and emits `refresh(verified)`. It previously cleared the auth flag without verifying anything, which is why it could not safely invalidate views — and why the stale panel survived on that path.
Deploying mcpproxy-docs with
|
| Latest commit: |
a8b4ecb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://01e2626b.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://claude-chat-hygiene-handoff.mcpproxy-docs.pages.dev |
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 33064052359 --repo smart-mcp-proxy/mcpproxy-go
|
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.
Pull Request
Description
Fixes #1064 and #1065 — one backend counting defect and three Web UI presentation defects. Two commits, independently reviewable.
#1064 — a quarantined server's tools were still counted as "available"
tool_countstayed at its pre-quarantine value,GET /api/v1/toolsreturned every one of them, and the Servers page rendered the total under "Available across all servers" — while the search index correctly excluded them (#1061) and every call to those tools was refused with a SECURITY BLOCK. Two surfaces describing the same catalog disagreed, and the one an operator reads was the wrong one.Quarantine is neither disabled nor disconnected: a quarantined server stays dialed with
status: readyon purpose, so the tray and Web UI can inspect it for review. It therefore passed the existing disabled/not-connected guard untouched. The stale count also survives the supervisor's disconnect-zeroing, becauseLoadConfiguredServersre-dials the server and the next reconcile re-sticks the retained snapshot — which is why this is fixed at the projections rather than at the source.Adds one shared predicate,
config.ServerContributesTools(enabled, quarantined), mirroring the answersruntime.serverEligibleForIndexingalready gives the index writer andpreflight.ClassifyToolgives dispatch, and adopts it at the surfaces that were each re-deriving "available" from a different field.GET /api/v1/annotations/coveragehad the same bug and is not mentioned in the issue.Deliberately unchanged, and the main thing to check at review:
GET /api/v1/servers/{id}/toolsstill returns the full list. That is the review surface — it is how an operator inspects and approves a quarantined server, and after security: quarantining a server via the config file leaves its tools in the search index, so retrieve_tools still discloses their descriptions #1061 the StateView is its only source. Same forServer.GetQuarantinedServers, which exists to say how many tools await review.isToolCallablestays quarantine-blind. It is the search filter and must reproduce merge-base semantics exactly (Spec 085 FR-006/FR-011), which requireretrieve_toolsto keep surfacing a quarantined server's lingering indexed tools; the strictertoolVisibleToSessionapplies the quarantine gate. My first attempt gated here and broke three pinned tests.TestVisibleToolCount_QuarantinedServernow pins both halves so the two cannot be collapsed again.stats.quarantined_serversand healthadmin_state=quarantinedare untouched — they are the counterpart that must still show a non-zero number.Behaviour change worth calling out: users with quarantined servers will now report lower tool counts in
/api/v1/status, the SSEservers.changedembed,/api/v1/profiles, the Prometheus tools-total gauge, the telemetry heartbeat, and the TOOLS column ofmcpproxy upstream list.#1065 — three Web UI presentation defects
1. A card asserted two contradictory security states. Green
Cleansat directly above yellowQuarantined — needs security review. Both true; stacked as peers they say opposite things, because the verdict is about CONTENT and quarantine is about REVIEW STATE. While quarantined the standalone badge is suppressed and the verdict becomes a subordinate clause inside the banner (Last scan: clean — still needs review), so there is one security headline per card — the subordination ServerDetail's spec-088 banner already does. Every verdict still ends in a request to review, includingfailed, which is an incomplete scan and never a threat verdict.2. The Activity Type column mixed two vocabularies.
formatTypefell through|| type, so raw snake_case landed in a column otherwise full of title-cased prose. Four backend types had no label, not the one reported —security_scanis already rendering raw today, since it gained a findings drawer in #1046. The map is completed and exported, and the passthrough is replaced with asnake_case -> Title Casefallback so an unmapped value can never leak raw again. The filter dropdown is now derived from the same map instead of being hand-copied (it was three types short).The recurrence guard lives in Go, not vitest:
.github/workflows/frontend.ymlis path-filtered tofrontend/**, so a vitest-only guard would never run on the Go-only change that adds an activity type.3. A stale auth error survived a successful sign-in. Entering a valid key re-authenticated the header while the view body kept its red panel and zero rows until the user clicked Retry. Every view holds its load error in a component-local ref nothing outside can reach. Adds a monotonic
authEpochbumped only on a genuine failed→ok transition;App.vuekeys<router-view>on it so a repaired auth remounts the current view.AuthErrorModal's "Refresh & Retry" now validates the reloaded key before reporting success — it previously cleared the auth flag without verifying anything, which is why it could not safely invalidate views.Testing
Every new test was confirmed to fail before the corresponding fix, not just pass after it.
go test -race ./...(CI skip regex)golangci-lint run --config .github/.golangci.yml ./...vitest run-tags server) build + testscontracts.ts,web/)Live verification against an isolated instance with a real
server-memoryupstream, quarantining and un-quarantining it:tool_countstats.total_toolsGET /api/v1/tools/api/v1/statustotalannotations/coverageindex/searchservers/{id}/tools(review surface)Disabled-server behaviour re-checked and unchanged. All three #1065 defects were confirmed in the running Web UI: no bare "Clean" anywhere on the Servers page, the Type column renders
Tool Quarantine Change/Security Scan, and signing in drops the red panel and renders rows with no manual Retry.Not run:
./scripts/test-api-e2e.sh— it blanket-pkills other running cores and another local instance was live. Worth running before merge.Notes for the reviewer
Cross-reviewed with an independent model, which found two real defects that are fixed here: the
isToolCallableover-reach described above, and av-memokey that trackedsecurity_scan.statusbut not the warning count the new note renders. It also flagged thathandleAuthModalRefreshleft defect 3 unfixed on the Refresh path — hence the validation change toAuthErrorModal.