Skip to content

fix(telemetry): show enabled state in Settings (web+macOS) — materialize telemetry.enabled in /api/v1/config - #681

Merged
Dumbris merged 1 commit into
mainfrom
fix/mcp-2477-telemetry-serialization
Jun 15, 2026
Merged

Dumbris merged 1 commit into
mainfrom
fix/mcp-2477-telemetry-serialization

Conversation

@Dumbris

@Dumbris Dumbris commented Jun 15, 2026

Copy link
Copy Markdown
Member

Problem (MCP-2477)

On a fresh install, web UI and macOS Settings show Telemetry as DISABLED, even though telemetry is enabled-by-default and mcpproxy telemetry status correctly reports "Enabled". This is a display/serialization bug, not a config-default bug.

Root cause

  • Telemetry is opt-out: Config.IsTelemetryEnabled() returns true when Telemetry/Enabled are nil (internal/config/config.go:1716).
  • But /api/v1/config serializes the raw config (ConvertConfigToContract returns cfg as-is). Telemetry *TelemetryConfig and Enabled *bool both have omitempty, and DefaultConfig() never sets Telemetry → the telemetry key is omitted from the response on a fresh install.
  • Both clients coerce the missing bool to false: web UI SettingField.vue !!modelValue, macOS ConfigSettingsView.swift ?? false.

Fix

Materialize the resolved telemetry.enabled value at the contract/response boundary before marshaling — mirror IsTelemetryEnabled() into a copy of the config (no mutation of the shared config, no change to the Go default-true logic). One server-side fix covers both UI clients.

  • cfg.Telemetry == nil → emit telemetry.enabled = IsTelemetryEnabled() (true on fresh install)
  • cfg.Telemetry.Enabled == nil → emit resolved value (true)
  • explicit enabled: false → preserved (opt-out respected)

Tests (TDD)

Added to internal/contracts/converters_test.go — watched all fail first, then pass:

  • TestConvertConfigToContract_TelemetryMaterializedOnFreshDefault — fresh DefaultConfig() → JSON contains telemetry.enabled: true; asserts the source config is not mutated.
  • TestConvertConfigToContract_TelemetryEnabledNilMaterialized — Telemetry present, Enabled nil → true.
  • TestConvertConfigToContract_TelemetryExplicitFalsePreserved — explicit opt-out preserved.

Verification

  • go build ./... ✅
  • go test ./internal/contracts/... ./internal/config/... ./internal/httpapi/... -race ✅
  • golangci-lint run --config .github/.golangci.yml ./internal/contracts/... → 0 issues ✅

Acceptance

  • Fresh-install /api/v1/config → telemetry.enabled: true
  • Web UI + macOS Settings show Telemetry enabled without any config change (server-side fix)
  • mcpproxy telemetry status unchanged (Go logic untouched)
  • go build ./... && go test ./internal/...

Related #MCP-2477

Telemetry is opt-out (default enabled), but DefaultConfig leaves the
Telemetry field nil and Enabled is a pointer with omitempty. On a fresh
install the /api/v1/config response omitted the telemetry key entirely,
so the web UI (SettingField !!modelValue) and macOS (?? false) coerced
the missing bool to false and displayed telemetry as DISABLED — even
though Config.IsTelemetryEnabled() and the CLI correctly reported it
enabled.

Fix at the contract/response boundary: mirror IsTelemetryEnabled() into
a copy of the config before marshaling so telemetry.enabled is always
present, without mutating the shared config or changing the Go
default-true logic. One server-side fix covers both UI clients.

Related #MCP-2477
@cloudflare-workers-and-pages

Copy link
Copy Markdown

@codecov-commenter

Copy link
Copy Markdown

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

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/mcp-2477-telemetry-serialization

Available Artifacts

  • archive-darwin-amd64 (28 MB)
  • archive-darwin-arm64 (25 MB)
  • archive-linux-amd64 (16 MB)
  • archive-linux-arm64 (14 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (25 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (21 MB)
  • installer-dmg-darwin-arm64 (19 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 27542136102 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@mcpproxy-gatekeeper mcpproxy-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codex ACCEPT (gpt-5.5, in-checkout): ConvertConfigToContract materializes resolved telemetry.enabled (true when nil) without mutating source; explicit false preserved; Go default-true logic unchanged. Fixes the false 'disabled' display.

@Dumbris
Dumbris merged commit 38036ea into main Jun 15, 2026
36 checks passed
Dumbris added a commit that referenced this pull request Jun 15, 2026
Conflict from #685 (instructions prefill) + #681 (telemetry serialization)
landing on main while this branch was in review. Resolved Settings.vue:
- imports: union of watch (prefill) + nextTick/useRoute (banner focus deep-link)
- onMounted: keep #685's watch(defaultInstructions) prefill trigger, use this
  branch's async onMounted for the focus query-param handling, drop the
  duplicate loadConfig() (body already awaits loadConfig()).

Verified: 14 settings unit tests pass (instructions-prefill + prefill-dirty).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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