-
Notifications
You must be signed in to change notification settings - Fork 1
Optimize tool call reactor handler ordering cache #658
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
Conversation
WalkthroughAdds a cached, priority-ordered handler list to ToolCallReactorService, with cache invalidation on handler register/unregister. process_tool_call now uses the cached ordering. Introduces helper methods for cache management. Adds a unit test verifying cache refresh after unregister affects handler selection. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant Reactor as ToolCallReactorService
participant Cache as Handler Cache
participant Handlers as Registered Handlers
Client->>Reactor: register_handler(...)
activate Reactor
Reactor->>Handlers: Add handler
Reactor->>Cache: Invalidate
deactivate Reactor
Client->>Reactor: process_tool_call(request)
activate Reactor
Reactor->>Cache: Get handlers by priority
alt cache miss
Cache->>Handlers: Read all handlers
Handlers-->>Cache: Return set
Cache-->>Reactor: Sorted handlers (desc priority)
else cache hit
Cache-->>Reactor: Cached sorted handlers
end
Reactor->>Handlers: Iterate and attempt handle
Reactor-->>Client: Result
deactivate Reactor
Client->>Reactor: unregister_handler(id)
activate Reactor
Reactor->>Handlers: Remove handler
Reactor->>Cache: Invalidate
deactivate Reactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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 (3)
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). (2)
🔇 Additional comments (5)
Comment |
Summary
ToolCallReactorServiceand refresh it on registration changesTesting
python -m pytest -c /tmp/pytest.ini tests/unit/core/services/test_tool_call_reactor_service.pypython -m pytest -c /tmp/pytest.ini(fails: missing optional test dependencies such as pytest_asyncio, respx, pytest_httpx, hypothesis)https://chatgpt.com/codex/tasks/task_e_68ec27b5f5f08333be56cce2d6aca430
Summary by CodeRabbit