fix(copilot): expose only account-available models - #4698
Conversation
ae320e1 to
dba7211
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
Reviewed exact head dba7211ec39a99c12481a77a497ed6f9d68b8a29. I found no P0–P3 issues.
What the diff actually does (7 files, +139/−17, two commits):
packages/runtime/src/model-fetcher.ts— the Copilot discovery filter now admits a model only whenpolicyis absent or exactly{ state: 'enabled' }(isGitHubCopilotModelPolicyEnabled).unconfigured,disabled, malformed, and unknown states are excluded, failing closed. The existing picker, tool-call, and supported-endpoint requirements are unchanged.packages/core/src/llm-connections.ts—reconcileConnectionAfterModelFetchgains anauthoritativeoption: the first account-scoped fetch replaces bootstrap fallback ids with the fetched catalog, and later refreshes keep only user-enabled ids still present in the catalog, so newly introduced models stay opt-in.packages/storage/src/runtime-policy/connection-catalog-document.ts— the single production reconcile call site setsauthoritativeonly forgithub-copilot, so generic providers keep the existing preserve-everything behavior.scripts/release-cli-package.mjs— the production dependency audit retries once on transient 5xx and transport errors; real vulnerability reports still fail closed.
What I checked:
- I read the full diff plus the surrounding reconcile logic, including alias mapping (
supersededModelId) and thehasModelInventoryderivation (previous.models.length > 0; the catalog codec forbids a non-emptymodelsarray before discovery, so the first Copilot fetch always takes the replace-bootstrap branch). - Red-green per layer: with each changed file reverted to the base commit, the new core reconciliation test, the provider conformance matrix, and the storage runtime-policy integration test fail; with the PR applied all three pass. Local results on this head: core 14/14, provider contract matrix 126/126, storage runtime-policy stores 69/69.
- Hosted checks on this exact head are green:
test, four platform addon builds, immutable tarball, four Validate-installed-CLI jobs, and Qualify released State Roots. The Validate-installed-CLI Eval job shows as skipped in a non-required matrix cell. - No database schema change; the reconcile option is call-time only and never persisted.
Two observations, neither blocking:
- When every user-enabled model has been withdrawn but the account catalog is still non-empty, the reconciler force-enables the first catalog entry and moves the default to it (packages/core/src/llm-connections.ts:507, branch at :498). That sits in tension with the adjacent comment that newly introduced models stay opt-in (:502); the counter-argument is that it keeps the connection usable instead of leaving zero enabled models. That trade-off deserves a deliberate product decision at some point.
- An account whose entire catalog is policy-gated now fetches zero models, so a refresh (and onboarding verify) fails with the generic
invalid_responseerror class (packages/runtime-host/src/server/connection-effect-coordinator.ts:158, :195). Failing closed is the right direction; the error just does not tell the user it is a policy or entitlement issue.
Housekeeping: the PR body declares a substantive generative-tool contribution, but neither commit carries a Generated-by: trailer. With the repository's squash-merge message setting, such a trailer would be lost at merge time regardless, which is worth noting for whoever merges.
This is not an approval; the merge decision stays with the human reviewers.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
dba7211 to
22d1e87
Compare
GitHub's model policy has three historical states: enabled, disabled, and unconfigured. Maka cannot accept model policy terms, so exclude every present policy that is not enabled while continuing to admit policy-free current responses. Treat the filtered Copilot /models response as an authoritative account catalog during persistence. The first fetch replaces bootstrap fallback IDs; later refreshes remove withdrawn IDs without automatically opting the user into newly introduced models. Cover the mixed provider payload, authoritative reconciliation, and real Runtime Policy model-fetch commit. Generated-by: gpt-5.6-sol
The required CLI packaging step can receive a five-minute HTTP 503 from npm's advisory endpoint. Retry that existing audit command once for 5xx and common transport failures; vulnerability reports and all deterministic failures remain fail-closed. Keep the fix local to release-cli-package.mjs: no package scripts, dependencies, or workflow changes. Generated-by: gpt-5.6-sol
22d1e87 to
5f0997f
Compare
Resolved and added generated-by |
Title
fix(copilot): expose only account-available models
Description
Summary
GitHub Copilot model discovery could expose models the connected account could not use.
This fixes both sources:
Provider response filtering
enabled.disabled,unconfigured, unknown, and malformed policies are excluded.Catalog persistence
/modelsresponse is treated as the account's authoritative usable catalog.The generic reconciliation behavior for other providers is unchanged: their model lists may be partial, so omitted user-selected IDs remain preserved.
Fixes #4697
Root cause
toGitHubCopilotModelInforejected only:That admitted
unconfiguredmodels even though Maka cannot accept their policy terms.Separately,
reconcileConnectionAfterModelFetchintentionally preserved every previously enabled model. Interactive Copilot connections start with fallback IDs, so models absent from the account response were added back into the projected catalog.Verification
The regressions fail without this change and pass with it:
Checks run:
@maka/core: 782 passed@maka/storage: 1107 tests, 0 failures@maka/runtime: 3176 tests, 0 failuresThe focused regressions and full typecheck/lint/format were rerun after merging the latest
main.AI use
Select exactly one:
Tool(s) and scope: pi with an OpenAI model assisted diagnosis, primary-source comparison against GitHub's Copilot client, implementation, test creation, and verification. The human contributor remains responsible for the change.
Checklist
Does this PR entail a change in behavior?