fix(coding-agent): spread an unqualified find_models across providers - #922
Open
BILLKISHORE wants to merge 3 commits into
Open
fix(coding-agent): spread an unqualified find_models across providers#922BILLKISHORE wants to merge 3 commits into
BILLKISHORE wants to merge 3 commits into
Conversation
Author
|
#855 predates this by about 21 hours and covers the same ordering defect, plus the page metadata and the #810 token-order fix. I missed it when I checked whether #799 was claimed. That PR is the more complete answer. Its Leaving this open only in case the smaller change is useful in the meantime: it is limited to the ordering defect, touches three files, and is currently mergeable where #855 needs a rebase. If you would rather take #855 whole, say so and I will close this. |
avion23
pushed a commit
to avion23/prime-agent
that referenced
this pull request
Aug 9, 2026
…odels provider spread
BILLKISHORE
force-pushed
the
fix/799-find-models-provider-spread
branch
2 times, most recently
from
August 11, 2026 21:32
142ee51 to
68399ad
Compare
BILLKISHORE
force-pushed
the
fix/799-find-models-provider-spread
branch
from
August 12, 2026 09:48
68399ad to
257209b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #799.
Problem
rlm.find_models()with no query scores every candidate the same, so ordering falls entirely to thealphabetical tiebreak before truncation:
The bare call is the natural first move for an agent orienting itself before delegating, and it
returns the alphabetically first provider's models only. In the reported run that read as the
complete reachable set, so an orchestrator concluded only the anthropic family was natively
reachable and routed three delegations through shell-CLI fallbacks that were not needed. The failure
mode is a plausible subset rather than an error, so nothing downstream contradicts the inference.
Change
Unqualified searches now round-robin across providers, preserving each provider's own ordering. A
query-driven search is untouched and still ranks purely by relevance.
The result is that a default
find_models()samples the catalog instead of paging it alphabetically,so every configured provider is visible in the first response.
Scope
The issue also suggests returning a truncation marker or a provider summary. Both change the shape of
the response, and
find_modelsis typed aslist[RLMModel]inprime-agent-runtime/src/rlm/__init__.py,where
_model_from_payloadvalidates each entry. Surfacing a marker means changing that return type,which breaks existing callers, so this PR is limited to the ordering defect that produced the reported
misread. Happy to follow up on the response shape separately if you want it.
Tests
packages/coding-agent/test/suite/regressions/799-find-models-provider-spread.test.tscovers afour-provider catalog with ten models each: that a bare search spans all four rather than one, that
per-provider ordering stays stable, that a limit above the catalog size returns everything, that a
real query is still relevance-ranked, and that a single-provider catalog is unchanged.
The first two fail before this change with
expected Set{ 'anthropic' } to deeply equal Set{ 'anthropic', 'openai-codex', 'openrouter', 'zai' }.Verified with
npm run checkplus the new test and the existing4649-subagent-model-selection.test.tson Node 22.22.3.Note
Fix
rlm.find_models()to spread results across providers when query is emptyspreadAcrossProvidersin rlm-runtime.ts to group candidates by provider and interleave them; non-empty queries retain relevance-based ranking.Macroscope summarized 257209b.