Skip to content

fix(core): accept a partial model limit in legacy provider config - #60291

Closed
craigalbrecht wants to merge 1 commit into
anomalyco:devfrom
craigalbrecht:config-partial-limit
Closed

craigalbrecht wants to merge 1 commit into
anomalyco:devfrom
craigalbrecht:config-partial-limit

Conversation

@craigalbrecht

@craigalbrecht craigalbrecht commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #60290

Type of change

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

What does this PR do?

normalize.migrateProviders decodes each legacy provider with decodeValue(ConfigProviderV1.Info, ...) and returns [] when decoding fails, so a single model that fails validation removes the entire provider and all of its other models.

ConfigProviderV1.Model.limit required both context and output, while the V2 schema makes all three optional. A config that overrides only the output limit — "limit": { "output": 16000 }, a normal V2 shape — therefore failed V1 decoding and silently deleted its provider.

This makes context and output optional in the V1 schema and guards undefined in migrateModel, matching how input was already handled.

Symptom seen in the wild: 3,648 configuration normalization diagnostic warnings over two days, and two providers whose only offending models set limit.output alone — those providers then threw ModelUnavailableError at runtime while their siblings worked.

How did you verify your code works?

A regression test in packages/core/test/config/normalization.test.ts asserts that a provider with one partial-limit model and one full-limit model survives with both models present.

It fails on current dev:

(fail) legacy provider decoding > keeps a provider whose model overrides only limit.output
Received: []          <- the providers array is empty; the whole provider was dropped

and passes with the change:

 42 pass
 0 fail
 354 expect() calls

tsc -b in packages/core is clean. The wider test/config/ suite has two failures (excludes home-level claude…, deduplicates global ecosystem directories…) that fail identically on pristine source because they inspect the machine's home directory — not caused by this change.

Visual

No visual change. This is config normalization: the diff makes two schema fields optional and guards undefined in the migration, so providers decode instead of being discarded.

Screenshots / recordings

N/A — no UI surface.

Checklist

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

normalize.migrateProviders decodes each legacy provider with
decodeValue(ConfigProviderV1.Info, ...) and returns [] when it fails, so one
model that fails validation drops the entire provider and all of its other
models.

The V1 schema required both context and output in limit, while V2 makes all
three optional (schema/config/provider.ts). A config that overrides only the
output limit -- 'limit': { 'output': 16000 } -- is therefore valid in V2 but
failed V1 decoding, silently removing every model in that provider. Observed
on this box as 3,648 'configuration normalization diagnostic' warnings and
providers disappearing at runtime.

Make context and output optional in the V1 schema and guard them in
migrateModel the way input already was.

Regression test asserts a provider survives with a partial limit and keeps
both its models.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 29, 2026
@opencodejr opencodejr Bot closed this Oct 29, 2026
@opencodejr

opencodejr Bot commented Oct 29, 2026

Copy link
Copy Markdown

Thanks for tracking this down and writing up the diagnosis so clearly!

I think this duplicates an existing pull request:

So I'm closing this one in favour of #53129. If you think it's missing something, such as your specific case of a provider with one partial-limit model and one full-limit model, please review it, test it or comment there. The real-world symptoms you saw (the warning counts and the ModelUnavailableError) would be useful context on that pull request and on #53005.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

core: a model that overrides only limit.output drops its entire provider

1 participant