Add tool:before/tool:after internal hook events#22068
Closed
yhindy wants to merge 1 commit into
Closed
Conversation
|
This pull request has been automatically marked as stale due to inactivity. |
|
Any updates on this, would be helpful for my workflow? |
Member
|
I will be landing via #18889 |
19 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
toolwith typed contexts fortool:beforeandtool:aftertool:beforeandtool:afterfrom the central tool execution wrapper (wrapToolWithBeforeToolCallHook)event.context.abort()intool:beforedurationMs,result,error) intool:afterIssue Intent Check (#7597)
tool:before)tool:after)abort()+ hook message propagated as error)Validation
corepack pnpm exec vitest run src/hooks/internal-hooks.test.tscorepack pnpm exec vitest run --config vitest.e2e.config.ts src/agents/pi-tools.before-tool-call.e2e.test.tscorepack pnpm lintcorepack pnpm test:fastNotes
tool:exec:beforewere not added. Existing hook filtering can key offevent.context.tool === "exec".Closes #7597
Greptile Summary
This PR adds comprehensive
tool:beforeandtool:afterinternal hook events to enable real-time tool execution monitoring and guardrails. The implementation correctly emits hooks from the central tool wrapper (wrapToolWithBeforeToolCallHook), supports pre-execution abort via theabort()callback, and includes success/failure metadata in thetool:afterevent. The changes are well-tested with both unit tests for type guards and e2e tests for the full hook emission flow.Confidence Score: 5/5
tool:afterevents for audit trails.Last reviewed commit: 456e637
(2/5) Greptile learns from your feedback when you react with thumbs up/down!