Add /hooks browser for lifecycle hooks#19882
Merged
Merged
Conversation
Co-authored-by: Codex <noreply@openai.com>
…ry' into dev/abhinav/hooks-list-config # Conflicts: # codex-rs/app-server/src/codex_message_processor.rs
Bojun-Vvibe
added a commit
to Bojun-Vvibe/oss-contributions
that referenced
this pull request
Apr 27, 2026
…rge-after-nits, BerriAI/litellm#26636 merge-after-nits
Contributor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8edff9fec9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
abhinav-oai
added a commit
that referenced
this pull request
Apr 29, 2026
## Why We need a way to list the available hooks to expose via the TUI and App so users can view and manage their hooks ## What - Adds `hooks/list` for one or more `cwd` values that returns discovered hook metadata ## Stack 1. #19705 2. This PR - #19778 3. #19840 4. #19882 ## Review Notes The generated schema files account for most of the raw diff, these files have the core change: - `hooks/src/engine/discovery.rs` builds the inventory entries during hook discovery while leaving runtime handlers focused on execution. - `app-server/src/codex_message_processor.rs` wires `hooks/list` into the app-server flow for each requested `cwd`. - `app-server-protocol/src/protocol/v2.rs` defines the new v2 request/response payloads exposed on the wire. ### Core Changes `core/src/plugins/manager.rs` adds `plugins_for_layer_stack(...)` so `skills/list` and `hooks/list`can resolve plugin state for each requested `cwd` --------- Co-authored-by: Codex <noreply@openai.com>
abhinav-oai
added a commit
that referenced
this pull request
Apr 30, 2026
## Why After `hooks/list` exposes the hook inventory, clients need a way to persist user hook preferences, make those changes effective in already-open sessions, and distinguish user-controllable hooks from managed requirements without adding another bespoke app-server write API. ## What - Extends `hooks/list` entries with effective `enabled` state. - Persists user-level hook state under `hooks.state.<hook-id>` so the model can grow beyond a single boolean over time. - Uses the existing `config/batchWrite` path for hook state updates instead of introducing a dedicated hook write RPC. - Refreshes live session hook engines after config writes so already-open threads observe updated enablement without a restart. ## Stack 1. #19705 2. #19778 3. This PR - #19840 4. #19882 ## Reviewer Notes The generated schema files account for much of the raw diff. The core behavior is in: - `hooks/src/config_rules.rs`, which resolves per-hook user state from the config layer stack. - `hooks/src/engine/discovery.rs`, which projects effective enablement into `hooks/list` from source-derived managedness. - `config/src/hook_config.rs`, which defines the new `hooks.state` representation. - `core/src/session/mod.rs`, which rebuilds live hook state after user config reloads. --------- Co-authored-by: Codex <noreply@openai.com>
fcoury-oai
approved these changes
Apr 30, 2026
Contributor
fcoury-oai
left a comment
There was a problem hiding this comment.
Looks good. Did a quick smoke test adding PreToolUse hooks and disabling/enabling it.
Approved!
…-menu # Conflicts: # codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Why
hooks/listandhooks/config/writegive us read/write access to hooks and their state. This hooks up the TUI as a client so users can inspect and manage that state directly.What
/hooksbrowser in the TUI: an event overview with installed/active counts, followed by a per-event handler page with toggle controls and detail renderinghooks/listso the UI can label admin-managed hooks and suppress toggles for themStack
Reviewer Notes
codex-rs/tui/src/bottom_pane/hooks_browser_view.rs; most of the diff is the new view plus its snapshot coveragecodex-rs/tui/src/app/background_requests.rsandcodex-rs/tui/src/chatwidget/hooks.rsis_managedthrough hook discovery andhooks/listso managed hooks render as non-toggleablecodex-rs/tui/src/status/snapshots/churn is unrelated merge fallout from the stacked base branch's newer permission-label rendering