Skip to content

Tolerate null Codex feature flags during hook activation - #325

Closed
Erik Weathers (erikdw) wants to merge 1 commit into
mainfrom
erikdw/codex-null-feature-flags
Closed

Erik Weathers (erikdw) wants to merge 1 commit into
mainfrom
erikdw/codex-null-feature-flags

Conversation

@erikdw

Copy link
Copy Markdown

Problem

bt trace update codex (bt 0.33.0) fails with:

error: Codex plugin installed, but hook activation failed

Hook activation calls Codex's config/read, which reports every feature flag. Codex leaves some unset flags as null. With Codex 0.171 and 0.172 it returns "network_proxy": null even when the user's config never sets it. Config.features was a BTreeMap<String, bool>, so that one null failed to decode the whole response. The real cause (invalid type: null, expected a boolean) is hidden behind the outer context message.

Fix

Decode only the two flags setup reads, hooks and codex_hooks, as Option<bool>. Other flags are ignored. null and an absent flag both mean Codex's default, matching how an absent flag was already treated. Only an explicit false disables hooks.

This follows the repo rule to model known config fields with concrete types rather than serde_json::Value.

Testing

  • New unit test config_read_tolerates_null_feature_flags covers a null unrelated flag, null hook flags, a non-bool unrelated flag, explicit false on each hook flag, and a missing features object. It fails on main with invalid type: null, expected a boolean.
  • cargo test --all-features --lib codex_hooks, cargo fmt --check, and cargo clippy --all-features --all-targets -D warnings pass locally.
  • Built bt v0.33.0 against this branch through a Cargo [patch]. bt trace update codex now succeeds against a real Codex 0.172.0 that returns network_proxy: null. The released 0.33.0 fails on the same machine.

Follow-ups (not in this PR)

  • activate() reports only the outer context, so every activation failure looks the same. Printing the full error chain would have made this a one-step diagnosis.
  • Codex CLI 0.140.0 rejects --no-daemon. Activation fails on older CLIs with the same opaque message, so a version check or a clearer error would help.

🤖 Generated with Claude Code

Codex's config/read reports every feature flag, and leaves some unset
flags as null (for example network_proxy). Setup decoded the whole map as
bool, so one null failed the response and `bt trace update codex` reported
"Codex plugin installed, but hook activation failed".

Decode only the two flags setup reads, as Option<bool>. Null and absent
both mean Codex's default; only an explicit false disables hooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AbhiPrasad

Abhijeet Prasad (AbhiPrasad) commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

thanks for the pr Erik Weathers (@erikdw) - I fixed this with #339

Will release asap

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.

2 participants