Skip to content

fix(opencode-go): pin base_url_override on overlay to match canonical Zen Go URL - #59254

Closed
asimons81 wants to merge 3 commits into
NousResearch:mainfrom
asimons81:fix/opencode-go-base-url-override
Closed

asimons81 wants to merge 3 commits into
NousResearch:mainfrom
asimons81:fix/opencode-go-base-url-override

Conversation

@asimons81

Copy link
Copy Markdown
Contributor

Summary

Pin base_url_override on the opencode-go HermesOverlay to the canonical Zen Go URL so the overlay's default matches the URL registered in every other site that knows about opencode-go.

This is the caller-agnostic half of the bug class tracked in #54147. The in-flight PRs #54148 / #54365 fix _ensure_runtime_credentials forwarding target_model (the per-call-site half). Pinning the overlay default 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 — places any of which can re-introduce the same class of 404 if they ever forget to forward context.

Why a separate PR

I dropped a comment on #54147 volunteering this as a standalone change rather than riding along with the caller-side fix. The two are independent: #54148 / #54365 fix api_mode derivation; this one fixes the base_url default. Both should land for the full 404 class to be closed.

Diff

     "opencode-go": HermesOverlay(
         transport="openai_chat",
         is_aggregator=True,
+        base_url_override="https://opencode.ai/zen/go/v1",
         base_url_env_var="OPENCODE_GO_BASE_URL",
     ),

Why this URL

The pinned URL is consistent with every other registration path for opencode-go in the codebase:

Site Reference Value
hermes_cli/auth.py L385 ProviderConfig.inference_base_url="https://opencode.ai/zen/go/v1"
plugins/model-providers/opencode-zen/__init__.py L142 OpenCodeGoProfile.base_url="https://opencode.ai/zen/go/v1"
~/.hermes/.env template (commented example) # OPENCODE_GO_BASE_URL=https://opencode.ai/zen/go/v1
hermes_cli/providers.py L150 (overlay) was missing — falls through to mdev_info.api

After this patch, providers.py:446's base_url_override or mdev_info.api resolves to the canonical URL for opencode-go, matching every sibling URL-bearing overlay (openai-api, xai-oauth, qwen-oauth, nous, lmstudio, stepfun, minimax-oauth).

Reproduction (verified 2026-07-05)

# Before this patch (HTTPS probe with real OPENCODE_GO_API_KEY, browser UA):
$ curl -sS -o /dev/null -w "%{http_code}\n" \
    https://opencode.ai/zen/go/v1/chat/completions \
    -X POST -H "Authorization: Bearer $OPENCODE_GO_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"model":"glm-5.2","messages":[{"role":"user","content":"hi"}],"max_tokens":10}'
200   # upstream is alive

# Hermes session through the overlay (broken before this patch):
$ hermes chat -q "Reply with exactly OK" -Q --provider opencode-go --model deepseek-v4-flash
session_id: 20260705_183814_767617
API call failed after 3 retries: HTTP 404 — Not Found | opencode

After this patch, resolve_provider("opencode-go") returns the right URL regardless of which call site asks; minimax-m3 continues to work as before (anthropic-routed, separate transport, separate bug class — see #35183), and the rest of the opencode-go catalog (glm-*, kimi-*, qwen3.*, mimo-v2.*) becomes reachable for every caller including the ones a per-site patch would miss.

Note on deepseek-v4-flash: independent of the routing-layer bug, OpenCode Go's DeepSeek-v4 backend also returned HTTP 500 from upstream in the same probe today. That's a separate, upstream-side outage — flagged here for the maintainers' awareness so it isn't conflated with this fix.

Out of scope

  • Does not touch _ensure_runtime_credentials or runtime_provider.py. The two layers (api_mode forwarding + base_url default) should land independently.
  • Does not change OPENCODE_GO_BASE_URL env handling. Users who already override via the env var see no behavior change; users on the default see the previously-broken models become reachable.

Verification

  • python -c "import ast; ast.parse(open('hermes_cli/providers.py').read())" — parses ✓
  • hermes_cli/providers.py is the only file modified.
  • After merge: git grep -n 'opencode-go' hermes_cli/providers.py should show the base_url_override line.

Environment

Hermes Agent v0.18.0 (a05b64d6), Windows 10, 20-model provider_models_cache.json fingerprint ab8202806d02b240.

Refs #54147

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard provider/openai OpenAI / Codex Responses API labels Jul 6, 2026
@alt-glitch

Copy link
Copy Markdown

This was generated by AI during triage.

Related: caller-agnostic half of the opencode-go 404 class (#54147). Complements caller-side fixes #54148 / #54365 (both open) and the merged symmetric normalizer #57585 — this PR pins the overlay base_url_override default in hermes_cli/providers.py (verified missing on main), a distinct code-site. Not a duplicate; a human picks whether the pinned-default + caller-side fixes both land.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for isolating the overlay-side default from the already-merged runtime normalizer.

Problems

  • The new base_url_override has no direct regression coverage. Current main tests the runtime repair of a stripped URL in tests/hermes_cli/test_runtime_provider_resolution.py:1754, while the new behavior is in the models.dev overlay resolution at hermes_cli/providers.py:465.

Suggested changes

  • Add a focused test that mocks the models.dev provider record for opencode-go with a stripped API URL and asserts resolve_provider_full("opencode-go") returns https://opencode.ai/zen/go/v1. This validates the caller-agnostic overlay contract without freezing live catalog data.

The runtime 404 path is already normalized by hermes_cli/runtime_provider.py:2063 and hermes_cli/model_switch.py:1349 from commit 6eb39c2bbea97941e333e17bec64a8c20cb068ec; this change remains a distinct deterministic default for the pre-runtime resolver path. Automated hermes-sweeper review.

Comment thread hermes_cli/providers.py
@asimons81
asimons81 force-pushed the fix/opencode-go-base-url-override branch from 4b67147 to ea9c958 Compare July 15, 2026 18:42
@asimons81

asimons81 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Regression test added per review feedback. (Updated: SHA amended after rebase onto latest main.)

The new test_opencode_go_resolver_prefers_canonical_overlay_url was added to tests/hermes_cli/test_opencode_go_in_model_list.py.

Mock strategy:

  • agent.models_dev.get_provider_info is monkeypatched to return a synthetic ProviderInfo for opencode-go
  • The ProviderInfo has a deliberately stripped API URL: https://opencode.ai/zen/go (no /v1 suffix)
  • No network access, no live models.dev catalog dependency

Assertions:

  • resolve_provider_full("opencode-go") returns a non-None result
  • resolved.id == "opencode-go"
  • resolved.base_url == "https://opencode.ai/zen/go/v1" (the canonical overlay override)
  • The overlay contract is intact: transport="openai_chat", is_aggregator=True, base_url_env_var="OPENCODE_GO_BASE_URL"

Verification:

  • pytest tests/hermes_cli/test_opencode_go_in_model_list.py -v — 3/3 PASSED
  • pytest tests/hermes_cli/test_runtime_provider_resolution.py -v — 151/151 PASSED
  • ruff check — All checks passed

Final branch push: 0d386c88b (rebased onto upstream/main, PR is now MERGEABLE).

@asimons81
asimons81 force-pushed the fix/opencode-go-base-url-override branch from ea9c958 to 79dc768 Compare July 15, 2026 18:43
@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-automation Sweeper risk: may affect CI, automerge, label sync, or maintainer automation sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 15, 2026
prompt-courier and others added 3 commits July 15, 2026 16:59
…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.
Add a one-line AUTHOR_MAP entry for the bot committer identity on
PR NousResearch#59254. Without this mapping, the contributor-attribution CI gate
fails on every commit from this bot account because the email is not
in scripts/release.py.

Refs NousResearch#59254.
@asimons81
asimons81 force-pushed the fix/opencode-go-base-url-override branch from 79dc768 to 0d386c8 Compare July 15, 2026 22:02
@asimons81

Copy link
Copy Markdown
Contributor Author

Added the focused regression coverage the sweeper asked for: test_opencode_go_resolver_prefers_canonical_overlay_url mocks models.dev with a stripped URL and asserts resolve_provider_full("opencode-go") returns the canonical https://opencode.ai/zen/go/v1. All CI checks pass. Ready for review.

@asimons81 asimons81 closed this Jul 30, 2026
@asimons81
asimons81 deleted the fix/opencode-go-base-url-override branch July 30, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-automation Sweeper risk: may affect CI, automerge, label sync, or maintainer automation sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants