Repository navigation
Enable configured prompt hooks in Codex - #24634
abhinav-oai wants to merge 1 commit into
Conversation
| FeedbackOrStop, | ||
| } | ||
|
|
||
| pub(crate) fn prompt_hook_behavior(event_name: HookEventName) -> PromptHookBehavior { |
There was a problem hiding this comment.
https://code.claude.com/docs/en/hooks#response-schema for reference
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd80c08856
ℹ️ 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".
db75d47 to
4bc4f2a
Compare
d729770 to
d546866
Compare
4bc4f2a to
627631d
Compare
|
|
||
| /// Creates a fresh streaming session that does not read or write the session's cached | ||
| /// WebSocket state. | ||
| pub(crate) fn new_isolated_session(&self) -> ModelClientSession { |
There was a problem hiding this comment.
A normal ModelClientSession checks out the main session’s cached WebSocket state and writes its latest request/response back on drop
If a hook used that path, it could replace the continuation state for the real transcript. Starting fresh here and not caching on drop keeps hook inference from disturbing the next main turn.
627631d to
c621ca2
Compare
|
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. |
d546866 to
ced3120
Compare
c621ca2 to
9d14b48
Compare
|
Moved to the internal stack: https://github.com/openai/codex-internal/pull/1279 |
Summary
This PR enables prompt hooks end to end.
It defines the prompt-hook configuration shape, discovers and trust-checks configured prompt handlers, and connects the execution layer from the first PR to Codex's model client.
After this PR, a trusted
type = "prompt"hook can run for supported events and affect the hook outcome.Configuration and discovery
Prompt hooks support:
promptmodeltimeoutstatusMessagecontinueOnBlockDiscovery validates the event, rejects empty prompts, applies defaults, includes the full definition in the trust hash, and constructs runnable prompt handlers.
Model execution
Each hook runs as a separate model request containing only the rendered hook prompt and hook input.
The request:
ModelClientSessionThe isolated session is important because a normal model session reads and replaces the main conversation's cached WebSocket continuation state. A hook request must not disturb the next normal turn.
Example
Given:
The hook can return:
Stack