Repository navigation
Conversation
Export removeDesktopConfig() and readManagedMcpState() from desktop.ts, reversing writeDesktopConfig's write: strips INFERENCE_KEYS, inferenceModels, coworkEgressAllowedHosts, and marker-managed MCP entries while preserving genuine user-added MCP entries. No-ops when nothing was connected. EPMCDME-15246 (proxy-disconnect-support), task 1/5.
Export removeVsCodeLanguageModelsConfig(), checking both stable and Insiders chatLanguageModels.json locations and filtering out the CodeMie provider entry. A missing product dir (edition not installed) is treated as nothing-to-do per location; corrupt JSON still throws. EPMCDME-15246 (proxy-disconnect-support), task 2/5.
Export removeVsCodeClaudeCodeConfig(), stripping the ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN managed entries from claudeCode.environmentVariables at both stable and Insiders settings.json, via targeted jsonc-parser edits so comments/formatting survive. Missing product dir per edition no-ops; corrupt JSONC still throws. EPMCDME-15246 (proxy-disconnect-support), task 3/5.
Rewrite disconnectTargets from its single codex-desktop-only branch to independent per-target TargetResult dispatch (Claude Desktop, VS Code Copilot Chat, VS Code Claude Code, Codex Desktop), mirroring connect-orchestrator's shape. One target throwing sets process.exitCode = 1 without blocking a sibling target's own outcome. Codex Desktop behavior is unchanged. EPMCDME-15246 (proxy-disconnect-support), task 4/5.
Add --claude-desktop, --vscode, --vscode-claude-code options to the disconnect subcommand alongside --codex-desktop, and pass all four booleans through to disconnectTargets. Updates the existing CLI wiring test's expectation to the new four-key targets object. EPMCDME-15246 (proxy-disconnect-support), task 5/5.
Fixes five blocking findings from the disconnect-support review: non-transactional config/marker writes in removeDesktopConfig now tolerate a marker-clear failure without masking a successful config strip; VS Code Copilot Chat and Claude Code disconnect connectors isolate per-location (stable/Insiders) write failures so one location's error no longer discards the other's success; disconnect-orchestrator adopts connect-orchestrator's printSummary convention; CLI-parser tests cover the three new disconnect flags; and removeDesktopConfig now detects stranded gateway keys directly on the config file as a fallback when a failed org-catalog fetch on first connect left no marker behind. Ref: EPMCDME-15246
Ref: EPMCDME-15246
…_proxy-disconnect-support # Conflicts: # src/cli/commands/proxy/connectors/vscode.ts
…_proxy-disconnect-support # Conflicts: # src/cli/commands/proxy/__tests__/connect-wiring.test.ts # src/cli/commands/proxy/__tests__/disconnect-orchestrator.test.ts # src/cli/commands/proxy/disconnect-orchestrator.ts # src/cli/commands/proxy/index.ts
removeVsCodeLanguageModelsConfig and removeVsCodeClaudeCodeConfig only wrapped the write in a per-location try/catch, so a read failure (e.g. a permission error or corrupt file) at the stable location aborted the loop before the Insiders location was even attempted, leaving its managed entries behind with no indication anything was skipped. Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Bondimm
left a comment
There was a problem hiding this comment.
- Suggest merging this PR and closing #580 with a link here. This branch contains every commit of #580 (its head descends from #580's
fdbdcab0), plus the merge withmainandb9ccc8dc(per-location read isolation in the two VS Code removals, which #580 doesn't have). CI here is green (2026-10-08,b9ccc8dc); #580 conflicts withmainand fails "Validate Commits & PR" because its title is 101 characters long. The repo squash-merges, so the PR title becomes the commit onmain: consider retitling to afeat(proxy): ...title under 100 characters (for examplefeat(proxy): add disconnect for Claude Desktop, VS Code Copilot Chat and VS Code Claude Code) and keeping aCo-authored-byline for the #580 author. - Conflict resolution checked: I redid the merge of
fdbdcab0withcbdf45e6locally. Only the four conflicted files differ from the automatic result.index.tskeepsmain's--claude-code-otlpand--scopeoptions and adds the three new flags. The orchestrator still callsremoveClaudeCodeOtlpConfig({ scope })with the same messages; the OTLP result now also goes into the summary, and a failure still sets exit code 1. All ofmain's OTLP orchestrator and wiring tests are still there. mainis now 9 commits ahead, including #609 insrc/cli/commands/proxy. Merged locally with currentmain(no conflicts):tsc --noEmitclean, eslint on the changed files clean,vitest run --project unit src/cli/commands/proxy19 files / 474 tests passed (472 on this head alone).- Checked against EPMCDME-15246:
--vscodeand--vscode-claude-coderemove only CodeMie's entries, at both the stable and Insiders locations. Other providers and env entries survive, and so do the comments insettings.json. An unparseable file is refused without changes, and a second run reports "nothing to disconnect". The summary and exit code match--codex-desktop. The Claude Desktop gaps are in the thread below. - Product question:
connect --vscode-claude-codealso writesclaudeCode.disableLoginPrompt: true, and disconnect leaves it in place. After a disconnect the extension then has neither the gateway nor a login prompt. Should disconnect remove it too? Connect doesn't record whether the user had it set before. - Feature flag: none. The new code runs only when one of the new flags is passed, and a bare
disconnectstill prints the target list. Revert: code only. The one new on-disk effect is an emptieddesktop-managed-mcp-state.json, and the old code reads that as "no marker", so a revert is safe. - #608 also changes
connectors/vscode.tsand conflicts with this PR there, so whichever merges second needs a small rebase.
What needs rechecking after the next push:
- Claude Desktop disconnect when never connected, after switching Desktop to another config, and after a connect whose MCP catalog fetch failed;
- CI on the new head.
| ); | ||
| } | ||
|
|
||
| const hasStrandedGatewayKeys = INFERENCE_KEYS.some((key) => key in existing); |
There was a problem hiding this comment.
Claude Desktop disconnect deletes provider settings CodeMie did not write
Problem: removeDesktopConfig treats the applied config as CodeMie's whenever any of inferenceProvider, inferenceGatewayBaseUrl, inferenceGatewayApiKey or inferenceGatewayAuthScheme is present, even with no marker (line 976). It then deletes all four keys plus inferenceModels and coworkEgressAllowedHosts (lines 983-987). It also edits whichever file _meta.json's appliedId points to now, not necessarily the file connect wrote. I ran removeDesktopConfig locally on temp directories:
- never connected, with the user's own gateway (
https://my-company-gateway.example.com) as the applied config: it returnedremoved: trueand deleted all inference keys, the model list and the egress hosts; inferenceProvider: "bedrock"and no marker: it deletedinferenceProviderand reported the config as removed;- connected, then the user switched Desktop to a second config in the library: the user's config was emptied to
{}and the CodeMie config was left untouched.
The missing marker causes the opposite problem too. When the MCP catalog fetch fails at connect, or the profile has no CodeMie URL, no marker is written. Disconnect then leaves all seven bundled MCP servers in the config (Notion, Linear, Box, Canva, Vercel, Netlify, Miro).
Impact: A Claude Desktop (3P) user who runs codemie proxy disconnect --claude-desktop without an active CodeMie connection, or after switching to another config, loses their own inference provider settings, and the command prints "✓ Claude Desktop disconnected". In these cases the story ACs "nothing to disconnect is handled gracefully when the app was never connected" and "removes CodeMie's managed MCP entries" are not met.
Recommendation: Consider recording what CodeMie wrote on every connect, including connects where the catalog fetch failed: the config id, the gateway URL and the MCP names it added. Disconnect would then touch only that config file, and strip the inference keys only while inferenceGatewayBaseUrl still points at the CodeMie daemon (it always binds http://127.0.0.1:<port>). With no record and no CodeMie URL in the file, it would report "nothing to disconnect". Tests for the never-connected and switched-config cases would cover this.
|
[AUTO_CLOSE_WARNING] ⏰ This pull request has had no activity for 7 days (last activity: 2026-10-13). It will be automatically closed no earlier than 2026-10-27 (UTC) (~6 more days). Any activity from anyone — a comment, a push, a review, reopening — restarts the countdown from that moment. This warning will be deleted automatically once that happens. |
Summary
main.disconnect-orchestrator.ts's two parallel target additions (claudeDesktop/vscode/vscodeClaudeCodefrom feat(proxy): add disconnect support for Claude Desktop, VS Code Copilot Chat, and VS Code Claude Code #580,claudeCodeOtlpfrom main) onto a singleDisconnectTargetsset, using theTargetResult/printSummarypattern consistently across all five targets — matching howconnect-orchestrator.tsalready handlesclaudeCodeOtlp.index.ts'sproxy disconnectcommand to expose all five target flags plus--scope.connect-wiring.test.ts,disconnect-orchestrator.test.ts) to match the merged behavior.This is a merge-conflict resolution on top of #580's branch, not new functionality — the actual target-handling logic from both sides is preserved as-is.
Test plan
npx vitest run src/cli/commands/proxy— 472/472 passednpm run typecheck— cleannpx eslinton the 4 touched files — cleanGenerated with AI
Co-Authored-By: codemie-ai codemie.ai@gmail.com