Skip to content

fix(gateway): OpenCode Go/Zen session headers, per-model endpoints, max effort, failover - #11

Merged
12errh merged 2 commits into
12errh:mainfrom
imviren:fix/gateway-integration
Sep 8, 2026
Merged

12errh merged 2 commits into
12errh:mainfrom
imviren:fix/gateway-integration

Conversation

@imviren

@imviren imviren commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #10. Ported and rebased onto current main, verified green (typecheck + 402/402 tests, including upstream compaction/fallback suites). What changed and why is in the issue; commit message has the full breakdown.

…ax effort, failover

Fixes 12errh#10.

- Send stable x-opencode-session + distinct User-Agent on every Go/Zen request (fixes 400 MissingSessionID); mint per-conversation ids so first requests carry it.

- Route by model endpoint instead of forcing /chat/completions: new GatewayResponsesAdapter (Responses API) and GatewayMessagesAdapter (Anthropic protocol over gateway base). AnthropicAdapter gained protected hooks; temperature/top_p omitted when thinking is on.

- Always maximum reasoning effort on Go/Zen paths (chat: reasoning_effort=max, responses: reasoning.effort=high, messages: max-budget thinking); transparent one-shot retry with low effort on gateway [1210] thinking errors.

- Router: immediate failover (no retry) on deterministic 400/401/403/404/410; ERROR-level hint for billing failures (CreditsError/RegionError); lastError recorded on all break paths.

- Replace end-of-life NVIDIA default stepfun-ai/step-3.7-flash (410 Gone since 2026-08-28) with live minimaxai/minimax-m3; reasoning-effort hot-reloads via reloadRouter.
@imviren
imviren force-pushed the fix/gateway-integration branch from 02a6470 to d25a448 Compare September 7, 2026 13:08
…es, flag DataPolicy

- serializeMessages maps null content to '' (strict gateways reject null with 'messages illegal'-class 400s).

- Adapters log the exact request body at debug level on non-OK responses so the next 4xx is diagnosable in seconds (nothing at default levels).

- DataPolicyError counts as an account failure (console opt-in hint).
@12errh
12errh merged commit d441ef8 into 12errh:main Sep 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCode Go/Zen gateway integration broken: session header, per-model endpoints, thinking effort, EOL defaults, retry storms

2 participants