fix(mcp): delete the codex server section when the CLI cannot remove it - #1281
Draft
posthog[bot] wants to merge 1 commit into
Draft
posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
`codex mcp remove` now falls back to editing ~/.codex/config.toml directly, the mirror of the write the OAuth install path already does. A broken codex CLI left the [mcp_servers.posthog] entry in place and reported its own crash as a wizard exception. An absent server is reported as unchanged, and only a failed config.toml edit captures an exception. Generated-By: PostHog Desktop Task-Id: 6071a238-3d65-45c3-93b4-42dba485bc1e
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Test against a Context Mill branch:
Add Results will be posted here when complete. |
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.
Problem
[mcp_servers.posthog]entry stays in~/.codex/config.toml— a failed uninstall they then have to finish by hand.removeServertreated every non-zerocodex mcp removeexit as our failure. In the reported cases the codex CLI wrapper could not spawn its own vendored native binary, so the wizard captured a third-party crash as its own exception.config.tomlitself. Only the remove path insisted on the CLI, and unlike the Claude Code sibling it had no "already absent" guard.Changes
[mcp_servers.<name>]section fromconfig.tomlthrough the same atomic temp-file writewriteServerSectionuses.alreadyInstalled(surfaced as "unchanged"), so a server removed out from under us is not a failure.config.tomledit captures an exception. A CLI crash no longer does.findSectionhelper shared by the write and the delete, so both agree on where a server's body ends.config.tomlwrite failsTest plan
src/steps/add-mcp-server-to-clients/clients/__tests__/codex.test.tscovers the four cases above; the wholeadd-mcp-server-to-clientssuite passes (103 tests).pnpm lintclean on both edited files.tsc --noEmitoutput is unchanged againstmain.LLM context
Written by Claude Opus 5 (
claude-opus-5) in PostHog Desktop.config.toml. Kept the CLI first: it owns the bearer-token env wiring an API-key install writes, so letting it do the removal keeps that bookkeeping in one place. The direct edit deletes the whole section, so it covers that key too when the CLI is unavailable.Created with PostHog Desktop from this inbox report.