Abhinav
0d8dee9427
[codex] Avoid duplicate hooks.json discovery with profiles ( #26418 )
...
## Summary
V2 profiles add both `config.toml` and `<profile>.config.toml` to the
config stack. Because both user layers resolve hook discovery to the
same Codex home, Codex loaded the same `hooks.json` twice. This
duplicated hook rows and caused each matching command to run twice.
Deduplicate JSON hook discovery by absolute config folder within each
effective config stack. TOML hooks remain layer-specific, and multi-cwd
`hooks/list` results remain independently resolved per cwd.
## Reproduction
1. Add `config.toml` and `work.config.toml` under `$CODEX_HOME`.
2. Add one command hook to `$CODEX_HOME/hooks.json`.
3. Run Codex with `--profile work`.
4. Trigger the hook.
Before this change, one declaration creates two handlers. Afterward, it
creates one.
Fixes #25645 and addresses the single-cwd duplication in #25437 .
## Validation
- `cargo nextest run -p codex-hooks`
- `just fix -p codex-hooks`
- `just fmt`
- `just argument-comment-lint -p codex-hooks`
2026-06-11 15:25:55 -07:00
..
2026-06-08 11:39:08 +02:00
2026-06-09 12:48:04 -07:00
2026-05-26 20:59:47 -07:00
2026-05-07 15:44:17 -07:00
2026-04-28 12:35:00 -07:00
2026-06-11 09:55:53 -07:00
2026-05-07 15:44:17 -07:00
2026-06-11 13:42:09 -07:00
2026-06-11 09:23:08 -07:00
2026-05-25 09:41:12 -07:00
2026-06-11 13:42:09 -07:00
2026-05-28 14:54:39 -07:00
2026-06-10 20:42:38 -07:00
2026-06-11 18:44:18 +00:00
2026-06-03 19:08:19 -07:00
2026-05-07 15:44:17 -07:00
2026-05-08 04:07:59 +00:00
2026-06-05 14:43:44 +00:00
2026-05-05 22:22:01 -07:00
2026-06-09 22:44:16 +02:00
2026-06-11 14:17:37 -07:00
2026-06-10 23:42:15 -07:00
2026-05-07 15:44:17 -07:00
2026-05-07 15:44:17 -07:00
2026-05-07 15:44:17 -07:00
2026-06-04 09:39:20 -07:00
2026-06-10 20:42:55 -07:00
2026-06-01 21:25:42 -07:00
2026-05-26 20:59:47 -07:00
2026-05-07 15:44:17 -07:00
2026-06-11 19:28:47 +00:00
2026-06-11 21:54:52 +02:00
2026-05-07 15:44:17 -07:00
2026-06-11 18:44:18 +00:00
2026-05-28 22:08:05 -07:00
2026-06-03 13:32:55 +02:00
2026-06-11 15:10:29 -07:00
2026-06-11 19:28:47 +00:00
2026-06-11 10:34:41 -07:00
2026-06-11 18:44:18 +00:00
2026-06-05 15:41:13 -07:00
2026-06-11 19:28:47 +00:00
2026-06-11 15:09:12 -07:00
2026-06-07 17:35:33 -07:00
2026-06-07 17:35:33 -07:00
2026-06-11 21:54:52 +02:00
2026-06-04 14:16:03 -04:00
2026-06-08 14:16:32 -04:00
2026-06-11 10:07:19 +00:00
2026-05-26 15:59:25 -07:00
2026-05-07 15:44:17 -07:00
2026-06-11 18:44:18 +00:00
2026-05-28 23:09:55 -07:00
2026-06-11 18:44:18 +00:00
2026-06-11 15:25:55 -07:00
2026-06-03 19:08:19 -07:00
2026-05-07 15:44:17 -07:00
2026-06-05 09:34:36 -07:00
2026-05-07 15:44:17 -07:00
2026-06-11 14:17:37 -07:00
2026-06-11 19:28:47 +00:00
2026-06-11 13:42:09 -07:00
2026-06-04 09:53:08 -04:00
2026-06-10 20:42:38 -07:00
2026-06-05 17:36:18 -07:00
2026-06-10 20:42:55 -07:00
2026-06-09 13:08:01 -07:00
2026-06-04 09:53:08 -04:00
2026-06-10 20:42:38 -07:00
2026-05-21 16:11:59 -07:00
2026-05-25 17:26:10 -03:00
2026-06-03 13:32:55 +02:00
2026-06-11 04:11:26 +00:00
2026-05-07 15:44:17 -07:00
2026-04-22 22:24:12 -07:00
2026-05-07 15:44:17 -07:00
2026-06-09 15:49:48 -07:00
2026-06-11 04:11:26 +00:00
2026-06-09 12:14:48 +02:00
2026-06-08 14:03:37 -07:00
2026-05-26 20:59:47 -07:00
2026-05-07 15:44:17 -07:00
2026-06-05 09:38:26 -07:00
2026-05-07 15:44:17 -07:00
2026-06-11 10:34:41 -07:00
2026-06-11 04:11:26 +00:00
2026-05-07 15:44:17 -07:00
2026-05-13 21:23:19 +00:00
2026-05-07 15:44:17 -07:00
2026-06-11 19:28:47 +00:00
2026-06-10 11:22:12 -07:00
2026-06-11 12:38:04 +02:00
2026-06-11 19:28:47 +00:00
2026-05-07 15:44:17 -07:00
2026-06-11 18:44:18 +00:00
2026-05-18 21:33:05 -07:00
2026-05-06 18:10:30 +00:00
2026-06-04 16:52:10 -07:00
2026-04-24 17:49:29 -07:00
2026-06-11 19:28:47 +00:00
2026-06-11 19:28:47 +00:00
2026-04-20 22:41:54 -07:00
2026-06-08 11:39:08 +02:00
2026-06-04 09:16:03 -07:00
2026-05-26 20:59:47 -07:00