Skip to content

Implement capability-based exclusions for toolless models in router roster#1

Merged
sheepdestroyer merged 2 commits into
masterfrom
jules-4810944531982137704-266f44e3
Jun 16, 2026
Merged

Implement capability-based exclusions for toolless models in router roster#1
sheepdestroyer merged 2 commits into
masterfrom
jules-4810944531982137704-266f44e3

Conversation

@sheepdestroyer

@sheepdestroyer sheepdestroyer commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Added a check in sync_adaptive_router_roster within router/main.py to ensure that models without the tools capability in their supported_parameters are 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:

  • Skip models that lack tool/function-calling support when building the adaptive router roster to prevent crashes in tool-heavy agents.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced model roster validation to require tool calling support. The system now automatically filters models during synchronization, only registering those that fully support tool calling functionality. This improvement increases system reliability, reduces potential compatibility issues, and ensures users have access to models with complete feature support.

Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@sourcery-ai

sourcery-ai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This 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_roster

flowchart 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
Loading

File-Level Changes

Change Details Files
Skip models without tool/function calling support during adaptive router roster synchronization.
  • Retrieve supported_parameters from each model entry with a safe default list.
  • Add a guard that checks for the "tools" capability and continues the loop when absent.
  • Log an informational message when a model is skipped for lacking tool support, then proceed to the next model before pricing checks.
router/main.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@sheepdestroyer, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1f6c91bc-4f09-47b7-a899-41650a6ae7e0

📥 Commits

Reviewing files that changed from the base of the PR and between 328d439 and beb3c94.

📒 Files selected for processing (1)
  • router/main.py
📝 Walkthrough

Walkthrough

In sync_adaptive_router_roster, a new guard checks each OpenRouter model's supported_parameters list. If "tools" is not present, the model is skipped with an informational log message and not registered under any tier.

Changes

Tool-calling filter in roster sync

Layer / File(s) Summary
Skip models missing tool support during sync
router/main.py
Adds a check on supported_parameters inside the roster sync loop; models without "tools" are logged and skipped before any tier registration.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 Hoppin' through the model list with care,
If "tools" ain't there, I skip right past the hare!
No broken tiers, no phantom calls,
Just capable models filling halls.
A tiny gate, a tidy win — quite fair! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: implementing capability-based exclusions for models lacking tool support in the router roster synchronization.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jules-4810944531982137704-266f44e3

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread router/main.py Outdated

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.info to debug (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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8fa9e14a-c06d-4e1c-883f-73debab754ae

📥 Commits

Reviewing files that changed from the base of the PR and between a21f7c7 and 328d439.

📒 Files selected for processing (1)
  • router/main.py

Comment thread router/main.py Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant