Skip to content

Add hook config write API#19840

Draft
abhinav-oai wants to merge 1 commit intodev/abhinav/hooks-list-configfrom
dev/abhinav/hooks-config-write
Draft

Add hook config write API#19840
abhinav-oai wants to merge 1 commit intodev/abhinav/hooks-list-configfrom
dev/abhinav/hooks-config-write

Conversation

@abhinav-oai
Copy link
Copy Markdown
Collaborator

@abhinav-oai abhinav-oai commented Apr 27, 2026

Why

After hooks/list exposes the hook inventory, clients need a follow-up control surface that can persist user choices for hooks

What

  • Adds hooks/config/write for user-level hook enablement changes.
  • Extends hooks/list entries with the current selector key and effective enabled state so clients can render toggles.
  • Persists user overrides under [[hooks.config]] and filters disabled non-managed hooks out of runtime execution.
  • Keeps managed hooks effectively enabled even when user config contains a matching disable entry.
  • Leaves the current positional selector shape in place for now, with an inline TODO to replace it with a durable hook id later.

Verification

  • Added hook-runtime coverage proving user config disables non-managed hooks but not managed hooks.
  • Added config edit coverage for writing and removing hook config entries.
  • Added an app-server integration test covering hooks/config/write and re-listing a disabled hook.

Stack

@abhinav-oai abhinav-oai requested a review from a team as a code owner April 27, 2026 17:50
@abhinav-oai abhinav-oai changed the title Add hook config write support Add hook config write API Apr 27, 2026
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1307c251a

ℹ️ 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".

Comment on lines +444 to +449
let key = format!(
"{}:{}:{}:{}",
source.key_prefix,
hook_event_key_label(event_name),
group_index,
handler_index
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use durable hook IDs instead of positional key indices

Hook keys are persisted and later used for enable/disable, but the key is derived from group_index/handler_index. Reordering or inserting hooks in the source file changes indices, so an existing [[hooks.config]] entry can target a different hook (or none) on the next load. This can silently disable/enable the wrong command after config/plugin updates.

Useful? React with 👍 / 👎.

@abhinav-oai abhinav-oai marked this pull request as draft April 27, 2026 18:11
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