Conversation
Duplicate of #54148 (earliest, canonical) — both pass |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for covering both the primary and fallback credential-resolution paths. The premise remains present on current main: hermes_cli/cli_agent_setup_mixin.py:41 and :60 omit target_model, while hermes_cli/runtime_provider.py:414 prefers that value over model_cfg.default when deriving OpenCode routing.
Problems
- The PR has no regression test. Current main's
tests/cli/test_cli_provider_resolution.pyhas no assertion that_ensure_runtime_credentials()forwardstarget_model; PR #54148 contains a focused primary-path test, but it is not part of this PR. The fallback-path addition athermes_cli/cli_agent_setup_mixin.py:60is also untested.
Suggested changes
- Add a kwargs-capturing regression test for the primary
-mpath and anAuthErrorfallback test asserting the resolver receives_fb_modelastarget_model.
This is an automated hermes-sweeper review.
| requested=self.requested_provider, | ||
| explicit_api_key=self._explicit_api_key, | ||
| explicit_base_url=self._explicit_base_url, | ||
| target_model=self.model, |
There was a problem hiding this comment.
Please add a direct regression test for this forwarding contract. Current main has no target_model assertion for _ensure_runtime_credentials(); PR #54148 has a primary-path example, and this PR should also cover the fallback call below.
…nonical Zen Go URL The opencode-go HermesOverlay in hermes_cli/providers.py was the only URL-bearing overlay missing a base_url_override. Every sibling overlay (openai-api, xai-oauth, qwen-oauth, nous, lmstudio, stepfun, minimax-oauth) pins a canonical base URL; opencode-go fell through to mdev_info.api and, depending on what models.dev returned, defaulted to https://opencode.ai/zen/go with no /v1 suffix. The /v1-stripped URL is then rounded by anthropic_messages transport into the same wrong path, surfacing as 'HTTP 404 — Not Found | opencode' for every non-MiniMax model on the provider. This is the caller-agnostic half of the bug class tracked at NousResearch/hermes- agent#54147 — NousResearch#54148 / NousResearch#54365 fix _ensure_runtime_credentials forwarding target_model (the per-call-site half); this overlay pin ensures the URL is right regardless of which caller resolves the provider, covering cron resolution, delegation, kanban, model-picker prewarm, TUI switcher, and auxiliary fallbacks. The pinned URL is consistent with every other registration path for opencode-go in the codebase: - hermes_cli/auth.py:385 ProviderConfig.inference_base_url - plugins/model-providers/ opencode-zen/__init__.py: 142 OpenCodeGoProfile.base_url - ~/.hermes/.env template OPENCODE_GO_BASE_URL example Refs NousResearch#54147.
|
Closing as duplicate of #54148 (filed earlier, same fix passing target_model to resolve_runtime_provider). Thanks to @alt-glitch for flagging. |
|
Closing in favour of #54148 (canonical, filed first). |
Fixes #54147
Description
hermes chat -m <model> -q "..."was resolvingapi_modeandbase_urlfrommodel.defaultinconfig.yamlinstead of the explicitly-requested model. Onopencode-go(and any provider whosemodel.defaultdiffers inapi_modefrom the requested model), this sent non-MiniMax models to a wrong endpoint, producing HTTP 404.Root Cause
_ensure_runtime_credentials()inhermes_cli/cli_agent_setup_mixin.pycalledresolve_runtime_provider(requested=..., explicit_api_key=..., explicit_base_url=...)withouttarget_model. The resolver then fell back tomodel_cfg.get("default")to deriveapi_modeandbase_url, picking the wrong mode for any model that differed from the config default.resolve_runtime_provideralready accepted atarget_modelkwarg (added in PR #16890 for the/modelswitch path) — it just wasn't being passed here. Same family as #16878 and #15319 (thedelegate_tool.pyfix used the same one-line pattern).Fix
Pass
target_model=self.modeltoresolve_runtime_provider()in both the primary and fallback paths of_ensure_runtime_credentials(). The resolver now correctly derivesapi_mode=chat_completionsandbase_url=https://opencode.ai/zen/go/v1forqwen3.7-plusregardless of whatmodel.defaultis.runtime = resolve_runtime_provider( requested=self.requested_provider, explicit_api_key=self._explicit_api_key, explicit_base_url=self._explicit_base_url, + target_model=self.model, )Verification
tests/cli/test_cli_provider_resolution.py(23),test_cli_approval_ui.py(22),test_cli_goal_interrupt.py(7),test_cli_secret_capture.py(5),test_cli_active_agent_ref_wiring.py(2) — 59/59 pass in 8.6s.hermes chat -m qwen3.7-plus -q "ok"→ previously 404; with this fix,api_mode=chat_completions+base_url=.../v1resolved correctly./v1/chat/completionsendpoint returns 200, the/chat/completionsendpoint returns 404 HTML — confirming the wrong-base_url root cause.Diff
Notes
test_cli_provider_resolution.pyalready exerciseresolve_runtime_providerresolution across all 20 opencode-go models and would have caught a regression in either direction. A targeted unit test assertingtarget_modelis forwarded is a reasonable follow-up but not required for correctness.fix/issue-54147-stale-api-mode-on-model-flagwas 11,899 commits behindorigin/main(stale-fetch artifact from the gate cron). This PR is raised from a fresh branchfix/issue-54147-stale-api-mode-on-model-flag-rebasedcontaining the same single cherry-picked commit on currentorigin/main. The original branch is preserved untouched.