Repository navigation
feat(ui): routing + schema-detail switcher in the header, and a config pipeline that can tell running from desired - #1133
Merged
Conversation
…witcher The header's `Mode: Retrieve` was read-only: a `cursor-help` pointer, a native title tooltip most people never wait out, and no way to act on what it said. It now opens a two-tab panel, mirroring the profile switcher beside it: - **Surface** — the three routing modes, each with what it costs an agent, the dedicated endpoint that always serves it, and whether picking it needs a restart. - **Schema detail** — both serialization axes (`tool_response_mode`, `direct_tool_response_mode`), with the measured deferred-mode savings (29.7% / 34.8%) and the describe_tool round trip they cost. These apply instantly. A routing-mode switch is restart-gated (/mcp binds its mode to a ServeMux pattern at startup), so the panel keeps naming the mode /mcp is really serving, says which mode the next start will adopt, points at the dedicated endpoint that already serves it, and offers to cancel. Making that honest exposed three defects underneath, all fixed here: 1. **A restart-pending change was silently destroyed by the next save.** PATCH /api/v1/config merged onto the LIVE config, which by design does not carry a restart-gated field. Switch to Direct, then change anything else, and the routing switch vanished from disk behind a success toast. The runtime now tracks the desired (on-disk) config separately; PATCH, GET /config and the docker-isolation patch all merge onto it. 2. **A restart-gated apply discarded the hot half of the same write.** Turning on deferred schemas while switching to Direct left deferred schemas off. ApplyConfig now pins the restart-gated fields to the running values and hot-applies the rest; reverting a field to what is already running no longer claims a restart. 3. **Every surface reported the configured mode as the served one.** A hand-edited config file is hot-reloaded into memory while /mcp stays bound, so /api/v1/routing, /api/v1/status and `mcpproxy status` all named a surface nobody was being served. The mode is now recorded where /mcp binds it. Also: `routing_mode` is normalized before comparison, so an apply body that merely omits the key no longer reports a restart-required change to the mode already in force. GET /api/v1/routing gains `tool_response_mode`, `direct_tool_response_mode` (resolved), `pending_routing_mode` and `restart_required`.
Review of the desired/served split found the split itself was half-applied. `desiredCfg` was written in three places, but four other paths commit config — `UpdateConfig` (registry-source CRUD, server add/remove), `SaveConfiguration` (every enable/disable/quarantine toggle) and the admission gate — and they replace or mutate the live config without it. Since PATCH and GET /api/v1/config now merge onto the desired config, a stale copy meant the next save re-persisted a document that had lost whatever those paths added. Reproduced: add a custom registry, then change any setting from the header switcher, and the registry was erased from mcp_config.json behind a success toast — registries live only in the config file, so nothing splices them back from config.db. - `setDesiredLocked` folds each commit into the desired config while keeping whatever is still waiting for a restart, and every commit path calls it. - `SaveConfiguration` rewrote the whole file from the RUNNING config, so a server toggle silently reverted a routing-mode switch the API was still reporting as pending. It now overlays the pending restart-gated values onto what it writes (marked as a self-write, so the watcher does not read them back as an external edit), leaving the in-memory stores on the running values. - `ReloadConfiguration` adopted a hand-edited restart-gated field into memory while /mcp stayed bound, so the running config named a surface nobody was served. It now pins those fields and republishes the pinned config to configsvc, so the snapshot and r.cfg cannot disagree. - The hot-field merge into ChangedFields runs on every path, not only the restart branch — cancelling a pending switch was skipping the server reload and update-check re-gate its own hot half had earned. - `mcpproxy doctor` labels its routing mode "configured" and points at `mcpproxy status` for the served one; it reads the config file, not the daemon.
Deploying mcpproxy-docs with
|
| Latest commit: |
7a7b5be
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://187e1532.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://claude-mode-switcher-deferre.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 33297266979 --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
The header's
Mode: Retrievewas read-only — acursor-helppointer, a native title tooltip most people never wait out, and no way to act on what it said. It is now a dropdown switcher, mirroring the profile switcher beside it, with two tabs each labelled by its current value so neither setting hides below the fold:/mcp/call,/mcp/all,/mcp/code), and aserving now/after restart/needs restartbadge.tool_response_mode, Spec 085;direct_tool_response_mode, Spec 102), with the measured deferred-mode savings (29.7% on the 45-tool corpus, 34.8% on 527 tools) and thedescribe_toolround trip they cost on~-marked tools. Under code-execution mode it says the retrieve axis cannot reach/mcpthere, because that surface pins itself to full schemas (Spec 085 FR-011).Does it need a restart? Routing mode yes, deferred schemas no — and the UI now says so per option instead of leaving the operator to find out.
/mcpbinds its mode to anhttp.ServeMuxpattern at startup, so a routing switch is saved and marked pending: the badge keeps naming what/mcpis really serving, the panel says which mode the next start will adopt, points out that the dedicated endpoint already serves it if you would rather repoint the client than restart, and offers Cancel — keep <mode>. Both serialization axes hot-reload with atools/list_changedto connected clients.GET /api/v1/routinggainstool_response_mode,direct_tool_response_mode(both resolved),pending_routing_modeandrestart_required.Defects this surfaced, all fixed here
Making the header honest meant the backend had to be. Five real defects, each reproduced before fixing:
PATCH /api/v1/configmerged onto the live config, which by design does not carry a restart-gated field. Switch to Direct, toggle deferred schemas, and the routing switch was gone from disk behind a success toast. The runtime now tracks the desired (on-disk) config separately, andPATCH,GET /configand the docker-isolation patch all merge onto it.ApplyConfignow pins restart-gated fields to the running values and hot-applies the rest; reverting a field to what is already running no longer claims a restart./mcpstays bound, so/api/v1/routing,/api/v1/statusandmcpproxy statusall named a surface nobody was being served. The mode is now recorded where/mcpbinds it, and the reload path pins restart-gated fields instead of adopting them.UpdateConfig,SaveConfiguration, the admission gate), so the nextPATCHre-persisted a document that had lost whatever they added. Reproduced: add a custom registry, change any setting from the switcher, and the registry was erased frommcp_config.json— registries live only in the config file, so nothing splices them back fromconfig.db.SaveConfigurationalso rewrote the whole file from the running config, reverting a pending switch on every server enable/disable.routing_modewas compared raw, so an apply body that merely omits the key reported a restart-required change to the mode already in force, then persisted"".Testing
Automated. 995 frontend unit tests (14 new in
frontend/tests/unit/mode-switcher.spec.ts);internal/runtimeincluding-race(newapply_config_pending_restart_test.goandrestart_gated_test.go, the latter pinningpinRestartGatedtoDetectConfigChangesso the two lists cannot drift);internal/httpapi,internal/config,internal/server,cmd/mcpproxy;golangci-lintv2 with.github/.golangci.ymlclean.Manual, against an isolated instance (high port, scratch
--configand--data-dir): staged Direct → deferred applied instantly while Direct stayed staged → added a registry and a server → PATCHed another setting; registry, server and the pending switch all survived → cancel cleared the pending state without a restart prompt → restart adopted Direct withschema_deferred: true→ hand-editing the file reported the edit as pending rather than active. Browser-verified in Retrieve, Direct and Code-Exec.Notes for the reviewer
desired/runningconfig split touches the config pipeline, not just the UI. That is the part worth your eyes.r.cfgnow means "what is running",desiredCfgmeans "what the file holds / the next start will use", andpinRestartGatedis the one place that separates them.api_keynow takes effect on restart rather than on the next request. That matches whatDetectConfigChangeshas always claimed for that field and what the API path already did, but it is a change. Easy to back out by droppingapi_keyfrom the pinned set — though it would then also have to leave the detector's restart-gated list, or the two disagree again.listen, because the hot half of a restart-required apply now applies immediately by design.opencode(gpt-5.6-sol) produced no output across four attempts in this environment, so it did not contribute a review.