Skip to content

fix(core): preserve partial model limits - #53129

Closed
Sinfony8838 wants to merge 4 commits into
anomalyco:devfrom
Sinfony8838:fix-partial-model-limits-53005-review-20261004
Closed

Sinfony8838 wants to merge 4 commits into
anomalyco:devfrom
Sinfony8838:fix-partial-model-limits-53005-review-20261004

Conversation

@Sinfony8838

Copy link
Copy Markdown

Issue for this PR

Closes #53005

Type of change

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

What does this PR do?

Allows individual legacy model-limit fields and keeps omitted fields unset during migration. Partial overrides no longer discard the provider, and unspecified limits retain catalog defaults. Invalid and non-finite values still produce diagnostics.

Related: #32320 addressed the older dev schema and was closed without merging. This fix targets the v2 legacy-config normalization and migration path.

How did you verify your code works?

From packages/core:

  • bun run test test/config/normalization.test.ts test/config/provider.test.ts: 75 passed. The new regressions produced 12 failures before the fix.
  • bun run test test/config: 231 passed, 1 skipped.
  • bun typecheck: passed.

Changed-file lint, Prettier and whitespace checks passed. Root bun run check completed lint/docs checks, then failed on missing console-app dependencies in the filtered local install. The full project test suite was not run.

Screenshots / recordings

Not applicable; configuration logic only.

Checklist

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

Preserve omitted context and output values during legacy model configuration migration.
Keep finite-number validation while allowing context and output limits to be omitted independently.
Cover context-only, output-only, input-only, empty, combined and complete limits, including malformed numeric values.
Verify partial legacy limits match native configuration and only override explicitly configured catalog fields.
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

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

@craigalbrecht

Copy link
Copy Markdown
Contributor

Independent confirmation this is the real-world failure mode, from a config that hit it before I found this PR: five models across two providers set only limit.output. Both providers disappeared from the normalized config entirely, and the only signal was 3,648 warn-level configuration normalization diagnostic lines over two days — nothing said a provider had been dropped. At runtime it surfaced as ModelUnavailableError (and "is not a valid model ID") for every model in those providers, so the failure points at the model catalog rather than at limit.

So this is not schema tidiness: without it a provider either loads or silently vanishes depending on one model's limit shape. Thanks for the broader test matrix — context-only, input-only and empty limits all fail the same way, which my narrower attempt had not covered.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot change the limits of a model

2 participants