fix: #6481 - Add async support for before/after_kickoff_callbacks in akickoff - #6697
fix: #6481 - Add async support for before/after_kickoff_callbacks in akickoff#6697Diwak4r wants to merge 2 commits into
Conversation
…_original_tool_calling for consistent error handling
…th proper awaiting of async callables and async prepare_kickoff for before_kickoff_callbacks
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthrough
ChangesAsync kickoff callbacks
Tool argument errors
Sequence Diagram(s)sequenceDiagram
participant CrewAkickoff as Crew.akickoff
participant AsyncPreparation as aprepare_kickoff
participant TaskExecution as Task.aexecute_sync
participant AfterCallback as after_kickoff_callback
CrewAkickoff->>AsyncPreparation: await input preparation
AsyncPreparation-->>CrewAkickoff: return normalized inputs
CrewAkickoff->>TaskExecution: execute kickoff task
TaskExecution-->>CrewAkickoff: return CrewOutput
CrewAkickoff->>AfterCallback: invoke callback
AfterCallback-->>CrewAkickoff: return result or awaitable
CrewAkickoff-->>CrewAkickoff: await result when awaitable
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 Warning |
Summary
Fixes #6481 - Adds async support for
before_kickoff_callbacksandafter_kickoff_callbacksinCrew.akickoff()method.Changes
inspect.isawaitable()checks for bothbefore_kickoff_callbacks(via newaprepare_kickoff) andafter_kickoff_callbacksto properly await async callablesaprepare_kickoff()function with async callback support forbefore_kickoff_callbackstest_akickoff_calls_async_before_callback- verifies async before callback is awaitedtest_akickoff_calls_async_after_callback- verifies async after callback is awaitedtest_akickoff_mixed_sync_and_async_callbacks- verifies mixed sync/async callbacks work togethertest_akickoff_empty_callbacks- verifies empty callbacks still function normallyRoot Cause
The
akickoffmethod only awaitedtask_callbacksbut notbefore_kickoff_callbacksorafter_kickoff_callbacks, causing async callbacks to not execute properly (coroutines were never awaited).Fix
Applied the same
inspect.isawaitable()pattern used fortask_callbacksto both kickoff callback types, and created an async version ofprepare_kickofffor the async path.Testing
All 4 new tests pass + all 11 existing async crew tests pass (15 total). Only Windows teardown
PermissionErrorobserved (environmental, not code-related).