Repository navigation
fix: resolve Copilot model context window from /models API - #1541
Merged
Merged
Conversation
Adds OpenSpec change copilot-model-context-window covering the Copilot /models discovery auth fix and the Copilot-shaped context-length resolver branch.
- resolveCopilotModel now decorates the /models discovery request with the Copilot bearer token via createCopilotFetch, so the token is read fresh from memory/auth.json and 401 re-auth is handled consistently. - getModelContextLength now reads Copilot's usable prompt budget (limits.max_prompt / max_prompt_tokens, falling back to limits.context_window / max_context_window_tokens), preferring max_prompt over context_window. - Adds unit tests for the Copilot-shaped resolver response and the Authorization Bearer header on the /models request.
Archives the OpenSpec change and syncs the updated model-context-length and github-copilot-provider specs.
Owner
Author
Audit Results: copilot-model-context-windowGoal Fulfillment
Spec Compliance
Task CompletionAll 6 tasks complete (1.1, 2.1, 2.2, 3.1, 3.2, 4.1). ✅ Quality Check
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves the Copilot model context window from the
/modelsAPI. Two gaps are closed:resolveCopilotModel(src/provider/openai.js) now decorates the/modelsdiscovery request with the Copilot bearer token viacreateCopilotFetch, so the token is read fresh frommemory/auth.jsonand 401 re-auth is handled consistently.getModelContextLength(src/provider/modelInfo.js) now reads Copilot's usable prompt budget (limits.max_prompt/max_prompt_tokens, falling back tolimits.context_window/max_context_window_tokens), preferringmax_promptovercontext_window.The OpenSpec change
copilot-model-context-windowwas proposed, implemented, and archived, syncing themodel-context-lengthandgithub-copilot-providerspecs.Type of Change
Testing
tests/unit/provider/modelInfo.test.js(limits.max_prompt, limits.context_window, max_prompt_tokens, max_context_window_tokens, no-usable-fields).tests/unit/provider/openai.test.jsasserting theAuthorization: Bearerheader on the/modelsrequest.npm run lintclean.npm run coveragemaintained (modelInfo.js 100% lines).Coverage
Checklist
npm run lintpassesCloses #1539