Repository navigation
Fix tool callback propagation in Response.reply() - #1836
0d00ciallo0721 wants to merge 1 commit into
Conversation
Muguett-DBY
left a comment
There was a problem hiding this comment.
I compared this head with the base using offline recording models. In both sync and async replies, the base executes a tool rejected by before_call; this branch cancels it, runs the allowed tool, and retains both callbacks for the next reply.
I also checked a few other paths: a failing before hook stops execution, a failing after hook propagates after the tool runs, and an unknown tool reaches before_call with tool=None and can be cancelled. A sync reply with explicitly supplied tool_results skips auto-execution and keeps the callbacks for the next response.
For the async cases I passed tools explicitly to prompt, keeping the separate conversation-tool inheritance issue in #1834 out of this check. These were the exact model and message sources loaded in memory with a stubbed HTTP client and unused utility helpers; I didn't run a provider integration or the full suite. Codex assisted with the checks.
Problem
Response.reply()automatically executes pending tool calls, but the sync and async paths omit the response's configuredbefore_callandafter_callhooks. The returned response also drops them, so later reply rounds do not apply them.Changes
Fixes #1835.
Local validation
python -m pytest -q: 1,309 passed.before_call; it passes with this change.Remote checks
TestandRun Cog:action_required, both with zero jobs; no remote test steps have run yet.AI assistance
OpenAI Codex assisted with investigation, implementation, and testing. No live model API calls were needed for the reproduction.