Skip to content

fix(tray): stop the permanent red badge, and shrink it to a corner dot - #1075

Merged
Dumbris merged 4 commits into
mainfrom
claude/mcpproxy-red-dot-debug-1dcd87
Aug 28, 2026
Merged

Dumbris merged 4 commits into
mainfrom
claude/mcpproxy-red-dot-debug-1dcd87

Conversation

@Dumbris

@Dumbris Dumbris commented Aug 28, 2026

Copy link
Copy Markdown
Member

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 / 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".

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 from worstDiagnosticSeverity), off one payload. 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 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's attributedTitle, 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 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 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 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 — for a config typo the user can fix in one line.

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.

4. 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 — measured at ~110 ERROR lines/min during startup and ~14/min at steady state, rotating main.log every couple of hours.

The two inner layers drop to Debug. The manager keeps its line at Warn: it deliberately skips markSwept so the next sweep retries, and a failure the code already plans to retry is not an error.

Testing

  • I have tested these changes locally
  • I have added/updated tests that prove my fix is effective or my feature works
  • All existing tests pass

Verified against a live isolated instance (MCPPROXY_HOME=/tmp/mcpproxy-dot, port 18477) seeded with both fixtures — a misconfigured npx server and an unreachable quarantined server:

  • Tooltip read "1 server error" with two error-severity diagnostics present — the quarantined one correctly excluded.
  • Status item title: "", width unchanged at 36pt — the badge no longer widens the menu bar.
  • The menu still opens through the dot overlay (hit-test passthrough works).
  • The broken server reported "This server's command has nothing to run — a package runner like npx or uvx needs the package name in args" instead of "file a bug report".

Automated:

  • go build ./... clean; golangci-lint run --config .github/.golangci.yml ./... → 0 issues.
  • Go tests pass across internal/diagnostics, internal/upstream/..., internal/telemetry.
  • Swift: 1127 tests, 1 failure — AppLifecycleTests.testTheSharedJournalNeverWritesToTheRealInstanceRootUnderTests, which asserts ~/.mcpproxy/tray-lifecycle.jsonl does not exist and fails on any machine with a running tray. Pre-existing and environmental, unrelated to this change.

New tests:

  • Swift badge exemption, built from the verbatim /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; both codes are registered in the catalog.
  • Go: one ListTools failure is reported by exactly one layer, not at ERROR, and is still reported at all.

Notes for the reviewer

  • The corner dot has not been seen by a human. Screen Recording is not granted in the session that built this, so it was verified by offscreen pixel rendering and by the status item's reported title/width rather than by eye. Worth one look after rebuilding the tray.
  • ./scripts/test-api-e2e.sh was 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.
  • New docs pages are indexed in both docs/errors/README.md and website/sidebars.js — the file allowlist is a glob, but the sidebar is manual.

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.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

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

View logs

@codecov-commenter

codecov-commenter commented Aug 28, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/upstream/core/client.go 0.00% 1 Missing ⚠️
internal/upstream/managed/client.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: claude/mcpproxy-red-dot-debug-1dcd87

Available Artifacts

  • archive-darwin-amd64 (29 MB)
  • archive-darwin-arm64 (26 MB)
  • archive-linux-amd64 (17 MB)
  • archive-linux-arm64 (15 MB)
  • archive-windows-amd64 (29 MB)
  • archive-windows-arm64 (26 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (23 MB)
  • installer-dmg-darwin-arm64 (21 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 33146415833 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

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.
@Dumbris

Dumbris commented Aug 28, 2026

Copy link
Copy Markdown
Member Author

Cross-model review + multi-agent verification — findings and fixes

Reviewed 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 5e773a98a and a17e09c4c.

The important one: NSStatusBarButton is FLIPPED

Verified by compiling against real AppKit rather than reasoning about it:

NSView().isFlipped          = false
NSButton().isFlipped        = true
NSStatusBarButton.isFlipped = true

So 9c740c0d4 — the first commit on this branch — shipped the badge in the icon's top-right corner, not the bottom-right its comment and commit message both claimed. In a flipped button y = 2 is 2pt from the top, and .maxYMargin pins to the top. Rendered inside a real 36×22 status button, the dot landed at bitmap rows 4–15 of 44 (top-first).

5e773a98a had already corrected it, but incidentally — 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.

Notably, the cross-model review did not catch this — I gave it the wrong premise (I told it the button was non-flipped). It correctly reasoned from what it was given. The multi-agent sweep caught it by compiling a probe instead of trusting either of us.

Fixed: isFlipped is now overridden to false explicitly and documented as load-bearing; the misleading comments are corrected with the trap written down; and TrayBadgeInStatusButtonTests renders the overlay inside a real NSStatusBarButton. 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.

Anchor and stale-bounds (from the cross-model review, fixed in 5e773a98a)

The 6×6 subview pinned with [.minXMargin, .maxYMargin] anchored to the button's corner, but the dot belongs to the centred icon — when the button shrinks by N the dot moves left by N while the icon's right edge moves left by only N/2. Compounded by NSStatusItem resizing asynchronously, so button.bounds read right after clearing attributedTitle was still the old, wider value.

The overlay now fills the button and derives the dot inside draw(_:) from live bounds, which removes both failure modes rather than patching either.

MCPX_HTTP_LEGACY_SSE matches a string we don't own

The classifier comment, the test file and this PR's description all called it "mcpproxy's own error message". It isn't — it's mcp-go's exported transport.ErrLegacySSEServer. A routine dependency bump rewording it would silently regress the code to MCPX_HTTP_404 with the whole suite green.

Corrected the attribution, added errors.Is as the primary check (the substring fallback stays, since the upstream layer stringifies the error and breaks the errors.Is chain), and added TestLegacySSESentinelStillMatches to pin the vendored wording so the bump fails a test instead of degrading in the field.

Smaller consistency gaps

  • 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 exactly 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 aren't: 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 from quarantine.

Checked and cleared — not worth re-spending on

  • No severity escalation from the new codes: MCPX_UNKNOWN_UNCLASSIFIED was already SeverityError, so badge colour is unchanged.
  • Docs build is safe; all five cross-links in the new pages resolve and each target is already in sidebars.js. (Correction to the PR body above: website/prepare-docs.sh is a blanket copy — there is no allowlist at all.)
  • No cross-platform gap: the severity badge is Swift-only; internal/tray has no badge concept.
  • The has no args rule has exactly one non-test producer in the tree, so no false-positive surface.

Known, deliberately out of scope

frontend/src/views/ServerDetail.vue renders the error diagnostic panel for a quarantined server with no exemption — the same one-payload contradiction, on a surface this PR doesn't touch. There's no aggregate error badge in the frontend, so there's no red-dot equivalent, but it's worth its own issue.

Verification

go build ./... clean · golangci-lint (CI v2 config) 0 issues · Go tests pass · Swift 1136 tests, 1 failure — AppLifecycleTests.testTheSharedJournalNeverWritesToTheRealInstanceRootUnderTests, which asserts ~/.mcpproxy/tray-lifecycle.jsonl doesn't exist and fails on any machine with a running tray. Pre-existing and environmental.

The corner dot still has not been seen by a human — Screen Recording isn't granted in this session — but it is now rendered and measured inside a real status button by the test suite, which is stronger than a one-off screenshot.

…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.
@Dumbris
Dumbris merged commit c1de0d0 into main Aug 28, 2026
38 checks passed
@Dumbris
Dumbris deleted the claude/mcpproxy-red-dot-debug-1dcd87 branch August 28, 2026 06:42
Dumbris added a commit that referenced this pull request Aug 28, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants