feat(providers): filter GitHub combo members against live catalog - #12473
diegosouzapw merged 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are a few correctness/maintainability follow-ups needed (notably request-scoped caching for repeated live-catalog DB reads and some documentation/formatting fixes) before this is safe to merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR addresses #12137 by reducing wasted GitHub Models combo fallbacks: explicit GitHub-prefixed combo members are now filtered against the active synced (live) GitHub catalog using a fail-open approach when the catalog isn’t authoritative yet. It also tightens GitHub Copilot model discovery to drop models that are chat-capable but not actually routable (policy disabled or hidden from the picker), with unit coverage for those paths.
Changes:
- Add
catalogContainsModel()as a fail-open membership helper for authoritative live catalogs. - Filter GitHub/gh explicit combo members during combo availability prechecks using the active synced catalog (skip only when authoritative + missing).
- Update GitHub Copilot model discovery routing rules to exclude
policy.state != enabledandmodel_picker_enabled === false, with tests.
File summaries
| File | Description |
|---|---|
src/sse/handlers/chat.ts |
Adds GitHub live-catalog membership filtering for explicit combo members inside the combo availability precheck. |
src/lib/db/models/activeSyncedCatalog.ts |
Introduces catalogContainsModel() helper for authoritative catalog membership checks. |
open-sse/services/githubCopilotModels.ts |
Tightens isRoutableChatModel() to exclude policy-disabled and picker-hidden models. |
tests/unit/github-live-catalog-combo-12137.test.ts |
Adds unit tests covering fail-open + prefixed/bare membership behavior. |
tests/unit/github-copilot-model-discovery.test.ts |
Extends discovery tests to assert disabled/hidden models are not advertised. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Memoize GitHub live catalog once per request in isModelAvailable, document policy/model_picker filters on isRoutableChatModel, and reformat long catalogContainsModel assertions. Signed-off-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com>
5222f50 to
1119630
Compare
…github-live-catalog-filter
Move the #12137 GitHub combo live-catalog filter and the combo prefix-override provider guard into a sibling helper so chat.ts stays under the file-size and complexity ratchets. Signed-off-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com> Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
6aa3690
into
diegosouzapw:release/v3.8.51
…egosouzapw#12473) Validado em lote numa worktree combinada com os 10 PRs desta leva sobre o tip de `release/v3.8.51`: `typecheck:core` limpo, `check-file-size` OK e **241/242** nos 29 arquivos de teste que os PRs tocam. A única "falha" não é falha: `tests/unit/autoCombo/strict-zero-cost-filter.test.ts` é um teste em estilo Vitest que eu incluí por engano na invocação do runner nativo do Node — ele quebra no import (`@vitest/runner`), não numa asserção. Ao investigar, descobri que esse arquivo não roda em nenhum dos dois runners hoje (o glob do `test:unit` não lista `autoCombo` e o `include` do Vitest só pega `.tsx` nessa pasta); é um problema pré-existente do repositório, sem relação com esta leva, e vou registrá-lo separadamente. O diegosouzapw#12636 conflitava apenas na lista de testes do `@omniroute/opencode-plugin/package.json`, de forma aditiva: o tip já tinha `models-fetcher.test.ts` (do diegosouzapw#12607, irmão desta mesma leva) e o diegosouzapw#12636 acrescenta `telemetry.test.ts`. Fiz a união dos dois lados (25 arquivos contra 24 de cada) em vez de escolher um, o que teria removido um arquivo da suíte do plugin em silêncio. Obrigado, @RaviTharuma.
Fixes #12137.
Extends checkModelAvailable() with a GitHub-specific live-catalog membership check using the same fail-open pattern as providerWildcard + getActiveSyncedCatalog (empty/unsynced catalog = unchanged). Explicit combo members missing from an authoritative GitHub catalog are skipped.
Also tightens isRoutableChatModel() so policy.state != enabled and model_picker_enabled=false are dropped, with unit coverage on those disabled paths.
Does not touch resolveComboTargets().