Skip to content

opencode-go live rows silently materialize at the 128k context fallback: provider publishes no windows, generated registry is a generation behind, and augment never backfills existing live rows #4944

Closed

Description

@tizerluo

Client or integration

Codex CLI

Area

Catalog / models

Summary

Every live-discovered opencode-go model row materializes at the 128k context-window fallback, because (a) the OpenCode Go /v1/models endpoint publishes no context-window field at all, (b) the generated model-metadata registry (src/generated/model-metadata.ts) is a generation behind the live roster, and (c) augmentRoutedModelsWithMetadata only appends registry rows that are absent from the live list — it never backfills a context window onto a row the live list already returned (if (seen.has(key)) continue; in src/codex/catalog/routed-gather.ts). The net effect is silent: a 1M-class model shows a plausible-looking 128k window, chained clients compact at ~121k, and nothing reports data loss.

Concretely, on 2.58.0 with OpenCode Go enabled, these live models exist at https://opencode.ai/zen/go/v1/models (response rows contain only id/object/created/owned_by) but are absent from the generated registry, so they fall back to 128000: qwen3.8-flash, deepseek-flash (the current name; legacy deepseek-v4-flash / deepseek-v4-flash-vision-exp still accepted by DeepSeek), hy4-preview, omen-alpha, union-alpha, muse-spark-1.3-contributor, plus longcat-2.0, gpt-5.6-luna, qwen3.8-max. Authoritative windows are published on models.dev (limit.context), which the generator (scripts/generate-model-metadata.ts) already resembles: qwen3.8-flash 1,000,000 / deepseek-v4(.1)-flash 1,000,000 / hy4-preview 1,024,000 / omen-alpha 500,000 / union-alpha 262,144 / muse-spark-1.3-contributor 1,048,576.

Expected: registry rows should backfill contextWindow onto live rows whose provider-published window is absent (the seen check should merge metadata into the existing row instead of skipping it), and the generated registry should catch up with the current live roster. Either fix alone removes the silent 128k fallback for most rows.

Reproduction

  1. ocx provider add opencode-go with a valid key, enable e.g. qwen3.8-flash (a 1M model), restart the proxy.
  2. curl -H "Authorization: Bearer $KEY" -H "User-Agent: opencodex" https://opencode.ai/zen/go/v1/models → rows carry no context-length field (also note: the default python-urllib UA gets a 403; a browser/CLI UA is required).
  3. Check the routed catalog: the opencode-go/qwen3.8-flash row materializes at context_window = 128000.
  4. Cross-check src/generated/model-metadata.ts → the "opencode-go" table has no qwen3.8-flash row to append, and even for ids it does have (e.g. deepseek-v4-flash) the append-only augmentRoutedModelsWithMetadata skips them when the live list already returned the id without a window.

Workaround we use today: a per-provider modelContextWindows hint in the proxy config (e.g. providers["opencode-go"].modelContextWindows = { "qwen3.8-flash": 1000000, ... }) correctly overrides the fallback after a restart — which also demonstrates that the plumbing is fine and only the metadata source/merge is missing.

Version

2.58.0

Operating system

macOS 26 (Tahoe) 25.6, Apple Silicon (arm64); reproduced identically on Ubuntu 24.04 (x86_64) proxies.

Provider and model

opencode-go / qwen3.8-flash, deepseek-flash, hy4-preview, omen-alpha, union-alpha, muse-spark-1.3-contributor

Logs or error output

$ curl -s -H "Authorization: Bearer $KEY" -H "User-Agent: opencodex" https://opencode.ai/zen/go/v1/models | head -c 300
{"object":"list","data":[{"id":"minimax-m3","object":"model","created":1789679277,"owned_by":"opencode"},...   # no context fields anywhere in the response

# routed catalog row before the config-hint workaround:
{"slug":"opencode-go/qwen3.8-flash", ..., "context_window":128000}
# same row after providers["opencode-go"].modelContextWindows = {"qwen3.8-flash":1000000} + restart:
{"slug":"opencode-go/qwen3.8-flash", ..., "context_window":1000000}

Redacted configuration

providers["opencode-go"] = { adapter: "openai-chat", baseUrl: "https://opencode.ai/zen/go/v1", authMode: "api-key" } (key redacted). No other provider/router settings are involved.

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    catalog
    platform
    on Sep 17, 2026
  2. tizerluo commented on Sep 17, 2026

    @tizerluo
    ContributorAuthor

    Scaling note: the same silent-128k-fallback pattern affects the poineer adapter at much larger scale. Its live roster publishes no context windows either, and poineer is not in the generated registry at all (not even stale rows), so on our hub 100+ poineer rows materialized at 128000 — including claude-opus-5 / claude-sonnet-5 / gpt-5.6 family (1M–1.05M models). models.dev publishes a dedicated pioneer provider entry (112 models with limit.context) that the metadata generator could consume; matching needs the multi-segment ids (anthropic/pioneer/gpt-5.6-sol) as well as the dash-collapsed catalog slugs.

    Also worth documenting while auditing: the precedence we observed empirically for providers[x].modelContextWindows is live discovery > config hint > seed catalog > 128k fallback — the hint fills fallback rows and overrides seed values (e.g. a wrong 1M seed for a 200k-class model), but never overrides a live-discovered value. That seems intentional, but it means rows whose live roster carries a wrong window (e.g. an aggregator advertising 200k for a 1M model) are not fixable via config.

  3. added 2 commits that reference this issue on Sep 17, 2026
    6ba36c3
    5377d5d
  4. lidge-jun commented on Sep 18, 2026

    @lidge-jun
    Owner

    Fixed on dev by #4962, squashed as 6ba36c3076625cdfc596ec89dbfcaa3abb9d16af.

    Your report named three possible mechanisms. Only one was the cause, and saying which matters so the other two are not chased later.

    The operative cause is the stale generated registry. The decisive step is applyCatalogMetadata (src/codex/catalog/parsing.ts:828-836), which writes context_window onto the serialized entry straight from the generated table with no reference to the CatalogModel list — so nine of the ten ids you named had no registry row to merge against. The "seen" skip was ruled out as the cause, and the augment path was ruled out as a repository defect.

    Two corrections to the model list itself. muse-spark-1.3-contributor was already declared at 1048576 in the provider registry preset at entries-core.ts:684 and resolved correctly all along. And deepseek-flash is not published by models.dev for this provider, so it was deliberately not added. The change publishes eight ids, every number taken from the fetched models.dev payload.

    Shipping in the next release off dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcatalogplatform

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions