fix: remove duplicate BEFORE_TOOL/AFTER_TOOL hook firing in legacy async path - #3456
fix: remove duplicate BEFORE_TOOL/AFTER_TOOL hook firing in legacy async path#3456praisonai-triage-agent[bot] wants to merge 1 commit into
Conversation
β¦ync path (fixes #3455) The legacy async tool loop in _achat_completion fired BEFORE_TOOL/AFTER_TOOL inline and then again inside execute_tool_async, double-firing hooks when registered and building hook inputs (os.getcwd/time.time) with no consumer when none are. Rely on the single guarded dispatch in execute_tool_async, which already handles blocking, arg mutation and after-context aggregation. Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
|
@coderabbitai review |
|
/review |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more β On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
β Action performedReview finished.
|
|
No actionable comments were generated in the recent review. π βΉοΈ Recent review infoβοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: π Files selected for processing (1)
π WalkthroughWalkthroughThe legacy async tool-call path in ChangesAsync tool hook execution
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: π₯ Pre-merge checks | β 5β Passed checks (5 passed)
β¨ Finishing Touchesπ Generate docstrings
π§ͺ Generate unit tests (beta)
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. Comment |
Greptile SummaryRemoves duplicate inline tool-hook dispatch from the legacy asynchronous chat loop.
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The legacy asynchronous loop now relies on the existing guarded tool executor, which preserves hook blocking, argument mutation, failure isolation, and after-hook context handling without firing hooks twice.
|
| Filename | Overview |
|---|---|
| src/praisonai-agents/praisonaiagents/agent/chat_mixin.py | Removes redundant hook dispatch while retaining the established asynchronous tool-execution pipeline. |
Reviews (1): Last reviewed commit: "fix: remove duplicate BEFORE_TOOL/AFTER_..." | Re-trigger Greptile
|
@claude You are the FINAL architecture reviewer. If the branch is under MervinPraison/PraisonAI (not a fork), you are able to make modifications to this branch and push directly. SCOPE: Focus ONLY on Python packages (praisonaiagents, praisonai). Do NOT modify praisonai-rust or praisonai-ts. Read ALL comments above from Gemini, Qodo, CodeRabbit, and Copilot carefully before responding. Phase 1: Review per AGENTS.md
Phase 2: FIX Valid Issues Phase 3: Final Verdict |
|
Claude finished @MervinPraison's task ββ View job Final Architecture Review β PR #3456 β Approved
Phase 1 β Architecture review (per AGENTS.md)
Phase 2 β Capability parity verificationI traced the sole remaining dispatch (
The old inline Phase 3 β Tests82 passed, 0 failed. (3 unrelated collection errors elsewhere in the suite are pre-existing β missing VerdictApprove. The change eliminates real double-firing of Files modified by me: none β the PR is correct as-is. Job run Β· Branch |
Fixes #3455
Summary
The legacy async tool loop in
_achat_completion(chat_mixin.py) fired theBEFORE_TOOLandAFTER_TOOLhooks inline, then calledexecute_tool_async, which also fires the same two hooks (guarded). This double-fired hooks when registered and, when none were registered, builtBeforeToolInput/AfterToolInput(twoos.getcwd()syscalls + twostr(time.time())) per tool call for no consumer.Change
Removed the redundant inline
BEFORE_TOOL/AFTER_TOOLblocks (chat_mixin.py:3752-3801) and rely on the single already-guarded dispatch insideexecute_tool_async(execution_mixin.py:1254/:1279), which the loop already calls.Capability preserved
BEFORE_TOOL/AFTER_TOOLfire once viaexecute_tool_asyncwith identical inputs.modified_inputargument mutation andAFTER_TOOLadditional_contextaggregation preserved.execute_tool_async).Net:
1 file changed, 4 insertions(+), 47 deletions(-).Validation
tests/unit/agent/test_achat_unified_dispatch.pyβ 5 passedtest_hooks,test_before_tool_definitions,test_hook_bridge, etc.) β 29 passedGenerated with Claude Code
Summary by CodeRabbit