feat(codex): Add first-class Codex support#79
Conversation
Co-Authored-By: GPT-5.6 Sol <codex@openai.com>
Co-Authored-By: GPT-5.6 Sol <codex@openai.com>
Co-Authored-By: GPT-5.6 Sol <codex@openai.com>
55d847c to
14bf9eb
Compare
Co-Authored-By: GPT-5.6 Sol <codex@openai.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
JordanCoin
left a comment
There was a problem hiding this comment.
Impressive work — this got a deep review, including hands-on verification of the risky parts. The idempotency and config-preservation claims hold up: TOML comments and unrelated tables in .codex/config.toml survive, unknown JSON keys and user hooks are preserved, a second run is a byte-identical no-op, and a codemap MCP entry codemap didn't write is refused rather than clobbered. Hook trust stays read-only (nothing auto-trusts), the process-probe code is bounded and defensive, and pelletier/go-toml/v2 is a good pinned choice. The codemap mcp/codemap-mcp parity test is a nice touch. CI is green.
Requesting changes on four points before merge:
-
Bug: silent integer corruption in
~/.claude.json.ensureClaudeMCPWithExecutable(cmd/setup.go) round-trips the whole file throughmap[string]any, so integers > 2^53 get float64-mangled — reproduced locally:"bigInt": 9007199254740993becomes9007199254740992aftersetup --global. That's Claude Code's monolithic state file. Please usejson.Decoder.UseNumber()(same pattern applies to the hooks/marketplace writers), and write via temp-file + rename so a crash can't truncate the file — the whole-file rewrite is currently non-atomic and can race a running Claude Code session. -
Default behavior change for every user. Plain
codemap setup(default--agent both) now writes.codex/hooks.json,.codex/config.toml, and — notably — a machine-specific absolute path into project.mcp.json, which is conventionally a committed, shared file. Teammates who pull that get broken entries pointing at someone else's filesystem. Suggest defaulting to detected agents (doctor already knows how to detect them) and/or warning when an absolute path is about to land in a committed file. -
Test coverage doesn't match the change. Roughly ~860 lines of new branching logic —
RunDoctor,validateCodexHookTrust, the TOML surgery (replaceCodexMCPCommand,tomlCommentIndex),migrateOwnedHookCommand, and the session-lease code — have no unit tests. The tricky parts here (line-surgery on user config, stale-lock reclaim) are exactly where regressions will hide; they deserve coverage matching their subtlety. -
Consider splitting the MCP entrypoint unification (
cmd/mcp.go, themcp/main.goRuntimeOptions work,internal/buildinfo+ goreleaser ldflags,mcp_entrypoints_test.go, launcher-script deletion) into its own PR — it's independently mergeable, and slicing it out would make the Codex-specific remainder much easier to re-review.
One observation for the docs rather than a change request: codemap doctor executes binaries at absolute paths recorded in project-local config (.codex/config.toml / .mcp.json), so running doctor inside an untrusted repo runs a repo-chosen path. The args-shape and absolute-path checks bound this well, but it's worth a note in the doctor docs.
(FYI: the scanner/TestFindBundledAstGrepBinaryPrefersSiblingAstGrep failure you may see in full-suite local runs is a pre-existing timeout flake unrelated to this PR.)
Happy to see this land — the direction is right and the config-handling care really shows.
What does this PR do?
PATH.--no-mcpwhen the Codex plugin owns MCP.codemap mcpandcodemap-mcpoption parsing and server behavior.Type of change
Checklist
go build && ./codemap .Additional notes
Codemap was Claude-first. Codex integrations could fail because of restricted host
PATHs, stale project overrides, untrusted hooks, and unclear plugin upgrades. This change lets both agents operate independently or together without overwriting existing configuration.The final MCP commit routes both executable entrypoints through the same runtime-option parser and server constructor. A black-box parity test compares option errors, tool discovery, status guidance, and file-search responses.
Formatting, modules, vet, staticcheck, focused and race tests, debug smoke,
entrypoint parity, repeated plugin/setup, and CLI-less doctor validation pass.
Reviewer setup:
To test the live MCP integration, run Codex against the generated project, trust the hooks from
/hooksin CLI or Settings > Hooks in Desktop, and start a new task. The generated project configuration already points to the exact debug binary.Developed with carefully directed, manually reviewed AI assistance.
Allow edits by maintainersis enabled, so maintainers are welcome to fix wording or make minor cleanup directly; broader review feedback will be incorporated.Co-Authored-By: GPT-5.6 Sol codex@openai.com