fix(mcp): distinguish saved configuration from connection failures - #2854
Merged
Merged
Conversation
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.
Summary
Fix MCP settings reporting a failed save when the configuration was persisted but the server could not connect. The UI now warns that the configuration is saved while some services are not ready, refreshes the configuration fingerprint, and clears the saved draft. Connection status updates automatically when the service recovers.
Type and Areas
Type: Bug fix / regression coverage
Areas: Web UI MCP settings, API adapter, locales, desktop E2E
Motivation / Impact
The backend persists configuration before connecting to MCP servers. A connection failure or handshake exceeding the frontend's 30-second deadline previously left the editor showing unsaved changes, even though the configuration was already stored.
Verification
pnpm --dir src/web-ui exec vitest run src/infrastructure/api/service-api/MCPAPI.test.ts src/infrastructure/config/components/McpToolsConfig.test.tsx— 23 passed, rerun on this PR branch.pnpm run check:web— passed.pnpm run i18n:audit— passed with 0 warnings.cargo build -p openbitfun-desktop— passed with existing compiler warnings.pnpm --dir tests/e2e exec wdio run ./config/wdio.conf.ts --spec ./specs/l1-mcp-save-offline.spec.ts— 3 passed using the native macOS Tauri app and embedded WebDriver. Coverage includes a broken TCP connection with verified persistence toapp.jsonand a clean reopened editor; automatic recovery without changing the saved fingerprint, followed by another successful edit; and a 35-second handshake that exceeds the frontend deadline but still confirms persistence and restores an editable, clean draft.git diff --check— passed.Except for the unit tests explicitly rerun above, these checks ran before moving the change to the isolated PR branch. All nine submitted files are byte-for-byte identical to the verified implementation, and the relevant MCP Rust persistence and connection code matches the upstream base.
E2E uses fresh isolated user and product directories for each run, with
OPENBITFUN_E2E_STORAGE_GUARD=1, matchingOPENBITFUN_USER_ROOT/OPENBITFUN_E2E_USER_ROOTandOPENBITFUN_HOME/OPENBITFUN_E2E_HOME, and a separate WebDriver port. A local MCP server simulates disconnection and slow connections; the system network is not switched. Remote workspace, remote control, Peer Device Mode, and Detached Dispatch were not exercised end to end. Unit tests cover remote management gates and confirmation guards after device switches.Reviewer Notes
Backend wire responses and persisted configuration formats are unchanged. Existing void success responses and explicit post-persistence errors remain compatible. E2E screenshots are written to
tests/e2e/reports/screenshots/mcp-save-offline/. This change was AI-assisted and received the verification described above.Checklist