Skip to content

fix(codex): migrate from deprecated [features].codex_hooks to [features].hooks#78

Open
raysubham wants to merge 2 commits into
step-security:mainfrom
raysubham:fix/codex-hooks-deprecation
Open

fix(codex): migrate from deprecated [features].codex_hooks to [features].hooks#78
raysubham wants to merge 2 commits into
step-security:mainfrom
raysubham:fix/codex-hooks-deprecation

Conversation

@raysubham
Copy link
Copy Markdown
Contributor

Summary

  • Codex CLI now prints [features].codex_hooks is deprecated. Use [features].hooks instead. on every invocation after our hook install, because Install() writes the deprecated key. This PR switches the write to the new [features].hooks = true key so the warning goes away.
  • Pre-existing codex_hooks lines in user config.toml are intentionally left untouched — Codex still accepts both keys today, so older configs keep working without manual cleanup.
  • Internal public function names (EnsureCodexHooksFlag, CodexHooksEnabled) and the private regex var codexHooksLineRE keep their existing names to minimize churn; only the literal key string and matching pattern change.
  • Tests tightened against false positives: substring probes anchored to \nhooks = ... so a future legacy codex_hooks line cannot falsely satisfy them, and one load-bearing loose-substring check replaced with a structural TOML parse asserting features["hooks"] == true.

Reference: https://developers.openai.com/codex/config-basic#feature-flags

Test plan

  • go vet ./...
  • go build ./...
  • go test -count=1 ./internal/aiagents/configedit/... ./internal/aiagents/adapter/codex/... ./internal/aiagents/cli/...
  • Manual smoke: remove ~/.codex/config.toml, run install, confirm only [features].hooks = true is written and the Codex deprecation warning is gone on next codex invocation.
  • Manual legacy-config check: seed ~/.codex/config.toml with [features]\ncodex_hooks = true\n, run install, confirm a new hooks = true line is inserted under [features] and the original codex_hooks line is preserved.

raysubham added 2 commits May 17, 2026 01:29
Codex CLI now prints a deprecation warning on startup whenever
`[features].codex_hooks` is set; the supported key is `[features].hooks`.
Switch the codex adapter's Install() to write the new key so users
stop seeing the warning on every invocation.

Pre-existing `codex_hooks` lines in user config.toml are intentionally
left untouched — Codex still accepts both keys today, so older configs
keep working without manual cleanup.

- configedit/toml.go: regex pattern and both write paths target the
  `hooks` key. The private regex var keeps its existing name to
  minimize churn; only the matched key string changes.
- adapter/codex/adapter.go: doc comments and the user-visible Note
  string updated to reference the new key.
- Tests: substring probes anchored to `\nhooks = ...` so a future
  legacy `codex_hooks` line cannot satisfy them; one loose-substring
  location check replaced with a structural TOML parse asserting
  `features["hooks"] == true`.

Ref: https://developers.openai.com/codex/config-basic#feature-flags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant