Fix Z.AI coding-plan model remap for GLM-5#223
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
WalkthroughExtracted model-name remapping into a new free function Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
| assert_eq!( | ||
| remap_model_name_for_api("openai", "gpt-4o-mini"), | ||
| "gpt-4o-mini" | ||
| ); |
There was a problem hiding this comment.
Minor test hardening: could add a non-zai-coding-plan case where the model does have a zai/ prefix, to make sure we don’t accidentally strip prefixes for other providers later.
| assert_eq!( | |
| remap_model_name_for_api("openai", "gpt-4o-mini"), | |
| "gpt-4o-mini" | |
| ); | |
| assert_eq!( | |
| remap_model_name_for_api("openai", "gpt-4o-mini"), | |
| "gpt-4o-mini" | |
| ); | |
| assert_eq!( | |
| remap_model_name_for_api("openai", "zai/glm-5"), | |
| "zai/glm-5" | |
| ); |
Summary
Why
zai-coding-plan/glm-5 requests were being remapped to zai/glm-5, which the coding-plan endpoint rejects with Unknown Model. This produced typing/stop-typing with no final response.
Verification
Related context: follow-up extracted from #216.
Note
The fix extracts the model remapping logic into a standalone function and corrects the Z.AI Coding Plan behavior to send plain model IDs (e.g., "glm-5") instead of the provider-prefixed format ("zai/glm-5"). The implementation strips any optional "zai/" prefix before sending to the API. Test coverage verifies both bare and prefixed model names are handled correctly, and that other providers are unaffected.
Written by Tembo for commit eea072a.