Skip to content

[Bug]: install-hooks rewrites Codex config.toml, destroying comments, formatting, and custom notify wrappers #666

@yoshi47

Description

@yoshi47

What broke?

git-ai install-hooks (also called automatically by the installer) rewrites ~/.codex/config.toml entirely, which:

  1. Strips all comments (inline and standalone)
  2. Reformats the entire file (reorders keys, collapses multi-line arrays)
  3. Overwrites custom notify configurations that wrap git-ai in a shell command (e.g. bash -lc)

Steps to reproduce

  1. Create ~/.codex/config.toml with comments and a shell-wrapped notify:
    notify = ["bash", "-lc", "git-ai checkpoint codex --hook-input & afplay ~/Documents/celebration.wav"]
    model = "gpt-5.4"

[features]
multi_agent = true # enable multi-agent collaboration tools
collaboration_modes = true # enable collaboration mode selection

[mcp_servers.mcp]
...

  1. Run git-ai install-hooks --dry-run=false
  2. Check ~/.codex/config.toml

Expected vs actual behavior

Expected: Only the notify field is added/updated; comments, formatting, and key order are preserved.

Actual:

  • All comments are removed
  • Key ordering changes (notify moves to bottom of root table)
  • Multi-line arrays collapsed to single line
  • Custom notify = ["bash", "-lc", "git-ai checkpoint codex --hook-input & afplay ..."] is completely replaced with notify =
    ["/path/to/git-ai", "checkpoint", "codex", "--hook-input"] because is_git_ai_codex_notify_args() only checks args[0] for a git-ai
    binary path

Diagnostics (git-ai debug)

N/A

Extra context (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions