[hooks] add non-streaming (non-stdin style) shell-only PreToolUse support#15211
Merged
eternal-openai merged 9 commits intomainfrom Mar 23, 2026
Merged
[hooks] add non-streaming (non-stdin style) shell-only PreToolUse support#15211eternal-openai merged 9 commits intomainfrom
eternal-openai merged 9 commits intomainfrom
Conversation
eternal-openai
added a commit
that referenced
this pull request
Mar 19, 2026
8d3bef5 to
566a173
Compare
eternal-openai
added a commit
that referenced
this pull request
Mar 19, 2026
314bdc8 to
78b6865
Compare
This was referenced Mar 21, 2026
eternal-openai
added a commit
that referenced
this pull request
Mar 23, 2026
pakrym-oai
reviewed
Mar 23, 2026
| .await | ||
| { | ||
| return Err(FunctionCallError::RespondToModel(format!( | ||
| "Bash command blocked by hook: {reason}. Command: {command}" |
Collaborator
There was a problem hiding this comment.
Is this message too specific (bash)?
pakrym-oai
reviewed
Mar 23, 2026
| cmd: String, | ||
| } | ||
|
|
||
| fn pre_tool_use_command(tool_name: &str, payload: &ToolPayload) -> Option<String> { |
Collaborator
There was a problem hiding this comment.
I quite dislike this hardcoding and arg re-parsing here.
Collaborator
There was a problem hiding this comment.
What do you think about individual tool handlers invoking hooks?
pakrym-oai
reviewed
Mar 23, 2026
| .features | ||
| .disable(Feature::GhostCommit) | ||
| .expect("test config should allow feature update"); | ||
| config.permissions.approval_policy = Constrained::allow_any(AskForApproval::Never); |
pakrym-oai
reviewed
Mar 23, 2026
| } | ||
| }; | ||
|
|
||
| for group in parsed.hooks.pre_tool_use { |
Collaborator
There was a problem hiding this comment.
nit: is this loop just being repeated per hook type is there a way to make it into a method?
pakrym-oai
approved these changes
Mar 23, 2026
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.
PreToolUsehook for bash-like tool execution only at firstexample run: