fix(codex): stop writing .codex/config.toml — hooks are on by default#1760
fix(codex): stop writing .codex/config.toml — hooks are on by default#1760gtrrz-victor wants to merge 4 commits into
Conversation
Codex enables hooks by default since codex-cli 0.124.0 (openai/codex#19012); the feature flag only exists as an opt-out now. Writing the flag to a project-local .codex/config.toml was not just unnecessary — inside Codex's reserved <CODEX_HOME>/agents tree the TOML file gets picked up by the agent-role scanner and rejected at every startup as a malformed agent role definition (#842). Drop the flag write entirely and self-heal: a stale .codex/config.toml containing only the feature-flag content older entire versions wrote is removed on the next enable. Detection is line-anchored so a file carrying any user content is left byte-identical. Fixes #842 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Entire-Checkpoint: 01KXJFTYXV9F4EN483F10H8H77
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit bf89a54. Configure here.
There was a problem hiding this comment.
Pull request overview
This PR updates the Codex agent hook installer to stop writing a project-local .codex/config.toml (the hooks feature flag is obsolete because Codex hooks are enabled by default), and adds a self-heal path to remove stale Entire-managed config files that can trigger Codex warnings when repos live under <CODEX_HOME>/agents.
Changes:
- Remove the feature-flag write path for
.codex/config.tomlduringentire enable --agent codex. - Add conservative cleanup that deletes
.codex/config.tomlonly when it contains exclusively the legacy Entire-managed[features]+ feature flag lines. - Update/add regression tests to assert “no config.toml is created” and to cover stale-file cleanup and user-config preservation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/entire/cli/agent/codex/hooks.go | Stops writing .codex/config.toml and adds stale-config cleanup logic keyed to exact managed lines. |
| cmd/entire/cli/agent/codex/hooks_test.go | Updates assertions and adds tests for stale-file cleanup on fresh install and re-enable, while preserving user-authored configs. |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Entire-Checkpoint: 01KXJGB1E6VHX5C88MDB70KSG0
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Entire-Checkpoint: 01KXJGEY2ZZRE25AK3J4HEF1DV
The CLI no longer manages .codex/config.toml at all. A flag-only leftover from an older entire version is harmless outside <CODEX_HOME>/agents and must be removed manually inside it (documented in README and #842). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Entire-Checkpoint: 01KXJH2786VR1NMASSNH42MDWG

Summary
entire enable --agent codexno longer writes or touches.codex/config.tomlat all. The file only existed to set the hooks feature flag from when Codex hooks were experimental — hooks have been enabled by default since codex-cli 0.124.0 (Mark codex_hooks stable openai/codex#19012; the flag was renamed tohooksin 0.129.0 and now only exists as an opt-out). Not writing the file fixes entire enable --agent codex can create .codex/config.toml under ~/.codex/agents and trigger Codex warning #842 at the root: no TOML file is ever created inside Codex's reserved<CODEX_HOME>/agentstree, so Codex's agent-role scanner has nothing to reject..codex/config.tomlwritten by an older entire version is harmless outside the reserved tree (the flag is a no-op) and must be removed manually inside it; the README documents this one-timerm.hooks.jsonkeeps installing at the normal project-local path, unchanged.This supersedes #1729 (scoped the flag into the global config under
[projects."<repoRoot>".features]with locking and TOML-escaping — all unnecessary since the flag itself is obsolete, and its absolute-path scoping wouldn't survive a clone or move).Verification
rust-v0.124.0is the first codex release containing openai/codex@23afa173 ("Mark codex_hooks stable",default_enabled: true). Versions older than 0.124.0 only knew thecodex_hookskey, so thehooks = trueline main wrote was never recognized by them anyway — dropping the write loses nothing on any version.hooks.json, no flag anywhere: verified live oncodex-cli 0.144.4in an isolated tempCODEX_HOME—codex execloggedhook: SessionStart … Completedand the hook's marker file was created.CODEX_HOME, real~/.codexnever written): repo under<CODEX_HOME>/agentswith a leftover flag config.toml reproduces themalformed agent role definitionwarning; afterentire enablefrom this branch (installs onlyhooks.json) and removing the leftover, the warning is gone.Tests pin: fresh install creates
hooks.jsonand no.codex/config.toml; an existing.codex/config.toml(user file or old-entire leftover) is left byte-identical.mise run fmtcleangolangci-lint run— 0 issuesmise run test:ciFixes #842
🤖 Generated with Claude Code