fix(cli): OpenCode config missing limit.output for metadata-less models (#10940) - #11010
Merged
Merged
Conversation
diegosouzapw
force-pushed
the
fix/10940-opencode-limit
branch
from
August 21, 2026 16:51
c82b9f7 to
b6d8e6e
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10940
Root cause
src/lib/cli-helper/config-generator/opencode.ts::buildModelEntry()only emitted thelimitblock when at least one ofcontext/userOutput/catalogOutputresolved to a value. A model with no catalog metadata (nocontext_length, nomax_output_tokens) and no existing user override inopencode.jsongot nolimitblock at all — butlimit.outputis a REQUIRED field in OpenCode's v1 provider schema (configV1), so OpenCode rejected the whole config at startup withMissing key provider.omniroute.models.{model}.limit.output.Fix
entry.limitis now always emitted, seeded with the already-computedoutputfallback (catalog value → user override →8192default).contextandinputare added only when actually resolved — we still never fabricate a context window.Tests
tests/unit/opencode-limit-output-10940.test.ts: RED on the untouched code (confirmed —entry.limitwasundefinedfor a metadata-less model), GREEN after the fix.#8849 emits a complete limit for catalog metadata without fabricating onetest intests/unit/cli-helper/config-generator.test.ts, which asserted the old (buggy)limit === undefinedbehavior 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 tolimit: { output: 8192 }.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— cleannpx eslint(suppressions-location config/quality/eslint-suppressions.json) on touched files — 0 errorsnode scripts/check/check-changelog-integrity.mjs— OKNote (out of scope)
tests/integration/opencode-config-startup.test.tsis separately red on this base tip due to an unrelated pre-existing version-pin drift (OPENCODE_VERSION = "1.18.8"hardcoded vs the installedopencode-ai@1.18.18from #10931) — confirmed present onorigin/release/v3.8.50before this branch, not touched here.