fix(converters): preserve Codex config on no-MCP install#564
fix(converters): preserve Codex config on no-MCP install#564tmchow merged 2 commits intoEveryInc:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb324af13e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!mcpToml) { | ||
| if (!existingContent) return null | ||
| return removedManagedBlock ? stripped.trimEnd() : existingContent | ||
| } |
There was a problem hiding this comment.
Keep stripping bounded legacy marker on no-MCP installs
The new !mcpToml early return skips legacy cleanup entirely, so configs in the older # MCP servers synced from Claude Code format now retain stale [mcp_servers.*] entries when the plugin is reinstalled with no MCP servers. This regresses cleanup behavior for that migration path and can leave obsolete server commands active. Since this marker is already treated as a boundary for plugin-owned content in this function, the no-MCP branch should still trim from this marker while only preserving the unbounded # Generated by compound-plugin case.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed. The no-MCP path now still strips the bounded # MCP servers synced from Claude Code legacy block, while preserving byte-for-byte content for the unbounded # Generated by compound-plugin marker. Added regression coverage in tests/codex-writer.test.ts and reran bun test tests/codex-writer.test.ts.
When a Codex install has no MCP servers to write,
mergeCodexConfigstill treated legacy unmarked# Generated by compound-plugincontent as plugin-owned and stripped everything after it. Existing Codex configs can contain user settings after that marker, so a no-MCP reinstall could collapseconfig.tomland lose settings.This makes no-MCP installs remove only bounded managed blocks. If there is no bounded block to remove, the existing config is returned byte-for-byte unchanged.
Verification
bun test tests/codex-writer.test.ts