Skip to content

fix(mcp): distinguish saved configuration from connection failures - #2854

Merged
wgqqqqq merged 1 commit into
GCWing:mainfrom
wgqqqqq:wgq/fix-mcp-save-offline
Sep 7, 2026
Merged

wgqqqqq merged 1 commit into
GCWing:mainfrom
wgqqqqq:wgq/fix-mcp-save-offline

Conversation

@wgqqqqq

@wgqqqqq wgqqqqq commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

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.

  • Recognize the existing explicit acknowledgement that persistence succeeded but runtime application failed.
  • After a request timeout, read the configuration back and confirm persistence only when the JSON contents match. Do not replay the write. Bind confirmation to the original device surface to prevent checking another device after a switch.
  • Preserve drafts on write failures, configuration conflicts, or unconfirmed save outcomes.
  • Continue refreshing failed auto-start services so the UI reflects recovery.
  • Update English, Simplified Chinese, and Traditional Chinese messages.

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 to app.json and 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, matching OPENBITFUN_USER_ROOT / OPENBITFUN_E2E_USER_ROOT and OPENBITFUN_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

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@wgqqqqq wgqqqqq changed the title fix(mcp): 修复连接失败或超时时误报配置保存失败 fix(mcp): distinguish saved configuration from connection failures Sep 7, 2026
@wgqqqqq
wgqqqqq merged commit 5e51bc0 into GCWing:main Sep 7, 2026
13 checks passed
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.

1 participant