Skip to content

fix(cli): OpenCode config missing limit.output for metadata-less models (#10940) - #11010

Merged
diegosouzapw merged 1 commit into
release/v3.8.50from
fix/10940-opencode-limit
Aug 21, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.50from
fix/10940-opencode-limit

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Closes #10940

Root cause

src/lib/cli-helper/config-generator/opencode.ts::buildModelEntry() only emitted the limit block when at least one of context / userOutput / catalogOutput resolved to a value. A model with no catalog metadata (no context_length, no max_output_tokens) and no existing user override in opencode.json got no limit block at all — but limit.output is a REQUIRED field in OpenCode's v1 provider schema (configV1), so OpenCode rejected the whole config at startup with Missing key provider.omniroute.models.{model}.limit.output.

Fix

entry.limit is now always emitted, seeded with the already-computed output fallback (catalog value → user override → 8192 default). context and input are added only when actually resolved — we still never fabricate a context window.

Tests

  • New regression test tests/unit/opencode-limit-output-10940.test.ts: RED on the untouched code (confirmed — entry.limit was undefined for a metadata-less model), GREEN after the fix.
  • Updated the pre-existing #8849 emits a complete limit for catalog metadata without fabricating one test in tests/unit/cli-helper/config-generator.test.ts, which asserted the old (buggy) limit === undefined behavior for a no-metadata model — that assertion was itself encoding the [BUG] Missing key provider.omniroute.models.{model}.limit.output #10940 bug, so it's now aligned to limit: { output: 8192 }.
  • Full sibling sweep green: tests/unit/cli-helper/config-generator.test.ts, tests/unit/opencode-config-dir-single-source.test.ts, tests/unit/rotation-config-omniroute.test.ts, tests/unit/cli/configure-command.test.ts (54/54 passing before adding the new file; 36/36 in the two most relevant files after).

Gates run locally

  • node scripts/check/check-file-size.mjs — OK (file unchanged in line count)
  • node scripts/check/check-complexity.mjs — OK (2615 vs baseline 2774)
  • node scripts/check/check-cognitive-complexity.mjs — OK (1175 vs baseline 1223)
  • npm run typecheck:core — clean
  • npx eslint (suppressions-location config/quality/eslint-suppressions.json) on touched files — 0 errors
  • node scripts/check/check-changelog-integrity.mjs — OK

Note (out of scope)

tests/integration/opencode-config-startup.test.ts is separately red on this base tip due to an unrelated pre-existing version-pin drift (OPENCODE_VERSION = "1.18.8" hardcoded vs the installed opencode-ai@1.18.18 from #10931) — confirmed present on origin/release/v3.8.50 before this branch, not touched here.

⚠️ base-red inherited: #9985 — public-creds(copilot-m365-web), docs-sync(PROVIDER_REFERENCE)

@diegosouzapw
diegosouzapw force-pushed the fix/10940-opencode-limit branch from c82b9f7 to b6d8e6e Compare August 21, 2026 16:51
@diegosouzapw
diegosouzapw merged commit 054cfae into release/v3.8.50 Aug 21, 2026
18 of 36 checks passed
@diegosouzapw
diegosouzapw deleted the fix/10940-opencode-limit branch August 23, 2026 21:45
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…0940) (diegosouzapw#11010)

⭐5 — Fix(diegosouzapw#10940): OpenCode config rejeitava modelos sem metadata de catálogo por faltar limit.output (campo obrigatório no schema v1). Agora sempre emite limit com fallback (catálogo → override → 8192). TDD RED→GREEN; teste pré-existente que codificava o bug corrigido. UNSTABLE é o base-red inherited diegosouzapw#9985.
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.

[BUG] Missing key provider.omniroute.models.{model}.limit.output

2 participants