Repository navigation
fix(tray): stop the permanent red badge, and shrink it to a corner dot - #1075
Conversation
The v0.61.0 tray badge (#1055) sat red indefinitely on an install whose only error-severity diagnostics belonged to quarantined servers, and it was drawn as a full-size glyph beside the icon rather than a badge on it. Tray badge — quarantined servers no longer tint it worstDiagnosticSeverity and diagnosticCount excluded OAuth login-required servers but not quarantined ones. mcpproxy still attempts a connection to a quarantined server so the scanner can export its tool definitions, and the failed attempt leaves an error-severity diagnostic behind — while the same payload reports health.level "healthy" / admin_state "quarantined". The menu header drew a calm yellow dot from serversNeedingAttention under a red menu-bar dot from worstDiagnosticSeverity, and the user could not clear it without approving or disabling the server. Both properties now share one ServerStatus.isBadgeExempt predicate so they cannot drift apart, and any future intentional non-connected state has one place to be added. Tray badge — drawn as a corner dot, not a glyph beside the icon The severity badge was a full-size "●" plus a leading space in the button's attributed title, which widened the status item by about a character and read as a second icon. It is now a 6pt dot in the icon's bottom-right corner, as a subview: the status-item image must stay isTemplate to track the light/dark menu bar and to invert while the menu is open, and template rendering forces every pixel monochrome, so a coloured dot composited into the image comes back black. The view is hit-test transparent and ignored by accessibility, since the button already publishes the whole state as its label. ⏹ (core stopped) and ⚠ (core error) keep their full-size glyphs: those mean "nothing is working", which is worth the width and would be lost if collapsed into the same dot. Diagnostics — two of mcpproxy's own messages no longer say "file a bug" `command "npx" has no args` (emitted by our own pre-spawn validation in connection_stdio.go) and the legacy-SSE `4xx for initialize POST` both fell through to MCPX_UNKNOWN_UNCLASSIFIED, whose catalog entry offers a "Report a bug" button. They now classify as MCPX_CONFIG_INVALID_COMMAND and MCPX_HTTP_LEGACY_SSE, with catalog entries and docs pages. The legacy-SSE rule is matched before the generic HTTP status-text fallback, which would otherwise claim it as a bare 403/404 and send the user hunting for a credential problem that does not exist. Logging — one ListTools failure was three ERROR lines core.Client, managed.Client and Manager.discoverTools each logged the same failed list operation at ERROR. On an install with several stdio servers the periodic sweep hit this roughly once a minute per server, indefinitely. The two inner layers drop to Debug; the manager keeps the line at Warn, since it deliberately skips markSwept so the next sweep retries — a failure the code already plans to retry is not an error. Tests - Swift: quarantine/OAuth badge exemption from live /api/v1/servers payload shapes, including that a genuinely broken server still tints red and that the spoken count agrees with the badge. - Swift: corner-dot geometry and colour asserted by rendering the view offscreen and reading pixels back — the status item cannot be screenshotted without a Screen Recording grant, and "it looked right once" is not a regression test. - Go: both new codes classify from the verbatim v0.61.0 error strings, ordinary HTTP statuses are unaffected, and both codes are registered. - Go: one ListTools failure is reported by exactly one layer, not at ERROR, and is still reported at all.
Deploying mcpproxy-docs with
|
| Latest commit: |
2a73ca8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8949ccf0.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://claude-mcpproxy-red-dot-debu.mcpproxy-docs.pages.dev |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 33146415833 --repo smart-mcp-proxy/mcpproxy-go
|
Cross-model review (opencode, gpt-5.6-sol) caught a real defect in the
corner-dot badge: it was a 6x6 subview positioned from `button.bounds` at
update time and pinned with `[.minXMargin, .maxYMargin]`. That anchors to
the BUTTON's bottom-right, but the dot belongs to the CENTRED 18pt icon,
and it broke in two independent ways.
* Rate mismatch. When the status button shrinks by N, a right-pinned
subview moves left by N while the centred icon's right edge moves left
by only N/2 — the badge slides off the glyph it is badging.
* Stale bounds. NSStatusItem is variableLength and resizes
asynchronously, so the `button.bounds` read immediately after clearing
`attributedTitle` (which updateStatusIcon does, in the same pass) is
still the old, wider value. The dot is then laid out against an icon
centre that no longer exists.
The overlay now fills the button, autoresizes with `[.width, .height]`,
and computes the dot inside `draw(_:)` from its own live bounds. Any
resize simply repaints in the right place, which removes both failure
modes rather than patching either. `hitTest` already returned nil, which
is what keeps the now-full-size overlay from swallowing every click.
Note `needsDisplayOnBoundsChange` is a CALayer property and does not exist
on NSView — the review suggested it and it does not compile. `setFrameSize`
is overridden instead.
Tests
The drawing tests now RENDER the view and scan the bitmap for the pixels
it actually painted, converting device pixels to points, rather than
sampling one computed point. The earlier version guessed the bitmap's
y-flip, read a transparent pixel, and would have reported "the view drew
nothing" as a colour failure. Scanning asserts position, colour and
restraint together and survives a geometry retune. Added:
- the dot tracks the icon across button widths (the regression above)
- a resize re-renders it in its new place
- only the corner dot is painted, never a wash over the whole icon
Multi-agent verification found what both I and the cross-model review
missed, by compiling against real AppKit rather than reasoning about it:
NSView().isFlipped = false
NSButton().isFlipped = true
NSStatusBarButton.isFlipped = true
The first commit in this PR (9c740c0) therefore shipped the badge in the
icon's TOP-right corner, not the bottom-right its comment and commit
message both claimed. `y = 2` in a flipped button is 2pt from the TOP, and
`.maxYMargin` pins to the TOP. Rendered inside a real 36x22 status button
the dot landed at bitmap rows 4-15 of 44 (top-first).
The second commit (5e773a9) already corrected it — but incidentally,
because TrayBadgeDotView is a plain NSView and computes the dot in its own
unflipped space. Nothing recorded that the design depends on that, and no
test could tell the two apart: every badge test rendered the view
standalone, where the flip never enters the picture.
* `isFlipped` is now overridden to `false` explicitly. It is load-bearing,
not incidental — overriding it to true silently moves the badge back to
the top-right.
* TrayBadgeDotView's and badgeDotFrame's comments described the OLD bug
wrongly (they said the mask pinned bottom-right). Corrected, with the
flipped-coordinate trap written down as the reason the design is shaped
the way it is.
* New TrayBadgeInStatusButtonTests renders the overlay inside a REAL
NSStatusBarButton and asserts the dot is in the visual lower-right.
Mutation-tested: flipping the overlay fails it with "badge is in the
TOP half — the flipped-coordinate bug is back (rows 4...15 of 44)",
matching the shipped bug's measured position exactly.
Also from the sweep:
* The legacy-SSE string is mcp-go's exported `transport.ErrLegacySSEServer`,
NOT one of ours as the classifier comment, the test file and the PR body
all claimed. Corrected, `errors.Is` added as the primary check (the
substring fallback stays, since the upstream layer stringifies the error
and breaks the errors.Is chain), and TestLegacySSESentinelStillMatches
pins the vendored wording — otherwise a routine mcp-go bump silently
regresses MCPX_HTTP_LEGACY_SSE to MCPX_HTTP_404 with the suite green.
* `serversWithDiagnostic` was left on the narrower OAuth-only predicate
when isBadgeExempt was introduced, breaking the "these filter
identically" invariant at birth. Nothing consumes it today, which is
precisely why the drift would have surfaced late. Aligned, and pinned by
a test.
* `isQuarantineReview`'s comment claimed `quarantined` and `admin_state`
were two independent signals. They are not — health/calculator.go derives
the second from the first. The check is kept as belt-and-braces; the
claim is corrected.
* Added the composition case nothing covered: servers are quarantined on
add, so a newly added npx-with-no-args server is quarantined AND broken.
It asks for review rather than raising a red badge — deliberate, now
pinned, along with the case that it DOES alarm once released.
Cross-model review + multi-agent verification — findings and fixesReviewed with opencode / gpt-5.6-sol, then independently verified by a 14-agent sweep (each of the four fixes verified by running real commands, every claimed defect handed to adversarial refuters). Three real defects found, all fixed in The important one:
|
…w server TrayBadgeInStatusButtonTests creates a real NSStatusBar item, which is the whole point — the flipped-coordinate bug is invisible to a standalone render. But `swift test` runs on a macos-latest runner whose window-server state is not guaranteed, and there `item.button` is nil. XCTUnwrap turned that into a FAILURE, so a green local run could have gone red in CI for a reason the test cannot assert there. Throws XCTSkip instead. The assertions are about AppKit geometry inside a real button; with no button there is nothing to assert, and that is a skip, not a defect.
…1034) (#1077) Two independent fixes, both clearing red state ahead of the v0.62.0 cut. #1076 — Server Detail rendered the red ErrorPanel AND the calm Security Quarantine banner off one payload. mcpproxy still attempts a connection to a quarantined server so the scanner can export its tool definitions; that attempt fails and leaves an error-severity diagnostic behind — usually the unclassified one — while internal/health/calculator.go short-circuits the server to healthy/quarantined. Both facts are true in one response, and the UI read only the first, telling the user to file a bug report about a server that is simply waiting for them to approve it. Quarantine now suppresses every fault alert on the page, following the SignInPanel precedent one block up (MCP-1821): an intentional admin state is not a fault. The guard covers the generic `last_error` alert as well as the diagnostic panel — without that, suppressing one just falls through to the other and prints the same fault in a different red box. This is the same rule #1075 applied to the tray badge, on the surface that PR deliberately did not touch; `admin_state` stays the cross-surface contract. #1034 — the E2E Tests / windows-latest job has been red on main since 2026-08-13. Root cause is a timeout-budget mismatch between two workflows running the same sweep: e2e-tests.yml used `-timeout 4m` where unit-tests.yml uses 10m. internal/server took 240s on the Windows runner and died at `panic: test timed out after 4m0s` with a single test only 2s in — cumulative slowness (Bleve index creation on the Windows filesystem), never a hang, so raising the budget to match is the whole fix. Verified: 959/959 frontend unit tests, vue-tsc clean, and the Playwright web-UI sweep run four ways (with and without the fixture upstream, on this branch and on a rebuilt origin/main baseline) — identical results each pairing, so the sweep's remaining failures are pre-existing on main and untouched by this change.
Pull Request
Description
Reported symptom: after updating to v0.61.0 the tray showed a red dot that never cleared, and it looked too big.
Both halves turned out to be real, plus two more defects found while tracing it. The badge itself is new in v0.61.0 (#1055) — this state existed before, it was simply invisible.
1. Quarantined servers no longer tint the badge red
worstDiagnosticSeverity/diagnosticCountexcluded OAuth-login-required servers but not quarantined ones. mcpproxy still attempts a connection to a quarantined server so the scanner can export its tool definitions, and the failed attempt leaves an error-severity diagnostic behind — while the same payload reportshealth.level: "healthy"/admin_state: "quarantined".That is why the reporter's screenshot showed a calm yellow dot in the menu header (drawn from
serversNeedingAttention) under a red menu-bar dot (drawn fromworstDiagnosticSeverity), off one payload. The user could not clear it without approving or disabling the server.Both properties now share one
ServerStatus.isBadgeExemptpredicate so they cannot drift apart, and any future intentional non-connected state has exactly one place to be added.2. The badge is a corner dot, not a glyph beside the icon
It was a full-size
"●"plus a leading space in the button'sattributedTitle, which widened the status item by roughly a character and read as a second icon rather than a badge on the first. It is now a 6pt dot in the icon's bottom-right corner.It has to be a subview, not pixels composited into
button.image: that image must stayisTemplateto track the light/dark menu bar and to invert while the menu is open, and template rendering forces every pixel monochrome — so a red dot drawn into the image comes back black. The view is hit-test transparent (otherwise it would swallow the clicks that open the menu wherever it overlaps the icon) and ignored by accessibility, since the button already publishes the whole state as its label.⏹(core stopped) and⚠(core error) keep their full-size glyphs. Those mean "nothing is working" — worth the width, and the distinction would be lost if collapsed into the same dot.3. Two of mcpproxy's own error messages no longer say "file a bug"
command "npx" has no args(emitted by our own pre-spawn validation inconnection_stdio.go) and the legacy-SSE4xx for initialize POSTboth fell through toMCPX_UNKNOWN_UNCLASSIFIED, whose catalog entry offers a "Report a bug" button — for a config typo the user can fix in one line.They now classify as
MCPX_CONFIG_INVALID_COMMANDandMCPX_HTTP_LEGACY_SSE, with catalog entries and docs pages. The legacy-SSE rule is matched before the generic HTTP status-text fallback, which would otherwise claim it as a bare 403/404 and send the user hunting for a credential problem that does not exist.4. One
ListToolsfailure was three ERROR linescore.Client,managed.ClientandManager.discoverToolseach logged the same failed list operation at ERROR. On an install with several stdio servers the periodic sweep hit this roughly once a minute per server, indefinitely — measured at ~110 ERROR lines/min during startup and ~14/min at steady state, rotatingmain.logevery couple of hours.The two inner layers drop to Debug. The manager keeps its line at Warn: it deliberately skips
markSweptso the next sweep retries, and a failure the code already plans to retry is not an error.Testing
Verified against a live isolated instance (
MCPPROXY_HOME=/tmp/mcpproxy-dot, port 18477) seeded with both fixtures — a misconfigurednpxserver and an unreachable quarantined server:title: "", width unchanged at 36pt — the badge no longer widens the menu bar.args" instead of "file a bug report".Automated:
go build ./...clean;golangci-lint run --config .github/.golangci.yml ./...→ 0 issues.internal/diagnostics,internal/upstream/...,internal/telemetry.AppLifecycleTests.testTheSharedJournalNeverWritesToTheRealInstanceRootUnderTests, which asserts~/.mcpproxy/tray-lifecycle.jsonldoes not exist and fails on any machine with a running tray. Pre-existing and environmental, unrelated to this change.New tests:
/api/v1/serverspayload shapes — including that a genuinely broken server still tints red, and that the spoken count agrees with the badge.ListToolsfailure is reported by exactly one layer, not at ERROR, and is still reported at all.Notes for the reviewer
./scripts/test-api-e2e.shwas not run: it blanket-pkills mcpproxy cores and would have killed the reporter's live core mid-session. Worth running in CI or on a quiet machine.docs/errors/README.mdandwebsite/sidebars.js— the file allowlist is a glob, but the sidebar is manual.