Skip to content

feat(provider): add GitHub Copilot context tier - #3282

Draft
Simon-Opopeee wants to merge 5 commits into
lidge-jun:devfrom
Simon-Opopeee:feat/github-copilot-context-tier-dev
Draft

feat(provider): add GitHub Copilot context tier#3282
Simon-Opopeee wants to merge 5 commits into
lidge-jun:devfrom
Simon-Opopeee:feat/github-copilot-context-tier-dev

Conversation

@Simon-Opopeee

@Simon-Opopeee Simon-Opopeee commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add an optional per-model modelContextTiers setting with default and long_context values.
  • Expose the setting in the GitHub Copilot provider UI for every detected or configured model id, not only GPT-5.6 Luna, and through ocx provider edit --model-context-tier.
  • Forward the selected contextTier through both OpenAI Chat Completions and Responses adapters.
  • Advertise the Copilot long-context capability before applying the existing OpenCodex provider cap, so a 400,000-token cap remains the effective catalog window.
  • Preserve the setting across OAuth provider upserts and full provider overwrites.

No credential, OAuth-flow, or unrelated-provider behavior changes are included. Each model defaults to the normal tier; long_context remains explicitly labeled for models that support it.

UI evidence

GitHub Copilot per-model context settings

Codex GitHub Copilot model detection

Compatibility evidence

GitHub documents contextTier as an official Copilot setting with default and long_context values:

This proves the field is not Luna-specific, while the upstream eligibility remains model-conditional. The UI therefore covers every detected/configured id without claiming that every Copilot model accepts long_context; unsupported models stay on default unless an operator explicitly opts in.

Validation

  • bun test tests/github-copilot-context-tier.test.ts
  • bun test tests/cli-headless-parity.test.ts
  • bun test tests/management-provider-validation.test.ts --test-name-pattern 'exposes and persists context-window|hand-edited context|rejects runtime metadata'
  • bun test tests/oauth-upsert-preserves-api-key.test.ts --test-name-pattern 'Copilot|github-copilot'
  • bun test ./gui/tests/provider-settings-live-models-provenance.test.tsx
  • bun run build:gui
  • bun install --frozen-lockfile && bun run build from docs-site/
  • bun run privacy:scan
  • bun run skill:surface:check

The changed-mode sweep also exercised 15,030 tests: 14,909 passed, 10 skipped, and 111 existing environment/platform-sensitive failures outside this feature. The repository typecheck currently stops on pre-existing Bun fetch(..., { timeout }) typing errors in src/server/claude-messages.ts and src/server/responses/fetch-helpers.ts; no feature-related TypeScript error was reported. GUI lint is currently blocked by the repository oxlint plugin loader rejecting the TypeScript local plugin in this environment.

The branch is rebased onto the latest dev (81a1fc1cc) and the current head is 691f338c0.

References

Refs #3281

This is intentionally separate from #3156/#3163, which covered reading Copilot context-window metadata rather than selecting and forwarding the upstream context tier.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the intake: hygiene-blocked Deterministic PR hygiene checks failed label Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ Deterministic hygiene checks failed.

  • unsponsored_surface — This changes an authentication, workflow, release-automation, or dependency surface. MAINTAINERS.md requires security review for these; ask a maintainer to apply maintainer-sponsored once they have reviewed it. Paths: src/oauth/index.ts, src/server/auth-cors.ts.

@github-actions github-actions Bot added the enhancement New feature or request label Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • hygiene: unsponsored_surface.

What to do

  • Fix unsponsored_surface — This changes an authentication, workflow, release-automation, or dependency surface. MAINTAINERS.md requires security review for these; ask a maintainer to apply maintainer-sponsored once they have reviewed it. Paths: src/oauth/index.ts, src/server/auth-cors.ts.
  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ All CI tests are green on my local testing.
  • ⬜ I pushed my PR to the latest dev commit.
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

0/4 boxes ticked.

This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.
@Simon-Opopeee Tick the boxes once your local CI is green, your branch is on the latest dev commit, and every correct Codex and CodeRabbit finding is resolved.

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 58 / 80

이 PR는 이슈 #3281을 그대로 구현한다. GitHub Copilot 쪽에서 모델마다 default / long_context 티어를 고르게 하고, 그 선택을 upstream 요청의 contextTier로 실어 보내며, 카탈로그에는 long tier를 먼저 1,000,000으로 광고한 뒤 기존 OpenCodex provider cap을 적용한다. 지금 dev에는 #3156/#3163으로 Copilot 컨텍스트 창 메타데이터를 읽는 쪽은 이미 있다. 이 PR는 그 위에 “upstream 티어를 선택·전달”하는 조작 면을 얹는 것이라, 이슈가 말한 빈칸과 방향이 맞다. Cursor Private Inference 열차(529639a57)와는 다른 축이라 충돌은 거의 없다.

구성도 한 바퀴 돌린다. 새 src/providers/github-copilot-context.ts가 티어 읽기·바디 주입·카탈로그 창 상한을 맡고, openai-chat / openai-responses 어댑터가 직렬화 직전에 applyGithubCopilotContextTier를 탄다. modelContextTiers는 타입·zod·provider-validation·management PATCH·safeConfigDTO·OAuth upsert 보존(src/oauth/index.ts)까지 연결되어, 로그인 갱신에 설정이 날아가지 않게 했다. CLI는 ocx provider edit … --model-context-tier model=long_context를 반복 플래그로 받고, GUI Providers 설정에 Copilot 전용 셀렉트가 생기며 i18n 8개 로케일이 따라온다. 문서(model-routing, providers-accounts, configuration/providers)와 tests/github-copilot-context-tier.test.ts 등 회귀도 있다. 기능 골격은 merge 후보에 가깝다.

막힌 곳은 게이트와 몇 가지 날카로운 모서리다. hygiene이 unsponsored_surfacesrc/oauth/index.tssrc/server/auth-cors.ts를 인증/관리 표면으로 잡았고, UI screenshot도 없어서 enforce-target이 draft로 붙잡았다. oauth/cors 변경 내용은 티어 맵 보존·검증·DTO 노출이라 비밀/토큰 흐름을 바꾸지는 않지만, 게이트 규칙은 그대로라 maintainer-sponsored 또는 경로 예외가 필요하다. GUI는 GITHUB_COPILOT_MODEL = "gpt-5.6-luna" 한 모델만 하드코딩한다. CLI·설정 맵은 임의 모델 키를 받는데 UI는 Luna만 보여 주므로, 나중에 다른 Copilot 모델이 long tier를 열면 설정과 화면이 어긋난다. 더 중요한 건 어댑터 쪽이다. applyGithubCopilotContextTier는 provider 이름이 github-copilot인지 보지 않고 modelContextTiers만 보면 contextTier를 바디에 넣는다. 타입상 다른 provider에도 같은 필드를 쓸 수 있어서, 실수로 맵을 넣으면 Chat/Responses 공통 어댑터가 낯선 필드를 upstream에 보낼 수 있다. 카탈로그 헬퍼 githubCopilotCatalogContextWindow만 provider 이름을 가린다. 주입 함수도 같은 가드가 있어야 한다.

라인 - src/providers/github-copilot-context.ts applyGithubCopilotContextTier - providerName === github-copilot 가드가 없다. 다른 provider에 modelContextTiers가 있으면 Chat/Responses 바디에 contextTier가 섞일 수 있다.
라인 - gui/.../ProviderSettings.tsx GITHUB_COPILOT_MODEL - UI가 gpt-5.6-luna만 편집한다. CLI/설정 맵은 다중 모델인데 GUI는 한 키만 다뤄 확장 시 어긋난다.
경로/심볼 - hygiene unsponsored_surface - oauth upsert 보존·auth-cors 검증/DTO만 건드렸지만 게이트상 draft. maintainer-sponsored 또는 스폰서 리뷰가 필요하다.
경로/심볼 - UI screenshot 없음 - enforce-target이 screenshot 요구로 실패. Providers 설정 셀렉트 스크린샷을 올리거나 waiver를 받아야 한다.
경로/심볼 - applyGithubCopilotContextTier가 Chat·Responses 공통 경로에 항상 호출됨 - no-op이 대부분이지만 가드 없이 필드만 보면 부작용 면이 넓다. Copilot일 때만 호출하거나 헬퍼 안에서 provider id를 검사하는 편이 안전하다.
라인 - docs / issue #3281 - 이슈·문서·CLI 예시는 Luna long_context + cap 400000 시나리오로 일치한다. 동작 설명은 맑다.

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

  • oauth/auth-cors의 티어 보존·검증을 maintainer-sponsored로 바로 열어줄지, 보안 리뷰 한 바퀴 돌릴지.
  • GUI를 Luna 단일 토글로 둘지, live models 목록 기준으로 모델별 티어 UI로 키울지.
  • modelContextTiers를 github-copilot 전용 필드로 문서·검증에서 강제할지, 범용 맵으로 두고 어댑터만 Copilot에 반응하게 할지.

너의 추천
방향·테스트·문서가 좋아서 #3281 본선으로 가져갈 만하다. 합치기 전에 (1) applyGithubCopilotContextTiergithub-copilot 가드를 넣고, (2) Providers UI 스크린샷을 올린 뒤, (3) 메인테이너가 unsponsored_surface만 스폰서하면 된다. GUI 하드코딩은 Luna만 당장 필요하면 주석으로 “issue #3281 범위”를 남기고, 다음 PR에서 live-model 기반 확장해도 된다. 가드·스크린샷·스폰서 없으면 draft 유지.

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

@Simon-Opopeee
Simon-Opopeee force-pushed the feat/github-copilot-context-tier-dev branch from a3fc5df to 4f7132b Compare September 3, 2026 06:44
@Simon-Opopeee
Simon-Opopeee force-pushed the feat/github-copilot-context-tier-dev branch from 1ff88a7 to 691f338 Compare September 3, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request intake: hygiene-blocked Deterministic PR hygiene checks failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants