codex - 💡(How to fix) Fix Duplicate Hooks

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

I queried Codex’s hooks/list RPC directly:

  - For one cwd, Codex returns 5 preToolUse hooks from ~/.codex/hooks.json.
  - For two cwds, Codex returns two entries, each with the same 5 global user hooks.
  - If the UI flattens those per-cwd results, it shows 10 rows: 1-5 repeated as 6-10.

  So the duplicate list is effectively:

  cwd A: ~/.codex/hooks.json preToolUse 0..4
  cwd B: ~/.codex/hooks.json preToolUse 0..4

  The source path and keys are identical in both copies, for example:

  ~/.codex/hooks.json:pre_tool_use:0:0
  ~/.codex/hooks.json:pre_tool_use:1:0
  ~/.codex/hooks.json:pre_tool_use:2:0
  ...

  So expected runtime config is still 5 PreToolUse hooks per cwd, not 10. The 10-row view looks like a Codex TUI/app listing bug or UX issue: it is showing global user hooks once per cwd instead of grouping or deduping them
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.135.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.5

What platform is your computer?

Darwin 24.6.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Ghostty

Codex doctor report

I queried Codex’s hooks/list RPC directly:

  - For one cwd, Codex returns 5 preToolUse hooks from ~/.codex/hooks.json.
  - For two cwds, Codex returns two entries, each with the same 5 global user hooks.
  - If the UI flattens those per-cwd results, it shows 10 rows: 1-5 repeated as 6-10.

  So the duplicate list is effectively:

  cwd A: ~/.codex/hooks.json preToolUse 0..4
  cwd B: ~/.codex/hooks.json preToolUse 0..4

  The source path and keys are identical in both copies, for example:

  ~/.codex/hooks.json:pre_tool_use:0:0
  ~/.codex/hooks.json:pre_tool_use:1:0
  ~/.codex/hooks.json:pre_tool_use:2:0
  ...

  So expected runtime config is still 5 PreToolUse hooks per cwd, not 10. The 10-row view looks like a Codex TUI/app listing bug or UX issue: it is showing global user hooks once per cwd instead of grouping or deduping them

What issue are you seeing?

I can see duplicate hooks, like i have 5 hooks, but it shows 10 in codex cli settings. e.g. PreToolUse with 5 hooks, then 6-10 are simply duplicating 1-5.

What steps can reproduce the bug?

codex --cd "$PWD"

What is the expected behavior?

only show expected global hooks without duplication

Additional information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Duplicate Hooks