test(model-switch): assert fetch_api_models kwargs match current signature (#15243) - #15246
Closed
briandevans wants to merge 1 commit into
Closed
Conversation
…ature (NousResearch#15243) ``_model_flow_named_custom`` was extended in ``647900e8`` to pass ``api_mode`` through to ``fetch_api_models`` so anthropic-messages and Cloudflare-protected endpoints validate correctly. The test that pins "we must still probe the endpoint when a model is already saved" kept asserting the pre-647900e8 kwarg shape and has been failing on every PR's CI since — one of the four standing baseline failures I've been flagging on open PRs (NousResearch#15158, NousResearch#15162, NousResearch#15173, NousResearch#15185, NousResearch#15244). The production call is: fetch_api_models(api_key, base_url, timeout=8.0, api_mode=api_mode or None) where ``api_mode`` comes from ``provider_info.get("api_mode", "")``. The test fixture has no ``api_mode`` entry so ``api_mode or None`` resolves to ``None``. One-line fix — add ``api_mode=None`` to the ``assert_called_once_with``. Added an inline comment pointing at the 647900e history so future contributors immediately see why the kwarg exists and don't accidentally strip it. All 6 tests in the class still pass locally. This should clear the corresponding entry from the baseline failure set on every open PR's ``test`` lane. Closes NousResearch#15243 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates a CLI regression test to match the current _model_flow_named_custom() → fetch_api_models() call signature, fixing a long-standing CI failure after api_mode was added to the production call path.
Changes:
- Update the mocked
fetch_api_modelsassertion to include theapi_mode=Nonekwarg (matching production behavior whenprovider_infohas noapi_mode). - Add an inline comment documenting why
api_modeis expected to beNonein this fixture.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4 tasks
Contributor
Author
|
Closing — this commit already landed on `main` via No follow-up needed. Thanks! |
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.
What does this PR do?
Fixes `#15243`.
`_model_flow_named_custom` was extended in `647900e8` ("fix(cli): support model validation for anthropic_messages and cloudflare-protected endpoints") to pass `api_mode` through to `fetch_api_models` so Anthropic-messages and Cloudflare-protected endpoints validate correctly. The test that pins "we must still probe the endpoint when a model is already saved" was never updated for that new kwarg and has been failing on every PR's `test` CI lane since — it's one of the four standing baseline failures I've been calling out in CI notes on every open PR (#15158, #15162, #15173, #15185 at minimum, plus any PR a reporter opens in this window).
Fix
One line, plus a comment pointing future readers at the history so no one strips the kwarg again.
Before:
```python
mock_fetch.assert_called_once_with("sk-test", "https://vllm.example.com/v1\", timeout=8.0)
```
After:
```python
fetch_api_models MUST be called even though model was saved.
api_modewas added to the production signature by 647900e("fix(cli): support model validation for anthropic_messages and
cloudflare-protected endpoints") — the test fixture has no
api_modeentry soapi_mode or Noneresolves toNone.mock_fetch.assert_called_once_with(
"sk-test", "https://vllm.example.com/v1\", timeout=8.0, api_mode=None,
)
```
The production call at `hermes_cli/main.py:2920-2923` is:
```python
models = fetch_api_models(
api_key, base_url, timeout=8.0,
api_mode=api_mode or None,
)
```
where `api_mode` comes from `provider_info.get("api_mode", "")`. The test fixture has no `api_mode` entry so `api_mode or None` resolves to `None` — the expected assertion kwarg.
Related Issue
Fixes #15243
Type of Change
Test plan