Skip to content

fix(protocols): match the z.ai profile's GLM-5.3 family and effort sets to the vendor - #2657

Merged
slin1237 merged 1 commit into
mainfrom
fix/zai-profile-family-and-efforts
Sep 23, 2026
Merged

slin1237 merged 1 commit into
mainfrom
fix/zai-profile-family-and-efforts

Conversation

@hello-alexmcc

@hello-alexmcc hello-alexmcc commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Problem

From the review of #2634 (verified live on the served id glm-5.3-flash, where reasoning_effort: none → 400 already works): two gaps against the measured vendor behaviour.

  • GLM53_MARKERS matched glm-5.3 / glm5.3 / glm_5.3 only, while the multimodal registry (registry/glm53_flash.rs) also treats dash-spelled ids such as glm-5-3-flash as the same family, so a checkpoint served under that spelling got the wider rules.
  • z.ai rejects unknown reasoning_effort values on the other GLM generations too (turbo → 400), while the profile accepted anything there.

Solution

The 5.3 markers gain glm-5-3 / glm5-3. Effort validation takes an allowed set per generation: low|high|max on the 5.3 series, the set docs.z.ai documents (none|minimal|low|medium|high|xhigh|max) elsewhere, unknown values a 400 in both. Deliberately not done: pinning GLM-5-Next to the enabled-only rules, which the write-up asked for by analogy with the registry's media grouping; its thinking contract is not recorded, and the registry says nothing about thinking. The module header describes the rules as they are and states the file_url decision (refused at ingress on every backend: the vendor fetches the file, no self-hosted engine does, and validation runs before the backend is known).

Test Plan

  • profile::zai::tests::glm53_thinking_rules_do_not_reach_other_generations: dash-spelled ids are 5.3, GLM-5-Next and glm-5.30 are not; GLM-5.2, GLM-5 and GLM-4.6 keep disabled and none while turbo / ultra are rejected.
  • cargo test -p openai-protocol: 347 passed, 0 failed. cargo +nightly fmt --all -- --check clean; cargo clippy -p openai-protocol --all-targets -- -D warnings clean.
Checklist
  • cargo +nightly fmt passes
  • cargo clippy --all-targets -- -D warnings passes
  • (Optional) Documentation updated
  • (Optional) Please join us on Slack #sig-smg to discuss, review, and merge PRs

…ts to the vendor

The GLM-5.3 markers now cover the dash-spelled ids the multimodal
registry already treats as the same family (glm-5-3-flash), and the
other GLM generations take the effort set docs.z.ai documents for them
and reject the rest, as the vendor does (turbo is a 400 there too).
GLM-5-Next is deliberately not pinned to the enabled-only rules: its
thinking contract is not recorded. The module header describes the
rules as they now are and states the file_url decision.

Signed-off-by: Alex McC <319643551+hello-alexmcc@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: f67ceb77-0824-4a2e-bb74-d7ccd4c4e23b

📥 Commits

Reviewing files that changed from the base of the PR and between dceb98c and 0b22f56.

📒 Files selected for processing (1)
  • crates/protocols/src/profile/zai.rs

Limit details: You’ve used all 6 included reviews currently available. Your 46 included PR review attempts over the past 7 days set your current allowance at 6 reviews per hour.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Updated validation for GLM-5.3 thinking and effort settings, including additional model name spellings.
    • Effort validation now distinguishes GLM-5.3 options from those supported by other GLM generations.
    • Both effort setting fields are checked against the appropriate options.

Walkthrough

The Z.AI profile now recognizes additional GLM-5.3 model spellings and validates effort values using separate sets for GLM-5.3 and other generations. Tests cover the added spellings and rejection of unsupported effort values.

Changes

Z.AI profile validation

Layer / File(s) Summary
Model matching and effort validation
crates/protocols/src/profile/zai.rs
The profile recognizes additional GLM-5.3 spellings. It applies the low, high, or max effort set to GLM-5.3 and the broader documented set to other generations. Tests cover unsupported values and model spellings. The module documentation describes the reference model and generation-specific rules.

Estimated code review effort: 2 (Simple) | ~12 minutes

Merge Risk: ⚪ Minimal · up to 0b22f

The updated model matching and effort validation are ready to merge after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main changes: matching the z.ai GLM-5.3 family and aligning effort validation with vendor behavior.
Description check ✅ Passed The description directly explains the GLM-5.3 matching changes, per-generation effort validation, excluded GLM-5-Next behavior, and test results.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

@github-actions github-actions Bot added the protocols Protocols crate changes label Sep 23, 2026
@claude

claude Bot commented Sep 23, 2026

Copy link
Copy Markdown

👋 The PR description doesn't fully follow
PULL_REQUEST_TEMPLATE.md:

  • Missing header: ## Changes

Please update the PR description so reviewers have the context they need.

Comment thread crates/protocols/src/profile/zai.rs
Comment on lines +409 to +416
// The documented set is wider than GLM-5.3's, but still a set.
for effort in ["turbo", "ultra"] {
assert_eq!(
validate(&with_model(model, json!({"reasoning_effort": effort}))),
Err("reasoning_effort_not_allowed".into()),
"{model} {effort}"
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Nit: The wider documented set is only positively exercised through none (line 405). If an entry of REASONING_EFFORTS were dropped or misspelled (e.g. xhigh), no test would catch it. A cheap loop over ["minimal", "medium", "xhigh"] (or the whole constant) asserting Ok(()) here would pin the accepted set the same way the rejected one is pinned.

@slin1237
slin1237 merged commit 3d0c0d1 into main Sep 23, 2026
26 of 45 checks passed
@slin1237
slin1237 deleted the fix/zai-profile-family-and-efforts branch September 23, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

protocols Protocols crate changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants