Repository navigation
fix(providers): declare explicit OpenCode plugin feature-flag defaults - #8608
Merged
diegosouzapw merged 1 commit intoJul 27, 2026
Conversation
The OpenCode plugin `features` block (opencode.json) marks every toggle
`.optional()` with no default, and the effective value is applied implicitly
at each read site via the scattered `features.X !== false` (default-ON) /
`features.X === true` (default-OFF) convention. An operator who omits the
`features` block therefore cannot tell whether combos / autoCombos /
enrichment are enabled — they read the `autoCombos=0` startup diagnostic
(a count that can be 0 for reasons unrelated to the flags, e.g. missing auth)
and conclude the features are disabled when they are actually on.
Declare the defaults explicitly in one place and surface the effective flags:
- `OMNIROUTE_FEATURE_DEFAULTS` — the declared default state for every boolean
`features.*` toggle, mirroring the existing read-site conventions exactly
(runtime routing behaviour unchanged).
- `resolveEffectiveFeatureFlags(features)` — derives the effective boolean
state for any (possibly-undefined) features object.
- Startup diagnostics now emit a `features(effective): ...` line so an operator
who omitted the block can see combos/autoCombos/enrichment are on.
Purely additive: no read site changes, so the existing
`features: {} → {}` schema pass-through contract is preserved.
Closes cheaper-inference#7624
diegosouzapw
merged commit Jul 27, 2026
685e598
into
cheaper-inference:release/v3.8.49
5 checks passed
Merged
HouMinXi
pushed a commit
to HouMinXi/OmniRoute
that referenced
this pull request
Aug 2, 2026
cheaper-inference#8608) The OpenCode plugin `features` block (opencode.json) marks every toggle `.optional()` with no default, and the effective value is applied implicitly at each read site via the scattered `features.X !== false` (default-ON) / `features.X === true` (default-OFF) convention. An operator who omits the `features` block therefore cannot tell whether combos / autoCombos / enrichment are enabled — they read the `autoCombos=0` startup diagnostic (a count that can be 0 for reasons unrelated to the flags, e.g. missing auth) and conclude the features are disabled when they are actually on. Declare the defaults explicitly in one place and surface the effective flags: - `OMNIROUTE_FEATURE_DEFAULTS` — the declared default state for every boolean `features.*` toggle, mirroring the existing read-site conventions exactly (runtime routing behaviour unchanged). - `resolveEffectiveFeatureFlags(features)` — derives the effective boolean state for any (possibly-undefined) features object. - Startup diagnostics now emit a `features(effective): ...` line so an operator who omitted the block can see combos/autoCombos/enrichment are on. Purely additive: no read site changes, so the existing `features: {} → {}` schema pass-through contract is preserved. Closes cheaper-inference#7624
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
cheaper-inference#8608) The OpenCode plugin `features` block (opencode.json) marks every toggle `.optional()` with no default, and the effective value is applied implicitly at each read site via the scattered `features.X !== false` (default-ON) / `features.X === true` (default-OFF) convention. An operator who omits the `features` block therefore cannot tell whether combos / autoCombos / enrichment are enabled — they read the `autoCombos=0` startup diagnostic (a count that can be 0 for reasons unrelated to the flags, e.g. missing auth) and conclude the features are disabled when they are actually on. Declare the defaults explicitly in one place and surface the effective flags: - `OMNIROUTE_FEATURE_DEFAULTS` — the declared default state for every boolean `features.*` toggle, mirroring the existing read-site conventions exactly (runtime routing behaviour unchanged). - `resolveEffectiveFeatureFlags(features)` — derives the effective boolean state for any (possibly-undefined) features object. - Startup diagnostics now emit a `features(effective): ...` line so an operator who omitted the block can see combos/autoCombos/enrichment are on. Purely additive: no read site changes, so the existing `features: {} → {}` schema pass-through contract is preserved. Closes cheaper-inference#7624
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.
Summary
The OpenCode plugin's
featuresblock marks every toggle.optional()with no default; the effective value is applied implicitly via scattered!== false(default-ON) /=== true(default-OFF) conventions at each read site. Nothing declares these defaults in one place and nothing surfaces the effective flags, so an operator who omits thefeaturesblock can't tell that combos/autoCombos/enrichment are actually enabled — theautoCombos=0startup diagnostic is an unrelated count (0 for reasons like missing auth), which reads as "features disabled".This is purely additive:
OMNIROUTE_FEATURE_DEFAULTS— an explicit default map mirroring the read-site conventions exactly (7 default-ON, 5 default-OFF).resolveEffectiveFeatureFlags(features)— derives the effective booleans for any/undefinedfeaturesobject (returns only the boolean toggle keys, nevermcpToken/logLevel/apiFormat).features(effective): combos=on autoCombos=on …line inwriteStartupDiagnostics.No read-site or schema changes — runtime routing behavior is unchanged, and the existing
parseOmniRoutePluginOptions({ features: {} }) → { features: {} }pass-through contract (tests/features.test.ts) is preserved. This deliberately avoids the issue's "Option C" (Zod.default(true)), which would break that pass-through guard.Test plan
@omniroute/opencode-plugin/tests/feature-defaults.test.ts(6 tests): default map declares each documented default;resolveEffectiveFeatureFlags(undefined)→ full default set; empty{}equals omitted; explicitfalsedisables a default-ON flag while untouched flags keep defaults; explicittrueenables a default-OFF flag; non-boolean sibling keys don't leak. Fails before the fix (symbols undefined on base), passes after.npm test(full plugin suite) → 287/287 pass;npm run build(tsup + DTS) green; plugintsc --noEmitexit 0;eslinton changed files clean.Closes #7624