You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(core): call tool-level onEnd once on errors - #1539
No actionable comments were generated in the recent review.
Walkthrough
When tool execution throws, the agent no longer calls the tool-level onEnd hook in the error path. A regression test covers the throwing tool, and a Changesets entry declares a patch release for @voltagent/core.
The tool error path no longer calls the tool-level onEnd hook. The regression test checks the hook call details for a throwing tool. The Changesets entry declares a patch release.
This fix stops a tool's own onEnd hook from firing twice when a tool throws. The change is small and covered by a new regression test. The only remaining edge, a throwing agent-level end hook re-triggering the tool hook, was already there before this change.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the change: the tool-level onEnd hook is now called once on errors in @voltagent/core. The raw summary confirms the change removes a duplicate onEnd call from the tool error path. The …
Description check
The description follows the template's main parts. It has a Summary with the code change, a regression test, and a changeset. It gives a testing command and links issue #1536. It does not fill in the …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the change: the tool-level onEnd hook is now called once on errors in @voltagent/core. The raw summary confirms the change removes a duplicate onEnd call from the tool error path. The title uses the conventional commit format and a specific scope.
Full details: Description check
Explanation
The description follows the template's main parts. It has a Summary with the code change, a regression test, and a changeset. It gives a testing command and links issue #1536. It does not fill in the checklist items, the 'current behavior' and 'new behavior' sections, or the reviewer notes. The 'fixes (issue)' line reads as a placeholder, and the issue is referenced as 'With issues #1536' instead of a closing keyword.
Resolution
Optional: state the current and new behavior under the matching headings. Tick the checklist items that apply, such as tests added and changeset added. Change 'With issues #1536' to 'fixes #1536' so the issue closes on merge.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 09ca4981-43fe-413f-87ec-c58501e87d48
Commits
Reviewing files that changed from the base of the PR and between e9fc599 and c16cc2a.
Files selected for processing: 3
.changeset/fix-tool-on-end-error-hook.md
packages/core/src/agent/agent.spec.ts
packages/core/src/agent/agent.ts
Files with no reviewable changes: 1
packages/core/src/agent/agent.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
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
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
onEndinvocation in the tool execution error path@voltagent/coreTesting
pnpm --filter @voltagent/core exec vitest run src/agent/agent.spec.ts --reporter=defaultWith issues #1536
Summary by cubic
Fixes the tool-level
onEndhook being called twice when a tool execution fails in@voltagent/core.Written for commit c16cc2a. Summary will update on new commits.
Summary by CodeRabbit
onEndhooks so they are called exactly once when tool execution fails.