test(hermes_cli): isolate qwen fallthrough test from the ambient credential pool - #75235
test(hermes_cli): isolate qwen fallthrough test from the ambient credential pool#75235griffinwork40 wants to merge 1 commit into
Conversation
…ential pool test_qwen_oauth_auto_fallthrough_on_auth_failure stubs resolve_provider, resolve_qwen_runtime_credentials and _get_model_config, but not load_pool. resolve_runtime_provider consults the credential pool first: when a pool entry matches the provider it returns at hermes_cli/runtime_provider.py:1887, before the qwen try/except at :1958 that the test exists to exercise. So on a machine with a live Qwen credential the stubbed AuthError is never raised, the resolver returns provider="qwen-oauth" from the pool, and the assertion fails — while the same test passes wherever no Qwen credential happens to match. Observed failing locally against a real Qwen credential; passes again once the pool stops matching. Nothing about the resolver is wrong — the pool branch is correct and deliberate — the test simply was not isolated from it. Adds the load_pool stub the other tests in this file already use (23 call sites) so the outcome no longer depends on the contributor's ambient credentials. The test still exercises what it claims: the stubbed AuthError now fires and resolution falls through to OpenRouter.
|
Thanks for isolating this test from local credential state. The premise is verified on current main: The added false Automated hermes-sweeper review. |
Duplicate of #67465: same empty credential-pool test isolation mechanism. |
Problem
test_qwen_oauth_auto_fallthrough_on_auth_failuredepends on the contributor's ambient credentials, so it passes or fails depending on the machine it runs on.The test stubs
resolve_provider,resolve_qwen_runtime_credentialsand_get_model_config— but notload_pool.resolve_runtime_providerconsults the credential pool first. When a pool entry matches the provider it returns athermes_cli/runtime_provider.py:1874-1887, before ever reaching the qwentry/exceptat:1958that this test exists to exercise:So on a machine with a live Qwen credential the stubbed
AuthErroris never raised, the resolver returnsprovider="qwen-oauth"straight from the pool, and the assertion at line 105 fails:Traced with
sys.settraceto confirm the mechanism rather than infer it —resolve_qwen_runtime_credentialsis never called, and the return comes from line 1887 withsource='qwen-cli'.Not a resolver bug
The pool-first branch is correct and deliberate; I am not proposing any change to it. Following this repo's guidance to check whether an apparent gap is load-bearing before touching it, the fix belongs entirely in the test.
Fix
Adds the
load_poolstub that the other tests in this same file already use — there are 23 such call sites, so this is the established convention here, and this test is the outlier:Verification
scripts/run_tests.sh tests/hermes_cli/test_runtime_provider_resolution.py→ 52 passedtests/hermes_cli/slice → 3637 passed, with the same 2 pre-existing macOS-environment failures (test_service_manager.py::test_seed_supervise_skeleton_creates_expected_layout,test_gateway_service.py::…test_systemd_restart_gracefully_restarts_running_service_and_waits) present identically onmain@cc4cab2f5, so no collateral change.ruff check .clean ·python scripts/check-windows-footguns.py --allclean (893 files)AuthErrornow genuinely fires and resolution falls through toopenrouter(source='env/config'), which is what the test claims to verify.Honest scope note
This is flakiness-hardening, not a hard red on
main. The test passes in a clean environment, which is presumably why CI is green. It fails for contributors who have Qwen credentials configured — I hit it while working on an unrelated change, and it cost real time to distinguish from my own edits.