hermes - ✅(Solved) Fix [Bug]: test_custom_provider_model_switch asserts outdated fetch_api_models signature [3 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#15243Fetched 2026-04-25 06:23:31
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×3labeled ×3

Root Cause

Bug Description

tests/hermes_cli/test_custom_provider_model_switch.py::TestCustomProviderModelSwitch::test_saved_model_still_probes_endpoint fails because the test asserts an outdated mock call signature.

Fix Action

Fixed

PR fix notes

PR #15246: test(model-switch): assert fetch_api_models kwargs match current signature (#15243)

Description (problem / solution / changelog)

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_mode was added to the production signature by 647900e8

("fix(cli): support model validation for anthropic_messages and

cloudflare-protected endpoints") — the test fixture has no

api_mode entry so api_mode or None resolves to None.

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 fix (no production behavior change)

Test plan

  • All 6 tests in `TestCustomProviderModelSwitch` pass locally
  • This failure has appeared on every open PR's `test` CI lane since 647900e8 landed — the fix clears it from the baseline failure set
  • No production code touched

Changed files

  • tests/hermes_cli/test_custom_provider_model_switch.py (modified, +8/-2)

PR #15254: test(cli): align custom provider probe assertion with api_mode kwarg

Description (problem / solution / changelog)

Summary

  • update one stale test assertion to match current fetch_api_models call signature
  • keep scope to test-only change in tests/hermes_cli/test_custom_provider_model_switch.py

Root cause

_model_flow_named_custom() now calls: fetch_api_models(api_key, base_url, timeout=8.0, api_mode=api_mode or None)

The test test_saved_model_still_probes_endpoint still expected a call without api_mode, which causes a false failure.

Validation

  • uv run pytest -q -n 0 tests/hermes_cli/test_custom_provider_model_switch.py::TestCustomProviderModelSwitch::test_saved_model_still_probes_endpoint -vv
  • uv run pytest -q -n 0 tests/hermes_cli/test_custom_provider_model_switch.py
  • uv run pytest -q -n 0 tests/hermes_cli/test_custom_provider_model_switch.py::TestCustomProviderModelSwitch::test_saved_model_still_probes_endpoint tests/hermes_cli/test_plugin_scanner_recursion.py::TestKindField::test_unknown_kind_falls_back_to_standalone tests/hermes_cli/test_provider_config_validation.py::TestNormalizeCustomProviderEntry::test_unknown_keys_logged tests/hermes_cli/test_provider_config_validation.py::TestNormalizeCustomProviderEntry::test_camel_case_warning_logged -vv

Fixes #15243

Changed files

  • tests/hermes_cli/test_custom_provider_model_switch.py (modified, +3/-1)

PR #15190: test(gateway): make systemd refresh tests hermetic with user D-Bus preflight

Description (problem / solution / changelog)

Summary

Fixes a test regression introduced by user D-Bus preflight checks in systemd user-scope commands.

This keeps runtime behavior unchanged and makes the affected unit tests hermetic again by stubbing _preflight_user_systemd where tests are specifically validating command sequencing / refresh behavior.

Changes

  • Add monkeypatch.setattr(gateway_cli, "_preflight_user_systemd", lambda: None) in:
    • TestSystemdServiceRefresh::test_systemd_start_refreshes_outdated_unit
    • TestSystemdServiceRefresh::test_systemd_restart_refreshes_outdated_unit
    • TestGatewaySystemServiceRouting::test_systemd_restart_self_requests_graceful_restart_and_waits
    • TestGatewaySystemServiceRouting::test_systemd_restart_recovers_failed_planned_restart

Why

systemd_start() and systemd_restart() now call _preflight_user_systemd() before the mocked subprocess.run path. In non-systemd environments, those tests fail early with UserSystemdUnavailableError and never reach their intended assertions.

Validation

  • pytest -q -n 0 tests/hermes_cli/test_gateway_service.py::TestSystemdServiceRefresh::test_systemd_start_refreshes_outdated_unit tests/hermes_cli/test_gateway_service.py::TestSystemdServiceRefresh::test_systemd_restart_refreshes_outdated_unit tests/hermes_cli/test_gateway_service.py::TestGatewaySystemServiceRouting::test_systemd_restart_self_requests_graceful_restart_and_waits tests/hermes_cli/test_gateway_service.py::TestGatewaySystemServiceRouting::test_systemd_restart_recovers_failed_planned_restart
  • pytest -q -n 0 tests/hermes_cli/test_gateway_service.py

Closes #15187

Changed files

  • tests/hermes_cli/test_gateway_service.py (modified, +4/-0)

Code Example

uv run pytest -q -n 0 \
  tests/hermes_cli/test_custom_provider_model_switch.py::TestCustomProviderModelSwitch::test_saved_model_still_probes_endpoint -vv

---

Expected: fetch_api_models('sk-test', 'https://vllm.example.com/v1', timeout=8.0)
Actual:   fetch_api_models('sk-test', 'https://vllm.example.com/v1', timeout=8.0, api_mode=None)
RAW_BUFFERClick to expand / collapse

Bug Description

tests/hermes_cli/test_custom_provider_model_switch.py::TestCustomProviderModelSwitch::test_saved_model_still_probes_endpoint fails because the test asserts an outdated mock call signature.

_model_flow_named_custom() now calls: fetch_api_models(api_key, base_url, timeout=8.0, api_mode=api_mode or None)

The test still expects a call without api_mode.

Steps to Reproduce

  1. Checkout main at commit 62c14d5513469e27474fc9535fcdd4afa016646f.
  2. Run:
uv run pytest -q -n 0 \
  tests/hermes_cli/test_custom_provider_model_switch.py::TestCustomProviderModelSwitch::test_saved_model_still_probes_endpoint -vv

Expected Behavior

The test should verify that probing still happens when a model is already saved, without failing on an argument-shape mismatch that is now intentional.

Actual Behavior

Assertion failure:

Expected: fetch_api_models('sk-test', 'https://vllm.example.com/v1', timeout=8.0)
Actual:   fetch_api_models('sk-test', 'https://vllm.example.com/v1', timeout=8.0, api_mode=None)

Environment

  • OS: macOS (arm64)
  • Python: 3.11.x
  • Install method: source checkout + uv

Related Context

Likely Root Cause

Test drift after interface expansion. Runtime behavior appears intentional; test assertion was not updated to account for the additional keyword argument.

Proposed Fix

Update this assertion to tolerate the added keyword argument, for example:

  • assert mock_fetch.call_args includes required core args and timeout=8.0, and
  • allow api_mode to be present (None for this fixture case).

Are you willing to submit a PR for this?

Yes.

extent analysis

TL;DR

Update the test assertion in test_saved_model_still_probes_endpoint to account for the additional api_mode keyword argument in the fetch_api_models call.

Guidance

  • Review the test case test_saved_model_still_probes_endpoint and update the assertion to include the new api_mode parameter.
  • Verify that the test passes after updating the assertion by re-running the test command: uv run pytest -q -n 0 tests/hermes_cli/test_custom_provider_model_switch.py::TestCustomProviderModelSwitch::test_saved_model_still_probes_endpoint -vv.
  • Ensure that the updated assertion still correctly verifies the intended behavior of probing when a model is already saved.
  • Consider adding additional tests to cover different scenarios with the new api_mode parameter.

Example

# Updated assertion example
assert mock_fetch.call_args[1] == {
    'api_key': 'sk-test',
    'base_url': 'https://vllm.example.com/v1',
    'timeout': 8.0,
    'api_mode': None  # Allow api_mode to be present with value None
}

Notes

The proposed fix assumes that the addition of the api_mode parameter is intentional and the test should be updated to reflect this change. If the api_mode parameter is not expected, further investigation may be needed to determine the root cause of the issue.

Recommendation

Apply workaround: Update the test assertion to account for the additional api_mode keyword argument, as this change appears to be intentional and the test needs to be updated to reflect the new behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: test_custom_provider_model_switch asserts outdated fetch_api_models signature [3 pull requests, 1 participants]