Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes Z.AI endpoint auto-detection caching by persisting the detected endpoint to auth.json under the auth-store lock, while ensuring the detection flow does not change the user’s active_provider.
Changes:
- Persist detected Z.AI endpoint results by reloading
auth.jsoninside_auth_store_lock()and flushing via_save_auth_store(). - Store
providers.zai.detected_endpointusing_store_provider_state(..., set_active=False)to avoid promotingzaito the active provider. - Add a regression test verifying both persistence of
detected_endpointand thatactive_provideris not switched tozai.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
hermes_cli/auth.py |
Writes detected Z.AI endpoint cache to auth.json safely under lock without changing active_provider. |
tests/hermes_cli/test_api_key_providers.py |
Adds regression coverage for persistence + non-promotion of zai as active provider. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assert detected["base_url"] == "https://api.z.ai/api/coding/paas/v4" | ||
| assert detected["endpoint_id"] == "coding-global" | ||
| assert detected["model"] == "glm-5.1" | ||
| assert payload.get("active_provider") != "zai" |
57102b0 to
ba54107
Compare
|
Updated this PR to line up with the contributor guidelines and PR template:
Targeted verification is green locally: I also attempted the canonical local full suite after installing the missing HERMES_TEST_WORKERS=4 scripts/run_tests.sh -qThat run is not currently green in my local environment ( |
ba54107 to
d5f04ba
Compare
|
Good catch on the I updated the regression to use an arbitrary
Targeted verification after that update: Force-pushed the amended commit with that more general regression coverage. |
|
Thanks for the focused reproduction and regression coverage. This is an automated hermes-sweeper review; current
|
What does this PR do?
Fixes Z.AI endpoint detection so a discovered coding-plan endpoint is actually persisted to
auth.json, while avoiding an accidental switch of the user's active provider tozaiduring passive endpoint resolution.Related Issue
No existing issue found/linked. This came from debugging Z.AI / GLM coding-plan endpoint selection where keys can work on the coding endpoint but fail or show insufficient balance on the generic endpoint.
Type of Change
Changes Made
hermes_cli/auth.pyproviders.zai.detected_endpointwith_store_provider_state(..., set_active=False)._save_auth_store(auth_store).tests/hermes_cli/test_api_key_providers.pyHow to Test
GLM_BASE_URLoverride.zai/...GLM model.auth.jsoncontainsproviders.zai.detected_endpointfor the detected coding endpoint.zaiunless the user explicitly selects it.Regression test runs:
Latest targeted local verification on EndeavourOS x86_64 with Python 3.11.14:
Full-suite attempt after rebasing on current
origin/main:Current local result is not green due failures outside this PR's touched files:
The full-suite checkbox below is intentionally left unchecked until CI or a maintainer-confirmed local environment produces a green full-suite run.
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Targeted regression output: