[Bug] Stale default model for zai provider (glm-5.1 removed from catalog) silently falls back to outdated glm-4.7 #1679
aniruddhaadak80
started this conversation in
Bug reports
Replies: 1 comment
|
Prepared a reference implementation on my fork, since the vouch gate auto-closes PRs from unvouched accounts. Happy to open the upstream PR the moment a maintainer invites it. Branch: https://github.com/aniruddhaadak80/prime-agent/tree/fix/zai-default-model-glm-5-2 (single commit Changes:
Validation: regression + full |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Area
AI providers and models
Description
defaultModelPerProviderinpackages/coding-agent/src/core/model-resolver.ts:20-53maps thezaiprovider to"glm-5.1", but the generated model catalog (packages/ai/src/models.generated.ts, currentmain) no longer contains anyglm-5.1entry under providerzai. The catalog offers only:glm-4.7glm-5-turboglm-5.2glm-5.2-highspeedglm-5.3Z.AI's direct API catalog has moved on to the 5.x generation (
prime-inference's default isz-ai/glm-5.2, defined atmodel-resolver.ts:17), so the stale reference makes every fallback path that relies ondefaultModelPerProvider["zai"]miss and degrade toproviderModels[0], which isglm-4.7(catalog insertion order). Users silently end up on a much older model than intended, with no warning.Two code paths are affected:
Saved default rebuild (
model-resolver.ts:552-568): when the stored settings default no longer exists in this build's snapshot,buildFallbackModel(model-resolver.ts:157-171) looks updefaultModelPerProvider[provider]as the replacement template. Forzaithat lookup misses, so the rebuild-from-template design ("so it survives updates") fails and the session lands onglm-4.7.Fresh selection with only Z.AI configured (
findPreferredDefaultModel,model-resolver.ts:173-190): the loop finds no match forzai(stale id), falls through every other provider, and the caller returnsavailableModels[0](model-resolver.ts:575) - againglm-4.7for a Z.AI-only user.Note the asymmetry:
vercel-ai-gatewaystill serveszai/glm-5.1, so users migrating from gateway configs to a direct Z.AI API key hit this when their saved id disappears from the direct-provider snapshot.Steps to reproduce
The fallback ordering in
buildFallbackModel(... ?? providerModels[0]) deterministically selectsglm-4.7because it is the firstzaientry inmodels.generated.ts.Expected behavior
The
zaidefault should reference a model that exists in the current catalog (e.g.glm-5.2, matchingPRIME_INFERENCE_DEFAULT_MODEL_ID = "z-ai/glm-5.2", orglm-5.3, the newest available), and fallback should resolve to that generation instead of the oldest entry.Actual behavior
Requests are silently served by
glm-4.7. No warning is emitted;/statusshows the rebuilt/fallback model only if the user inspects it.Prime Agent version
main @ e319a66 (v0.8.0 is latest release)
Environment
Any (catalog data + resolution logic; platform-independent)
Additional context
I first filed this as issue #1676; it was auto-closed by the contribution vouch gate within seconds, so I am re-filing it here per CONTRIBUTING.md's discussion-first process.
Suggested fixes (maintainer's call on target id):
defaultModelPerProvider["zai"]to an existing catalog id (glm-5.2for parity with the prime-inference default, orglm-5.3for newest).defaultModelPerProvidervalue exists under its provider in the freshly generated snapshot, so future upstream removals fail loudly instead of degrading silently.All reactions