Repository navigation
fix: restore OpenCode Go family routing after API migration - #176265
Conversation
Co-authored-by: obviyus <[email protected]>
Worked on by: - @obviyus Co-authored-by: obviyus <[email protected]> OpenClaw-Publication: 5e5b7ba9-c9ef-49a8-8f94-1faa3a17e771
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Co-authored-by: obviyus <[email protected]>
Worked on by: - @obviyus Co-authored-by: obviyus <[email protected]> OpenClaw-Publication: fc74fbcd-a200-44db-a189-78866f5fadbe
|
@clawsweeper re-review Please review current head da021a7 after the diagnostic-only follow-up. Current-head CI is green. The PR body records the transport proof and the live Go catalog authorization rejection without claiming authenticated inference success. |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR updates OpenCode Go discovery and API-family destinations, preserves native request identity, and repairs live-test discovery setup. Example: Resolve opencode-go/qwen3.8-max using the Anthropic Messages API.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR repairs provider-owned routing and attribution gaps that remain on main; no actionable findings remain, and the recorded Gateway acceptance addresses the previous review’s request. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe provider plugin combines account inventory and trusted model metadata, normalizes configured routes, and passes resolved models to shared transports that construct authenticated requests. flowchart LR
A[Account inventory] --> C[Go provider catalog]
B[Trusted model metadata] --> C
C --> E[Provider route normalization]
D[Saved model configuration] --> E
E --> F[Shared request policy]
F --> G[API family transport]
G --> H[OpenCode inference]
Technical reviewBest possible solution: Keep API-family selection in the existing Go provider owner and apply native attribution through the existing shared transport policy. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the stale destinations and missing Google policy integration; supplied regression evidence exercises these paths through catalog projection, provider normalization, and real transport adapters. Is this the best way to solve the issue? The patch fixes the existing routing producers and normalization owner, updates their metadata mirrors, and reuses shared header policy without adding parallel state, transports, or configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d0dcce33fd71. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +25, Tests +612, Docs +9, Other +7. Total +653 across 13 files. Added test files: 2. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 18, 2026, 4:00 PM ET / 20:00 UTC (Revision 5). |
Co-authored-by: obviyus <[email protected]>
Worked on by: - @obviyus Co-authored-by: obviyus <[email protected]> OpenClaw-Publication: ba14db51-e6d9-4941-981d-1e35f37e5537
|
@clawsweeper re-review The requested compatibility evidence is now in the PR body for unchanged head b8a2efa. Latest-stable 2026.10.4 -> exact candidate tarball upgrade passed via the real updater, Doctor, data survival assertions and a booted Gateway (run 39147944160, artifact 12144696781). A separate published-CLI-written Go specimen loads through the real candidate config/model owners: eight native/proxy rows across four APIs, selections, aliases and saved bytes preserved, zero network requests. The two proof boundaries and unavailable first-hop snapshot are explicit. Please reassess the compatibility requirement against that evidence; authenticated upstream Go inference remains blocked at catalog authorization and is not claimed successful. No code changed and no merge is requested. |
|
🦞👀 Re-review progress:
|
Co-authored-by: obviyus <[email protected]>
Worked on by: - @obviyus Co-authored-by: obviyus <[email protected]> OpenClaw-Publication: 27e02f57-8b9c-49b6-ab9f-56eeb85c3f9f
|
@clawsweeper re-review Please assess current head a6a2151 after the test-only live fixture repair. Exact-head CI is green;41 focused helpers, targeted types/lint/format and fresh P0-P2 review passed. Effective cfg now reaches both fixture registries; live setup uses the existing proxy lifecycle. Production source is unchanged from the previously reviewed/upgrade-tested routing head. New protected-key evidence is explicit in the body: authenticated catalog200; real direct upstream replies through Chat Completions, Responses and native-header Anthropic. Google returned400 with native/Bearer auth and non-streaming control, so no success is claimed there. The real isolated Gateway now boots/selects GLM but fails at the process-local sentinel handoff before captured inference POST; no credential unwrap, safety weakening or successful Gateway E2E claim. Please review the fixture repair and evidence boundaries. No merge requested. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…#176265) Restore OpenCode Go API-family routing after the inference API migration. Resolve native endpoints from the model API across discovery, saved routes, offline starters, and fallbacks. Preserve custom proxies and explicit API choices; send truthful OpenClaw client and stable session headers. Verified exact-head CI, focused production-path regressions, published upgrade/survival, and real Gateway prompt, read-tool, and exec-tool continuations for Chat Completions, Responses, and Anthropic. Both advertised image models passed image checks. Google remains gated by the upstream workspace privacy policy, which was not changed. Co-authored-by: obviyus <[email protected]> Co-authored-by: shakkernerd <[email protected]>
What Problem This Solves
Fixes Go models retaining outdated or wrong-family endpoints after OpenCode’s inference API migration, alongside missing truthful client/session headers on native requests.
Original report: https://x.com/steipete/status/2111814502731939939. Routing clarification: https://x.com/shakker/status/2111857457580675267.
User Impact
Discovered models, saved native Go routes, offline starters, and dynamic fallbacks now select their endpoint by the resolved model API. Saved native URLs migrate automatically; custom proxy URLs and explicit API choices remain unchanged. No new configuration option is introduced. Rejected credentials or unavailable model IDs still require valid account/catalog access and a current model reference.
Why This Change Was Made
The initial PR corrected endpoint attribution but left a separate routing gap: Go defaults and fallbacks still used
/zen/go, and refreshed Anthropic rows were forced back to that old base. The follow-up moves those producers and API-aware normalization to the current Go routes:/inference/go/openai/v1/chat/completions/inference/go/openai/v1/responses/inference/go/anthropic/v1/messages/inference/go/google/v1beta/models/<id>:streamGenerateContentDiscovery uses the distinct
/inference/go/v1/modelsendpoint. Anthropic runtime bases omit the terminal/v1so the owning transport adds it exactly once. The provider owns family selection; native-route metadata and its packaged mirror stay aligned. Existing header policy, session precedence, Vertex behavior, and authentication behavior are preserved—no new transport, SDK seam, state, or model-name heuristic.Evidence
da021a7f50fcf059feec150091b6b727a8b65b2a: fresh Anthropic projection, saved shared native bases across all four APIs, and offline/default fallbacks retained old routes. All five now pass.src/gateway/gateway-models.profiles.live.test.ts: it forwards the effective config to both registry consumers and starts/stops the existing CLI proxy lifecycle for live discovery. A new real-registry regression failed before config forwarding and passes afterward; 41 focused fixture/helper tests, targeted TypeScript, lint, formatting and whitespace checks passed. No production routing/security/secret code changed in this follow-up.a6a2151b81c26f20233492f1e1875351b5e378d6, with no failed or unfinished jobs. ClawSweeper's current-head reassessment revieweda6a2151b81c26f20233492f1e1875351b5e378d6at 18:13 UTC with zero findings, ready for maintainer review, and no before-merge items. That assessment preceded the successful three-model Gateway run recorded below; Google remains blocked by upstream workspace privacy policy. It is not itself merge approval. The prior full build/upgrade evidence remains reusable because the only subsequent source change is the live test fixture.Upgrade and saved-data compatibility
2026.10.4, updated via the real updater to the candidate tarball, ran Doctor and survival assertions, and booted/probed the isolated Gateway. The lane took 464s. The downloadable evidence artifact records selected sourceb8a2efa72eb2827adfba75c4445eb1454849bb31and installed build ID2026.10.4-b8a2efa72eb2-2026-10-18T17-08-04.697Z; the equal package version is not being used as source identity. Config intents, session metadata/user files, post-Doctor validation, health, readiness and RPC status assertions passed. Its first-hop post-core exit snapshot is explicitly unavailable; the final update/survival outcome is successful, not proof that every intermediate state was captured.2026.10.4CLI wrote and validated eight authored rows (four APIs × native shared legacy base/custom proxy), primary/fallback selections and aliases. The candidate's realloadConfig()→resolveModelAsync(), using actual plugin discovery/normalization and no fake registry/hooks, resolved all eight with their authored API intact: four canonical native family bases and four custom-proxy routes. No network requests occurred. Saved config bytes, aliases/selections, workspace identity and notes stayed exact. Anthropic proxy runtime trimming of terminal/v1matches the same shared policy in the published baseline; its authored URL stayed unchanged on disk.Authenticated upstream checks and historical local Gateway limitation
A newly supplied protected Team credential was used only through its
opencode.aidestination binding; it was never printed or copied into plaintext config. Authenticated catalog GET returned 200. With the existing managed-proxy lifecycle active, the actual Go catalog owner also reportedreadyand projected 36 models. The live fixture had separately omitted its effective config while loading the registry: the same captured discovery produced zero models without that config and 36 with it. The test-only follow-up repairs that missing handoff rather than weakening strict model selection.Real upstream inference succeeded through three canonical protocols:
glm-5.3stopgpt-5.6-lunacompletedqwen3.8-maxend_turnThese were bounded coding prompts sent directly through protected HTTPS egress with truthful
openclaw/2026.10.4identification and a stable syntheticx-opencode-session. Anthropic used the SDK-nativex-api-keyform, confirming that a mandatory Bearer-only claim is unsupported. These direct API contract checks are not shipped CLI/Gateway E2E and do not replace the intercepted transport tests.Google triage completed: upstream workspace privacy policy, not a demonstrated routing/payload bug. The current public
opencode-gometadata explicitly assignsgemini-4-argon-contributorto@ai-sdk/googleathttps://opencode.ai/inference/go/google/v1beta, matching the API/base produced by this PR. The prior streaming native-key, streaming Bearer, and non-streaming Bearer controls all returned 400. One bounded diagnostic capture established the precise service rejection (HTTP 400, Google-style error code400, statusUNKNOWN):The OpenCode workspace owner/admin must explicitly decide whether to permit paid endpoints that train on request data, or retain the existing privacy policy and choose a permitted model. No privacy setting was changed, no further Google inference was pursued after identifying the gate, and no successful Google reply is claimed. No OpenClaw code fix is demonstrated by this rejection, and filtering by a model-name suffix or changing transport/auth to evade the policy would be inappropriate. The supplied key remains valid: the successful catalog and three upstream protocol checks above are unchanged.
Historical host-local Gateway attempt reached model dispatch but did not complete inference (superseded by the hosted pass below): after fixture repair, the isolated Gateway booted, selected
opencode-go/glm-5.3from 36 discovered models, and attempted its real agent prompt. It ended with a connection failure and no captured inference POST/reply. A separate pre-aborted invocation of the actual guarded model-fetch owner confirmed the protected exec binding is rejected as an unregistered process-local sentinel before sending. The protected-exec-to-model-egress handoff needs an owner-supported integration; no key unwrapping, plaintext substitution, sentinel bypass, TLS weakening, manual proxy-activation flag, or live service mutation was used. This is not evidence that the supplied key is invalid: its catalog and direct inference checks succeeded.Full real Gateway acceptance passed
A fresh supported Blacksmith Testbox run completed the actual Gateway live-model test at exact source
a6a2151b81c26f20233492f1e1875351b5e378d6, tree1b2acda43f55080cb09115430a0314ca1b01861e(remote carriere26e61cd31517b89b34ae48d8b15e6e412c9fb4c). Hosted lease workflow; allocationtbx_01m588zma4973het1z3dmhycjp; managed Crabbox0.77.0,.github/workflows/ci-check-testbox.ymlon trustedmain. Requested standard check profile; observed 4 CPUs and 16,167,124 KiB memory. GitHub's existing workflow credential hydration supplied authentication; the protected Team key was not extracted or forwarded.The real test command was
OPENCLAW_LIVE_TEST=1 OPENCLAW_LIVE_REQUIRE_PROFILE_KEYS=0 OPENCLAW_LIVE_GATEWAY_PROVIDERS=opencode-go OPENCLAW_LIVE_GATEWAY_MODELS=opencode-go/glm-5.3,opencode-go/gpt-5.6-luna,opencode-go/qwen3.8-max OPENCLAW_LIVE_GATEWAY_MAX_MODELS=3 OPENCLAW_LIVE_GATEWAY_SMOKE=0 OPENCLAW_LIVE_GATEWAY_THINKING=low OPENCLAW_VITEST_RUNTIME=node OPENCLAW_LIVE_GATEWAY_STEP_TIMEOUT_MS=90000 OPENCLAW_LIVE_GATEWAY_SETUP_TIMEOUT_MS=180000 OPENCLAW_LIVE_GATEWAY_MODEL_TIMEOUT_MS=300000 pnpm test:live -- src/gateway/gateway-models.profiles.live.test.ts --testNamePattern 'runs meaningful prompts across models with available keys' --maxWorkers=1 --reporter=dot, with a passive allowlisted diagnostics observer.glm-5.3/ Chat Completionsgpt-5.6-luna/ Responsesqwen3.8-max/ Anthropic MessagesAll 3/3 selected models completed, zero model failures/skips. The selected test passed in 129.27s; 183 other tests were intentionally excluded by the exact test-name filter, not counted as acceptance. Both test and independent three-model receipt inspection exited 0. Passive observations recorded HTTP 200 on each canonical inference path,
User-Agent: openclaw/2026.10.4, and presence ofx-opencode-session, without logging authentication, session values, or request/response bodies. Discovery also returned 200 andreadywith 36 models.The outer wrapper initially exited 1 only during GitHub cleanup settlement, after the successful test, due to a transient exact-run read failure. Native cleanup was reconciled on the same allocation: remote state
completed, no host, and exact GitHub run terminalcancelledas expected for externally stopped Testbox jobs. That cancelled workflow is not being presented as green CI. The separate PR CI run remains successful. Earlier queued allocationtbx_01m584bdydz8dr5bdt3g92g69dexercised zero models and was stopped; it remains a historical capacity failure, superseded by this successful real Gateway execution. Google privacy policy is unchanged and Google inference remains unproven.Historical hosted runs (broad Go, diagnostic, canonical control) stopped at catalog auth rejection before inference using their existing hosted credential. They remain failed historical attempts, not success or a verdict on the new protected Team key. Upstream retains the old OpenAI/Anthropic aliases, so an old URL alone does not establish an access denial. The reporter's exact version/model/config and claimed status causes remain unverified; the earlier Control UI model-not-found symptom occurs before inference.
Other retained gaps: an additional helper-only sweep on this host had 180 passes, one unchanged OpenAI Ultra loopback
UND_ERR_SOCKETfailure, and two skips under both Node and pinned Bun; a narrow Bun reproduction also failed. This is documented, not relabeled green. The broader hosted MiniMax/Qwen lane also has two independently stale selectors (minimax-m2.7deprecated,qwen3.5-plusabsent); strict missing-model checks were not weakened.Credits
Reported by @douglasfugazi; investigation requested by @steipete. PR and expanded verification requested by @obviyus.
Work sessions
Worked on by
View the OpenClaw team session