fix(zai): autodetect endpoint during setup flow#11376
Open
helix4u wants to merge 1 commit into
Open
Conversation
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?
This fixes a mismatch between the Z.AI auth path and the interactive model/setup path.
Hermes already auto-detects the correct GLM endpoint at auth setup time in
hermes_cli/auth.py, but the interactive provider flow inhermes_cli/main.pywas still routingzaithrough the generic API-key provider flow. That generic flow prompts forBase URL [...]and defaults to the general GLM endpoint, which makes Coding Plan users guess the right endpoint even though Hermes already has autodetect logic.This PR gives Z.AI its own setup flow and reuses
resolve_api_key_provider_credentials("zai")so setup stays aligned with the existing auth/runtime endpoint detection and cache behavior.This applies both to
hermes modeland to the model/provider section insidehermes setup, because the setup wizard delegates that step through the sameselect_provider_and_model()path inhermes_cli/main.py.Related Issue
Fixes #
Type of Change
Changes Made
_model_flow_zai()inhermes_cli/main.pyzaiprovider selection through that dedicated flow instead of the generic API-key provider flowresolve_api_key_provider_credentials("zai")so setup uses the same endpoint autodetect/cached resolution as the auth pathzaiprovider flowhermes modeland the model/provider step inhermes setuptests/hermes_cli/test_model_provider_persistence.pyHow to Test
hermes setupand go through the model/provider step, or runhermes modelzaimodel.base_urlmatches the resolved Z.AI endpointFocused test run completed:
source venv/bin/activate && python -m pytest tests/hermes_cli/test_model_provider_persistence.py tests/hermes_cli/test_api_key_providers.py -qResult:
136 passed in 9.05sFull suite run completed:
source venv/bin/activate && python -m pytest tests/ -q -n 4Result:
38 failed, 12253 passed, 35 skipped in 333.60s (0:05:33)The failures are broad and appear unrelated to this change. They are clustered in existing-red areas including gateway/Discord, DM topics, API server, setup prompt menus, Bedrock auto-detection, Ollama Cloud auto-detection, backup/profile restoration, browser/camofox/browserbase, tirith, and a few other general suite failures. Nothing in the failing list is in the touched Z.AI setup files.
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
Focused pytest:
136 passed in 9.05sFull suite pytest:
38 failed, 12253 passed, 35 skipped in 333.60s (0:05:33)