- Notifications
You must be signed in to change notification settings - Fork 0
Optimize tool call reactor handler ordering cache #669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
WalkthroughAdds a lazily computed, cached priority ordering for tool call handlers with invalidation on register/unregister. Updates processing to use the cached order. Introduces unit tests verifying cache rebuild on registration and unregistration, ensuring correct priority handling and swallow behavior. Changes
Sequence Diagram(s)sequenceDiagram autonumber participant C as Caller participant R as ToolCallReactorService participant H as Handlers (various priorities) note over R: On first use, compute and cache sorted handlers C->>R: process_tool_call(call) alt cache empty R->>R: _get_sorted_handlers() -> sort & cache else cache present R->>R: _get_sorted_handlers() -> return cached end loop in priority order R->>H: can_handle(call)? alt can_handle = true R->>H: handle(call) alt swallowed R-->>C: return handled result note over R: Stop on swallow else not swallowed note over R: Continue to next handler end else cannot handle note over R: Skip to next end end R-->>C: return default/no-op if none handled sequenceDiagram autonumber participant Dev as Registrar participant R as ToolCallReactorService participant Cache as _sorted_handlers rect rgba(220,240,255,0.4) note over R,Cache: Cache invalidation paths Dev->>R: register(handler, priority) R->>Cache: _invalidate_sorted_handlers() -> None Dev->>R: unregister(handler) R->>Cache: _invalidate_sorted_handlers() -> None end note over R: Next process_tool_call recomputes sorted list Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (2)**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧬 Code graph analysis (2)tests/unit/core/services/test_tool_call_reactor_service.py (2)
src/core/services/tool_call_reactor_service.py (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (7)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
ToolCallReactorService
to avoid repeated sorting on every tool callTesting
https://chatgpt.com/codex/tasks/task_e_68ec2f427ce08333b4c1e4ecd4777ede
Summary by CodeRabbit