Implement capability-based exclusions for toolless models in router roster#1
Conversation
Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates the adaptive router roster sync logic to exclude models that do not advertise tool/function calling support via their supported_parameters, preventing tool-using agents from being routed to incompatible models. Flow diagram for tool-capability filtering in sync_adaptive_router_rosterflowchart TD
Start([Start sync_adaptive_router_roster])
Iterate[For each model m]
CheckID{Valid mid
and not internal}
GetParams[Get supported_parameters]
CheckTools{supported_parameters
contains tools}
Skip[Skip model]
Pricing[Process pricing
and include in roster]
End([End])
Start --> Iterate
Iterate --> CheckID
CheckID -->|no| Iterate
CheckID -->|yes| GetParams
GetParams --> CheckTools
CheckTools -->|no| Skip
Skip --> Iterate
CheckTools -->|yes| Pricing
Pricing --> Iterate
Iterate --> End
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reached
More reviews will be available in 6 minutes and 13 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. 📝 WalkthroughWalkthroughIn ChangesTool-calling filter in roster sync
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Code Review
This pull request updates the sync_adaptive_router_roster function in router/main.py to filter out models that do not support tool calling by checking the supported_parameters field. Feedback on this change highlights a potential TypeError if supported_parameters is explicitly set to null in the API response, and suggests using m.get('supported_parameters') or [] as a safer fallback.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The log message with the 🚫 emoji is inconsistent with typical production logging style and may cause issues in some log consumers; consider using a plain-text message instead.
- Given that skipping non-tool-capable models may be a common/expected case, consider downgrading the
logger.infotodebug(or adding a sampling mechanism) to avoid noisy logs in large rosters.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The log message with the 🚫 emoji is inconsistent with typical production logging style and may cause issues in some log consumers; consider using a plain-text message instead.
- Given that skipping non-tool-capable models may be a common/expected case, consider downgrading the `logger.info` to `debug` (or adding a sampling mechanism) to avoid noisy logs in large rosters.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@router/main.py`:
- Around line 196-198: The code does not validate that supported_params is
actually a list type before performing the membership check "tools" not in
supported_params. Since m.get("supported_parameters", []) may return None or a
non-list type from the external API payload, add a type guard to ensure
supported_params is a list (or is truthy and iterable) before checking if
"tools" is in it. If supported_params is not a valid list, treat it as empty or
skip the tool-calling check gracefully to prevent the entire roster sync from
aborting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Added a check in
sync_adaptive_router_rosterwithinrouter/main.pyto ensure that models without thetoolscapability in theirsupported_parametersare skipped during roster synchronization. This prevents tool-heavy agents from crashing when routed to models that do not support tool calling.PR created automatically by Jules for task 4810944531982137704 started by @sheepdestroyer
Summary by Sourcery
Bug Fixes:
Summary by CodeRabbit