test: cover copilot model limit precedence
Issue for this PR
Fixes #21564
Related: #31064, #32343
Type of change
- [ ] Bug fix
- [ ] New feature
- [x] Refactor / code improvement
- [ ] Documentation
What does this PR do?
This adds provider-level regression coverage for GitHub Copilot model limit precedence.
The current implementation already has the right behavior: Copilot OAuth model discovery refreshes stale catalog limits, and an explicit user config override still wins after discovery. This PR locks that contract at Provider.list() so future provider merge changes do not regress the 1M+ context cases or user-configured token limits.
The covered cases are:
- Copilot catalog has an existing
gpt-5.5entry, but live/modelsreturns larger limits. - Live discovery projects
context,input, andoutputinto the provider model. - User config can override the live discovered
context,input, andoutput. - OAuth auth is present, so the test exercises the Copilot discovery path instead of the unauthenticated fallback.
- The global fetch stub is restored after each test so other provider tests stay isolated.
How did you verify your code works?
bun test test/provider/provider.test.tsbun test test/plugin/github-copilot-models.test.tsbun test test/provider/provider.test.ts -t "github copilot"bunx oxlint packages/opencode/test/provider/provider.test.tsgit diff --check
bun run typecheck still fails on the current dev tree in packages/core/src/v1/config/migrate.ts because info.limit.context and info.limit.output can be undefined there. This PR does not touch that code path.
Screenshots / recordings
Not applicable. This is provider contract coverage.
Checklist
- [x] I have tested my changes locally
- [x] I have not included unrelated changes in this PR
Thanks for your contribution!
This PR doesn't have a linked issue. All PRs must reference an existing issue.
Please:
- Open an issue describing the bug/feature (if one doesn't exist)
- Add
Fixes #<number>orCloses #<number>to this PR description
See CONTRIBUTING.md for details.
The following comment was made by an LLM, it may be inaccurate:
Based on my search results, I found one potentially related PR:
Related PR:
- PR #32320:
fix: allow partial provider model limits- This PR is closely related as it addresses provider model limit handling, which is the core topic that PR #32365 is adding test coverage for. Both PRs deal with model limit configuration and override logic.
The other results (PR #29354 on per-model limit overrides, PR #20758 on Copilot support, and PR #20491 on Kiro provider) are related to the broader ecosystem but are not direct duplicates addressing the same test coverage need.
The current PR (#32365) appears to be the only one specifically focused on adding regression test coverage for Copilot model limit precedence, so there are no duplicate test PRs found.