Repository navigation
fix(opencode-go): show every listed Go model and identify model-list requests - #168286
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThe PR admits listed Go chat models without upstream metadata and identifies discovery requests with OpenClaw’s User-Agent. Example: A signed-in Go user selects opencode-go/glm-5.1.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a current Go catalog omission, and the introduced diff has no actionable correctness or security findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Go provider plugin combines live model-list rows with upstream metadata, then supplies model definitions to catalog publication and runtime resolution. flowchart LR
A[Go model list] --> C[Go listing projection]
B[Upstream metadata] --> C
D[Shared request headers] --> A
C --> E[Model catalog and picker]
E --> F[Go inference route]
Technical reviewBest possible solution: Land the Go-owned projection and shared request-header reuse while retaining lifecycle filtering and seed-only direct resolution. Do we have a high-confidence way to reproduce the issue? Current-main source excludes listed IDs absent from the metadata snapshot, matching the supplied Gateway before/after transcript; no target code or tests were executed during this review. Is this the best way to solve the issue? The patch fixes Go’s projection at its existing owner, reuses shared classification and attribution, and leaves Zen’s distinct filtering policy intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9f7cb66e186b. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +58, Tests +26, Docs +5. Total +89 across 6 files. Added test files: 0. View PR surface stats
Review metrics
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 Reviewed October 10, 2026, 2:41 AM ET / 06:41 UTC. |
|
Landed in f207a60. OpenCode Go now lists every chat model the account serves, including ones models.opencode.ai has no metadata for (deepseek-flash, glm-5.1, omen-alpha, minimax-m2.5 now appear and run), and its model-list requests identify as OpenClaw. Zen is unchanged. Proof: real Go key, 29/31 turns on main (2 need a workspace privacy setting), picker 31 → 35 with the 4 new rows running, and a new-model simulation. |
…168601) Related: #168286 ## What Problem This Solves OpenCode Zen hides listed models when public metadata is missing, omits OpenClaw attribution on discovery and supported request transports, and tells users to sign in again when a free model is limited to OpenCode's own client. ## User Impact - Listed Zen chat models appear without an OpenClaw update, even before public metadata arrives. Known model metadata and lifecycle filters still apply. - Native Zen discovery and model requests on the OpenAI-compatible and Anthropic transports send `User-Agent: openclaw/<version>`. Custom proxy URLs do not inherit this header. The `google-generative-ai` SDK path does not yet apply this policy and remains a follow-up. Go behavior is unchanged. - A `403 FreeTierError` explains the provider's client restriction and marks only that model unavailable. It does not cool down the credential for other models. A `402` still tells the user to check the account balance. This does not bypass free-tier restrictions or grant account credit. No config, schema, protocol, or dependency changes. ## Why This Change Was Made Zen uses the existing listed-row projection seam added for Go. Rows without metadata use Zen's native OpenAI-compatible route and default limits. The shared non-chat filter still removes embedding rows. There is no `test` blacklist or `-free` name rule. The authenticated listing returned 42 IDs. The only IDs without public metadata were `jev-1.13`, `jev-1.13-free`, and `test`. Their raw rows had no price, tier, or free flag: ```json [ {"id":"jev-1.13-free","object":"model","created":1791655624,"owned_by":"opencode"}, {"id":"test","object":"model","created":1791655624,"owned_by":"opencode"}, {"id":"jev-1.13","object":"model","created":1791655624,"owned_by":"opencode"} ] ``` The listing is the model-existence source. Access failures belong to the request result, not a guessed name filter. Attribution uses the existing policy owner and manifest endpoint facts. Error copy uses the existing status and structured-error parser; it does not expose the raw provider body. ## Evidence - Main-base regressions failed for missing Zen attribution and misleading free-tier copy. The catalog regression failed before the projection change because listed IDs without metadata were absent. The model-level refusal regression also failed before adding the Zen classification hook. The updated Zen plugin suite (26 tests) and shared model-cooldown suite (34 tests) pass; the attribution (16) and user-facing error (42) suites passed before the plugin-only follow-up. - Live authenticated requests with honest OpenClaw attribution: | Model | Status | Result | | --- | --- | --- | | `jev-1.13` | 402 | `server_error`: `Upstream request failed: Insufficient account funds` | | `jev-1.13-free` | 403 | `FreeTierError`: free tier is limited to the OpenCode client | | `test` | 403 | The same `FreeTierError` restriction | - Gateway regression: before the classification fix, a `test` turn returned 403 and put the shared credential into auth cooldown; the next paid-model turn was blocked. After the fix, an isolated Gateway on loopback port 18980 classified the same 403 as `model_not_found`, preserved the client-restriction message, and sent the next `jev-1.13` turn upstream 19 seconds later on the same credential. That request returned 402 with account-balance guidance, not a cooldown error. Refresh also returned 41 active Zen rows, including all three IDs. No successful generation is claimed for this unfunded account. - Captured discovery and model requests sent `User-Agent: openclaw/2026.9.9`; authorization was redacted. Model requests retained `x-opencode-session`. - The source build completed. The changed-file check stopped at the existing environment-variable budget failure, 456 names against 455; the same failure is present on main. This change adds no environment variables. Reverting this change restores the prior behavior; it writes no new state format. The affected surface is native Zen discovery, request identity on OpenAI-compatible and Anthropic transports, and model-level refusal classification, plus safe copy for structured `403 FreeTierError` responses. Custom endpoints, Google SDK attribution, and Go keep their current behavior. Co-authored-by: Ayaan Zaidi <[email protected]>
…requests (openclaw#168286) ## What Problem This Solves Signed-in OpenCode Go accounts didn't see every model their account serves. The plugin kept only listed IDs that also appear in `models.opencode.ai` metadata. Four models listed by `/zen/go/v1/models` and served by Go (`deepseek-flash`, `glm-5.1`, `omen-alpha`, `minimax-m2.5`; each returns 200 for a direct request) were missing from the picker, and `opencode-go/<id>` failed with "Unknown model". The Go model-list request also went out with the generic `undici` User-Agent. OpenCode asks clients to identify themselves with their own user agent (https://opencode.ai/docs/go/). ## User Impact - Signed in to OpenCode Go: every model the account lists now appears and runs, even when OpenCode's public metadata doesn't describe it yet. Those models use Go's OpenAI-compatible route with default limits until metadata arrives. - Models that upstream metadata marks deprecated stay hidden, as documented. Known case: `kimi-k2.6` is marked deprecated in metadata but is still on OpenCode's Go docs list and still served. It remains hidden from the picker, and `opencode-go/kimi-k2.6` keeps working as an explicit ref. - Go model-list requests now send `openclaw/<version>`, the same User-Agent inference already sends. ## Why This Change Was Made - `extensions/opencode-go/provider-catalog.ts`: Go owns its listing projection. Listed IDs with upstream metadata keep the existing enrichment and lifecycle. Listed chat IDs without metadata (the shared non-chat classifier still drops embeddings and similar rows) get the provider's default route `openai-completions` at `https://opencode.ai/zen/go/v1`. Metadata never chooses the route for these IDs, so rejected metadata (for example an off-origin base URL) still can't redirect inference. - `createUpstreamProviderCatalog` gains an optional `projectRows`. It defaults to the existing `projectProviderCatalogSnapshotRows`, so OpenCode Zen is unchanged. Model-list and starter-model requests now carry the provider's attribution headers from `resolveProviderRequestHeaders`, the same owner inference uses. That owner has a policy for Go only, so Zen requests are unchanged. - Docs: Go catalog behavior, and the SDK helper description. No schema, config, or protocol changes. ## Evidence - Regression: `extensions/opencode-go/index.test.ts` "lists every advertised chat model…" (listed ID without metadata appears on the Go route; deprecated row hidden; embedding row dropped; model-list request sends `openclaw/…`) and the updated rejected-metadata case. Both fail on `origin/main` and pass on this branch. - Live, real Go account, isolated profile, loopback Gateway, outgoing requests recorded by a loopback MITM proxy (credentials never recorded): - Base (`origin/main`): sign-in with the Gateway running → 31 Go rows appear about 2 s later, no restart. 29 of 31 first turns reply `OK`, on openai-completions, anthropic-messages and openai-responses. The two `muse-spark-*-contributor` models are refused by OpenCode until the workspace allows paid endpoints that train on request data (an account Privacy setting). Inference requests carry `User-Agent: openclaw/<version>` and `x-opencode-session` equal to the OpenClaw session id. The model-list request carried `User-Agent: undici`. - New-model simulation on base: a throwaway build with `qwen3.8-max` removed from the Go manifest, the recommended list and a local catalog.openclaw.ai v2 copy. The model still appeared from live listing + upstream metadata, and its first turn replied `OK` over anthropic-messages. - This branch: sign-in with the Gateway running → 35 Go rows (the 31 above plus `deepseek-flash`, `glm-5.1`, `omen-alpha`, `minimax-m2.5`) within about 1 s, no restart. First turns on those four and a `glm-5.3-flash` control all reply `OK` over `/zen/go/v1/chat/completions` with `x-opencode-session`. The model-list request now carries `User-Agent: openclaw/2026.9.9`. - `node scripts/check-changed.mjs`: all stages green except `typecheck extensions`, which I fixed in the last commit and reran (`pnpm tsgo:extensions` passes). - `pnpm exec oxlint --type-aware` on changed files: clean except two `no-redundant-type-constituents` errors on `ProviderRuntimeModel` in `extensions/opencode-go/provider-catalog.ts` (`resolveOpencodeGoModel` / `normalizeOpencodeGoResolvedModel`, unchanged lines). The unmodified file reports the same two errors on this base, so they aren't introduced here. ## Known follow-up (not in this PR) OpenCode Zen with the same key: `/zen/v1/models` lists 3 IDs without upstream metadata (`jev-1.13-free`, `test`, `jev-1.13`). Zen free-tier models are refused outside OpenCode's own client (403 `FreeTierError`: "OpenCode's free tier can only be used from within OpenCode"). Zen keeps its current projection until those rows get their own filtering decision. Zen has no attribution policy, so its requests keep their current User-Agent. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#168601) Related: openclaw#168286 ## What Problem This Solves OpenCode Zen hides listed models when public metadata is missing, omits OpenClaw attribution on discovery and supported request transports, and tells users to sign in again when a free model is limited to OpenCode's own client. ## User Impact - Listed Zen chat models appear without an OpenClaw update, even before public metadata arrives. Known model metadata and lifecycle filters still apply. - Native Zen discovery and model requests on the OpenAI-compatible and Anthropic transports send `User-Agent: openclaw/<version>`. Custom proxy URLs do not inherit this header. The `google-generative-ai` SDK path does not yet apply this policy and remains a follow-up. Go behavior is unchanged. - A `403 FreeTierError` explains the provider's client restriction and marks only that model unavailable. It does not cool down the credential for other models. A `402` still tells the user to check the account balance. This does not bypass free-tier restrictions or grant account credit. No config, schema, protocol, or dependency changes. ## Why This Change Was Made Zen uses the existing listed-row projection seam added for Go. Rows without metadata use Zen's native OpenAI-compatible route and default limits. The shared non-chat filter still removes embedding rows. There is no `test` blacklist or `-free` name rule. The authenticated listing returned 42 IDs. The only IDs without public metadata were `jev-1.13`, `jev-1.13-free`, and `test`. Their raw rows had no price, tier, or free flag: ```json [ {"id":"jev-1.13-free","object":"model","created":1791655624,"owned_by":"opencode"}, {"id":"test","object":"model","created":1791655624,"owned_by":"opencode"}, {"id":"jev-1.13","object":"model","created":1791655624,"owned_by":"opencode"} ] ``` The listing is the model-existence source. Access failures belong to the request result, not a guessed name filter. Attribution uses the existing policy owner and manifest endpoint facts. Error copy uses the existing status and structured-error parser; it does not expose the raw provider body. ## Evidence - Main-base regressions failed for missing Zen attribution and misleading free-tier copy. The catalog regression failed before the projection change because listed IDs without metadata were absent. The model-level refusal regression also failed before adding the Zen classification hook. The updated Zen plugin suite (26 tests) and shared model-cooldown suite (34 tests) pass; the attribution (16) and user-facing error (42) suites passed before the plugin-only follow-up. - Live authenticated requests with honest OpenClaw attribution: | Model | Status | Result | | --- | --- | --- | | `jev-1.13` | 402 | `server_error`: `Upstream request failed: Insufficient account funds` | | `jev-1.13-free` | 403 | `FreeTierError`: free tier is limited to the OpenCode client | | `test` | 403 | The same `FreeTierError` restriction | - Gateway regression: before the classification fix, a `test` turn returned 403 and put the shared credential into auth cooldown; the next paid-model turn was blocked. After the fix, an isolated Gateway on loopback port 18980 classified the same 403 as `model_not_found`, preserved the client-restriction message, and sent the next `jev-1.13` turn upstream 19 seconds later on the same credential. That request returned 402 with account-balance guidance, not a cooldown error. Refresh also returned 41 active Zen rows, including all three IDs. No successful generation is claimed for this unfunded account. - Captured discovery and model requests sent `User-Agent: openclaw/2026.9.9`; authorization was redacted. Model requests retained `x-opencode-session`. - The source build completed. The changed-file check stopped at the existing environment-variable budget failure, 456 names against 455; the same failure is present on main. This change adds no environment variables. Reverting this change restores the prior behavior; it writes no new state format. The affected surface is native Zen discovery, request identity on OpenAI-compatible and Anthropic transports, and model-level refusal classification, plus safe copy for structured `403 FreeTierError` responses. Custom endpoints, Google SDK attribution, and Go keep their current behavior. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Signed-in OpenCode Go accounts didn't see every model their account serves. The plugin kept only listed IDs that also appear in
models.opencode.aimetadata. Four models listed by/zen/go/v1/modelsand served by Go (deepseek-flash,glm-5.1,omen-alpha,minimax-m2.5; each returns 200 for a direct request) were missing from the picker, andopencode-go/<id>failed with "Unknown model".The Go model-list request also went out with the generic
undiciUser-Agent. OpenCode asks clients to identify themselves with their own user agent (https://opencode.ai/docs/go/).User Impact
kimi-k2.6is marked deprecated in metadata but is still on OpenCode's Go docs list and still served. It remains hidden from the picker, andopencode-go/kimi-k2.6keeps working as an explicit ref.openclaw/<version>, the same User-Agent inference already sends.Why This Change Was Made
extensions/opencode-go/provider-catalog.ts: Go owns its listing projection. Listed IDs with upstream metadata keep the existing enrichment and lifecycle. Listed chat IDs without metadata (the shared non-chat classifier still drops embeddings and similar rows) get the provider's default routeopenai-completionsathttps://opencode.ai/zen/go/v1. Metadata never chooses the route for these IDs, so rejected metadata (for example an off-origin base URL) still can't redirect inference.createUpstreamProviderCataloggains an optionalprojectRows. It defaults to the existingprojectProviderCatalogSnapshotRows, so OpenCode Zen is unchanged. Model-list and starter-model requests now carry the provider's attribution headers fromresolveProviderRequestHeaders, the same owner inference uses. That owner has a policy for Go only, so Zen requests are unchanged.No schema, config, or protocol changes.
Evidence
extensions/opencode-go/index.test.ts"lists every advertised chat model…" (listed ID without metadata appears on the Go route; deprecated row hidden; embedding row dropped; model-list request sendsopenclaw/…) and the updated rejected-metadata case. Both fail onorigin/mainand pass on this branch.origin/main): sign-in with the Gateway running → 31 Go rows appear about 2 s later, no restart. 29 of 31 first turns replyOK, on openai-completions, anthropic-messages and openai-responses. The twomuse-spark-*-contributormodels are refused by OpenCode until the workspace allows paid endpoints that train on request data (an account Privacy setting). Inference requests carryUser-Agent: openclaw/<version>andx-opencode-sessionequal to the OpenClaw session id. The model-list request carriedUser-Agent: undici.qwen3.8-maxremoved from the Go manifest, the recommended list and a local catalog.openclaw.ai v2 copy. The model still appeared from live listing + upstream metadata, and its first turn repliedOKover anthropic-messages.deepseek-flash,glm-5.1,omen-alpha,minimax-m2.5) within about 1 s, no restart. First turns on those four and aglm-5.3-flashcontrol all replyOKover/zen/go/v1/chat/completionswithx-opencode-session. The model-list request now carriesUser-Agent: openclaw/2026.9.9.node scripts/check-changed.mjs: all stages green excepttypecheck extensions, which I fixed in the last commit and reran (pnpm tsgo:extensionspasses).pnpm exec oxlint --type-awareon changed files: clean except twono-redundant-type-constituentserrors onProviderRuntimeModelinextensions/opencode-go/provider-catalog.ts(resolveOpencodeGoModel/normalizeOpencodeGoResolvedModel, unchanged lines). The unmodified file reports the same two errors on this base, so they aren't introduced here.Known follow-up (not in this PR)
OpenCode Zen with the same key:
/zen/v1/modelslists 3 IDs without upstream metadata (jev-1.13-free,test,jev-1.13). Zen free-tier models are refused outside OpenCode's own client (403FreeTierError: "OpenCode's free tier can only be used from within OpenCode"). Zen keeps its current projection until those rows get their own filtering decision. Zen has no attribution policy, so its requests keep their current User-Agent.