Support PreToolUse additionalContext#20692
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da2567023f
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
| additional_contexts, | ||
| } = hooks.run_pre_tool_use(request).await; | ||
| emit_hook_completed_events(sess, turn_context, hook_events).await; | ||
| record_additional_contexts(sess, turn_context, additional_contexts).await; |
There was a problem hiding this comment.
is this uncapped? maybe an existing/broader concern (though PreToolUse is probably a high volume hook), but allowing injection of an uncapped amount of context directly into a dev message seems like an easy way for users to unknowingly blow up their own context window
sayan-oai
left a comment
There was a problem hiding this comment.
this pr logic seems fine; discussed in slack implementing a hook-level context injection cap as a follow up.
|
merging as we got #21069 in |
Why
PreToolUsealready exposeshookSpecificOutput.additionalContextin the generated hook schema, but the runtime still rejected it as unsupported. That leavesPreToolUseout of step with the other context-injecting hooks and prevents hook authors from attaching model-visible guidance to a pending tool call before it runs.What
PreToolUse.additionalContextand carry it through the hook event pipeline.PreToolUsecontext at the hook boundary so successful context is preserved for both allowed and blocked calls without widening the tool registry surface.permissionDecision: "deny"or the legacydecision: "block"shape.