Skip to content

fix(providers): declare explicit OpenCode plugin feature-flag defaults - #8608

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
Prudhvivuda:fix/7624-opencode-feature-flags
Jul 27, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
Prudhvivuda:fix/7624-opencode-feature-flags

Conversation

@Prudhvivuda

Copy link
Copy Markdown
Contributor

Summary

The OpenCode plugin's features block 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 the features block can't tell that combos/autoCombos/enrichment are actually enabled — the autoCombos=0 startup 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/undefined features object (returns only the boolean toggle keys, never mcpToken/logLevel/apiFormat).
  • a features(effective): combos=on autoCombos=on … line in writeStartupDiagnostics.

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

  • New @omniroute/opencode-plugin/tests/feature-defaults.test.ts (6 tests): default map declares each documented default; resolveEffectiveFeatureFlags(undefined) → full default set; empty {} equals omitted; explicit false disables a default-ON flag while untouched flags keep defaults; explicit true enables 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; plugin tsc --noEmit exit 0; eslint on changed files clean.

Closes #7624

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
diegosouzapw merged commit 685e598 into cheaper-inference:release/v3.8.49 Jul 27, 2026
5 checks passed
@diegosouzapw diegosouzapw mentioned this pull request Jul 28, 2026
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
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.

fix(providers): OpenCode plugin missing explicit feature flags causing confusion and disabled features

2 participants