fix(codex): migrate from deprecated [features].codex_hooks to [features].hooks#78
Open
raysubham wants to merge 2 commits into
Open
fix(codex): migrate from deprecated [features].codex_hooks to [features].hooks#78raysubham wants to merge 2 commits into
raysubham wants to merge 2 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[features].codex_hooks is deprecated. Use [features].hooks instead.on every invocation after our hook install, becauseInstall()writes the deprecated key. This PR switches the write to the new[features].hooks = truekey so the warning goes away.codex_hookslines in userconfig.tomlare intentionally left untouched — Codex still accepts both keys today, so older configs keep working without manual cleanup.EnsureCodexHooksFlag,CodexHooksEnabled) and the private regex varcodexHooksLineREkeep their existing names to minimize churn; only the literal key string and matching pattern change.\nhooks = ...so a future legacycodex_hooksline cannot falsely satisfy them, and one load-bearing loose-substring check replaced with a structural TOML parse assertingfeatures["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/...~/.codex/config.toml, run install, confirm only[features].hooks = trueis written and the Codex deprecation warning is gone on nextcodexinvocation.~/.codex/config.tomlwith[features]\ncodex_hooks = true\n, run install, confirm a newhooks = trueline is inserted under[features]and the originalcodex_hooksline is preserved.