Skip to content

fix(converters): preserve Codex config on no-MCP install#564

Merged
tmchow merged 2 commits intoEveryInc:mainfrom
alexph-dev:fix/codex-config-no-mcp
Apr 15, 2026
Merged

fix(converters): preserve Codex config on no-MCP install#564
tmchow merged 2 commits intoEveryInc:mainfrom
alexph-dev:fix/codex-config-no-mcp

Conversation

@alexph-dev
Copy link
Copy Markdown
Contributor

When a Codex install has no MCP servers to write, mergeCodexConfig still treated legacy unmarked # Generated by compound-plugin content as plugin-owned and stripped everything after it. Existing Codex configs can contain user settings after that marker, so a no-MCP reinstall could collapse config.toml and 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

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/targets/codex.ts
Comment on lines +129 to +132
if (!mcpToml) {
if (!existingContent) return null
return removedManagedBlock ? stripped.trimEnd() : existingContent
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tmchow tmchow merged commit ed778e6 into EveryInc:main Apr 15, 2026
@github-actions github-actions Bot mentioned this pull request Apr 15, 2026
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.

2 participants