Skip to content

Opencodex doesnt recognise context window from the github-copilot provider #3156

Description

@DamnUi

Client or integration

Codex App

Area

Catalog / models

Summary

Recently made the issue where it couldnt recognise model capabilities after more digging its also not receiving its context window i think its becasue OpenCodex’s Copilot parser reads context fields like metadata.limits.max_context_length but your Copilot API sends the correct number at:
capabilities.limits.max_context_window_tokens

Reproduction

ocx start
open codex
try a github-copilot model
/status -> defaults to a 128k context window when models support from 1m to 16k tokens (different models different context window caps)

Version

opencodex 2.39.0

Operating system

macos 26.2 tahoe

Provider and model

github-copilot

Logs or error output

Screenshots and supporting files

No response

Redacted configuration

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. github-actions commented on Sep 1, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: Korean.

  2. Ingwannu commented on Sep 1, 2026

    @Ingwannu
    Owner

    Confirmed on current dev. The shared live-model parser currently reads metadata.limits.max_context_length, metadata.context_length, and several top-level context fields, but it does not read GitHub Copilot's capabilities.limits.max_context_window_tokens. That makes the value disappear before the Codex catalog is built, so the client falls back to its default window.

    I will make the narrow parser fix: read that exact nested numeric field with explicit precedence that preserves the existing recognized metadata fields, reject malformed/non-positive values through the existing integer guard, and add a Copilot-shaped regression proving the routed catalog receives the reported context window. I will keep this scoped to metadata parsing; it will not change provider routing or invent per-model limits.

  3. Ingwannu commented on Sep 1, 2026

    @Ingwannu
    Owner

    The scoped fix is now in #3163.

    It preserves Copilot's capabilities.limits.max_context_window_tokens through the routed catalog while keeping the existing metadata field authoritative and ignoring invalid values. The exact-head regression passes, and the full catalog test file passes 255/255. I am leaving this issue open until the PR is reviewed, exact-head CI is green, and the fix is merged.

  4. lidge-jun commented on Sep 1, 2026

    @lidge-jun
    Owner

    Fixed by #3163, landed on dev as e236c36. The live-model parser now reads GitHub Copilot's context window from capabilities.limits.max_context_window_tokens, with a routed catalog regression in tests/codex-catalog.test.ts covering accepted, conflicting, and invalid payloads. Closing manually because PRs target dev rather than the default branch, so GitHub does not auto-close.

  5. lidge-jun commented on Sep 1, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 66 / 80

    설명

    이 이슈는 GitHub Copilot 제공 모델의 context window를 OpenCodex 카탈로그가 못 읽어, Codex /status 가 보수적인 128k로 떨어진다는 보고입니다. 보고자 추정 원인은 파서가 metadata.limits.max_context_length 등을 보는데, Copilot API는 capabilities.limits.max_context_window_tokens 에 값을 둔다는 것입니다. 버전은 opencodex 2.39.0, macOS, provider github-copilot 입니다.

    지금 HEAD src/codex/catalog/provider-fetch.ts 의 catalogHintsFromModelsApiItem 을 보면 contextWindow는 limits?.max_context_length, metadata?.context_length, item.context_length, item.context_size, item.max_model_len, item.max_context_length, llama.cpp meta.n_ctx 순으로만 모읍니다. item.capabilities.limits.max_context_window_tokens 경로는 없습니다. 이슈 진단과 HEAD가 일치합니다. #2943/#2944 가 Copilot nested supports.vision 은 읽게 했지만, context window 필드명은 다른 축입니다.

    같은 날 PR #3163 이 정확히 그 필드를 읽고, 기존 metadata 우선순위를 유지하며, 비정상/비양수 값은 기존 safe-integer 경계로 거절하고, 수락·충돌·무효 Copilot 페이로드 회귀를 카탈로그 테스트에 넣습니다. types/config 분할 무관합니다. 카탈로그 정확도는 remote hub 다음 체감 항목입니다. 모델마다 16k~1M이 128k로 보이면 사용자가 컨텍스트를 잘못 잘라 씁니다.

    점수는 66입니다. 데이터 평면 구멍이고 수정 PR이 이미 있습니다. #3163과 묶어 닫으십시오.

    경로 src/codex/catalog/provider-fetch.ts catalogHintsFromModelsApiItem - HEAD에 Copilot max_context_window_tokens 가 없습니다. 이슈 주장이 맞습니다
    경로 #2943/#2944 - vision nested 경로만 고쳤습니다. context window와 섞어 닫지 마십시오
    경로 PR #3163 - 이 이슈의 직접 수정입니다
    경로 Codex /status 128k 폴백 - 카탈로그에 창이 없을 때의 보수 기본값입니다. 원인 치료는 파서 필드 추가입니다

    메인테이너의 판단이 필요한 지점

    • Copilot만 특수 처리할지, 다른 제공자의 같은 필드명도 함께 받을지(#3163은 capabilities.limits 일반 조회로 보임)
    • 예전 preview 패키지(2.10.x) 보고와 2.39.0 재현을 같은 이슈로 유지할지

    너의 추천
    #3163을 머지하고 이 이슈를 닫습니다. 추가 설계 이슈로 남기지 마십시오. 라벨은 바꾸지 않습니다.

    이 댓글은 grok-bot이 작성했습니다

    Translated Message

    Original language: Korean

    Review · Priority 66 / 80

    Description

    This issue is a report that the OpenCodex catalog cannot read the context window of the GitHub Copilot-provided model, causing Codex /status to conservatively fall to 128k. The reporter's estimated cause is that the parser looks at metadata.limits.max_context_length etc., but the Copilot API puts the value in capabilities.limits.max_context_window_tokens. Version is opencodex 2.39.0, macOS, provider github-copilot.

    Looking at the current HEAD src/codex/catalog/provider-fetch.ts catalogHintsFromModelsApiItem, contextWindow only collects from limits?.max_context_length, metadata?.context_length, item.context_length, item.context_size, item.max_model_len, item.max_context_length, llama.cpp meta.n_ctx in order. The item.capabilities.limits.max_context_window_tokens path is missing. The issue diagnosis and HEAD match. #2943/#2944 made the nested Copilot supports.vision readable, but the context window field name is a different axis.

    On the same day PR #3163 reads exactly that field, maintains existing metadata priority, rejects abnormal/non-positive values with existing safe-integer boundaries, and adds accept/conflict/invalid Copilot payload regression tests to the catalog tests. types/config split is unrelated. Catalog accuracy is the next felt item after remote hub. If 16k~1M per model appear as 128k, users will incorrectly truncate context.

    The score is 66. It's a data plane hole and a fix PR already exists. Close together with #3163.

    Path src/codex/catalog/provider-fetch.ts catalogHintsFromModelsApiItem - HEAD doesn't have Copilot max_context_window_tokens. The issue claim is correct
    Path #2943/#2944 - Only fixed vision nested path. Don't mix with context window and close
    Path PR #3163 - Direct fix for this issue
    Path Codex /status 128k fallback - Conservative default when catalog has no window. Causal treatment is adding parser field

    Points requiring maintainer judgment

    My recommendation
    Merge #3163 and close this issue. Don't leave as additional design issue. Don't change labels.

    This comment was written by grok-bot

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcatalogModel catalog, slugs, visibility, routed entries

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions