Skip to content

fix(core): keep an explicit compatibility block on legacy providers - #55703

Closed
Finn763 wants to merge 1 commit into
anomalyco:devfrom
Finn763:legacy-compat-field
Closed

Finn763 wants to merge 1 commit into
anomalyco:devfrom
Finn763:legacy-compat-field

Conversation

@Finn763

@Finn763 Finn763 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #55652

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Custom providers declared with the legacy V1 shape (provider + npm + options) lost their compatibility block: the v1 provider schema has no compatibility field, so config normalization silently dropped it and every model of the provider reached GET /api/model without it (e.g. a documented compatibility.reasoningField never applied).

  • packages/core/src/v1/config/provider.ts: accept the optional compatibility block on the v1 provider schema (same ProviderCompatibility schema the v2 shape uses).
  • packages/core/src/v1/config/migrate.ts: carry it through migrateStandardProvider; an explicit block keeps its fields and the legacy setCacheKey derivation fills the rest (it still maps to supportsPromptCacheKey as before).

How did you verify your code works?

  • New cases in packages/core/test/config/normalization.test.ts:
    • "keeps an explicit compatibility block on a legacy provider" -- red on the base (block dropped), green after.
    • "merges an explicit legacy compatibility block over the setCacheKey derivation" -- proves the derived supportsPromptCacheKey (from a legacy setCacheKey) and the explicit reasoningField coexist.
  • cd packages/core && bun test test/config/normalization.test.ts -> 38 pass / 0 fail
  • cd packages/core && bun test test/config/provider.test.ts test/config/config.test.ts -> 73 pass / 4 fail; the four failing cases are config.test.ts global-directory discovery, and they fail identically on a clean checkout of dev with this change stashed (pre-existing, unrelated).
  • cd packages/core && bun run typecheck -> clean

Screenshots / recordings

Not a visual change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #52617, #55160

Public API: accepts compatibility on legacy provider.<id> config entries (backwards compatible)

The v1 provider schema had no `compatibility` field, so the block was silently dropped during config normalization and never reached models of `provider`+`npm`+`options` providers. Accept it on the v1 schema and carry it through migrateStandardProvider, merging an explicit block over the legacy setCacheKey derivation.
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I reproduced #55652 on the base: the legacy provider shape returned compatibility: null from GET /api/model. With this change it returns { reasoningField: "reasoning_content" }, the same as the providers shape. With options.setCacheKey: true added, both values are kept. The Azure and Vertex-Anthropic migrations get the block too, because both build on migrateStandardProvider. The config normalization, provider and config tests pass, and typecheck in packages/core is clean.

Public API: the legacy config schema now accepts provider.<id>.compatibility (same shape as providers.<id>.compatibility). It used to be silently dropped. This is backwards compatible. If the block sets supportsPromptCacheKey itself, it takes precedence over options.setCacheKey.

No blocking concerns.

Related: #52617, #55160

@opencode-agent

Copy link
Copy Markdown
Contributor

Thanks for the PR. We're closing it along with #55652: compatibility is a V2-only field, and we don't plan to add it to the legacy V1 provider schema. V1 configs should use per-model interleaved, and new config should use the V2 providers shape.

@opencode-agent opencode-agent Bot closed this Oct 16, 2026
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.

config: legacy provider shape silently drops compatibility for custom provider models

1 participant