Skip to content

Add prompt-handler execution to codex-hooks - #26267

Closed
abhinav-oai wants to merge 1 commit into
mainfrom
abhinav/prompt-hooks-runtime
Closed

abhinav-oai wants to merge 1 commit into
mainfrom
abhinav/prompt-hooks-runtime

Conversation

@abhinav-oai

@abhinav-oai abhinav-oai commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR teaches codex-hooks how to execute a prompt handler once a caller supplies a model runner.

The hooks crate owns rendering the hook input, enforcing its size and timeout bounds, interpreting the model's { ok, reason } response, and mapping that response onto each hook event's existing behavior.

This PR does not enable prompt hooks from configuration. Prompt handlers continue to be skipped during discovery, and Core does not provide a model runner yet. The next PR adds those pieces.

Changes

  • Represent configured handlers as either commands or prompts.
  • Add an injectable runner for sending a rendered prompt to a model.
  • Bound prompt-hook input to 10K approximate tokens.
  • Parse the model's { ok, reason } response.
  • Translate a failed check into the appropriate block, feedback, stop, or no-op result for each supported event.
  • Pass the optional runner through the existing hook event execution paths.

Stack

  1. (this PR) Add prompt-handler execution to codex-hooks #26267
  2. Enable configured prompt hooks in Codex #24634
  3. Expose prompt hooks to clients #26268

@abhinav-oai
abhinav-oai requested a review from a team as a code owner June 3, 2026 23:51

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

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d729770058

ℹ️ 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 thread codex-rs/hooks/src/engine/prompt_runner.rs
Comment thread codex-rs/hooks/src/engine/prompt_runner.rs
Comment thread codex-rs/hooks/src/engine/prompt_runner.rs
@abhinav-oai
abhinav-oai force-pushed the abhinav/prompt-hooks-runtime branch from d729770 to d546866 Compare June 4, 2026 00:30
@abhinav-oai abhinav-oai changed the title Add prompt hook runtime Add prompt-handler execution to codex-hooks Jun 4, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 14 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this Jun 26, 2026
@abhinav-oai abhinav-oai reopened this Jul 9, 2026
@abhinav-oai abhinav-oai closed this Jul 9, 2026
@abhinav-oai abhinav-oai reopened this Jul 10, 2026
@abhinav-oai
abhinav-oai force-pushed the abhinav/prompt-hooks-runtime branch from d546866 to ced3120 Compare July 10, 2026 03:25
@abhinav-oai

Copy link
Copy Markdown
Contributor Author

Moved to the internal stack: https://github.com/openai/codex-internal/pull/1384

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