Skip to content

fix(auxiliary): handle custom glm vision parameter mismatch#26928

Open
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:leon/fix-26827-glm-vision-1210
Open

fix(auxiliary): handle custom glm vision parameter mismatch#26928
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:leon/fix-26827-glm-vision-1210

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes GLM/ZAI vision request compatibility when auxiliary.vision is configured via a custom endpoint (provider: glm + base_url + api_key).

The bug path was:

  • provider resolves to custom
  • _build_call_kwargs only skipped max_tokens for provider == "zai"
  • GLM vision endpoints (bigmodel/z.ai) reject this with 1210 parameter errors

This change extends the same guard to custom endpoints that resolve to bigmodel.cn or z.ai for vision model names, and hardens 1210 retry handling by also dropping temperature on the ZAI-specific retry path.

Related Issue

Fixes #26827

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Updated agent/auxiliary_client.py:
    • _build_call_kwargs now skips max_tokens for vision models when provider == "custom" and base URL host matches bigmodel.cn or z.ai.
    • Sync/async call_llm retry path now strips temperature as well when handling ZAI 1210 parameter errors.
  • Added tests in tests/agent/test_auxiliary_client.py:
    • custom bigmodel/z.ai vision endpoints do not emit max_tokens
    • non-ZAI custom endpoints keep max_tokens

How to Test

  1. Run targeted tests:
    • uv run --with pytest==9.0.2 --with pytest-xdist==3.8.0 --with pytest-asyncio==1.3.0 python -m pytest -q tests/agent/test_auxiliary_client.py -k "TestBuildCallKwargsZaiVision"
  2. Run touched-file lint:
    • uv run --with ruff==0.15.10 ruff check agent/auxiliary_client.py tests/agent/test_auxiliary_client.py
  3. Reproduce with a GLM vision custom endpoint (open.bigmodel.cn/api.z.ai) and verify requests no longer include max_tokens and no longer fail with 1210 due to this parameter.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15.x

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

  • Targeted test output: 3 passed in 3.78s
  • git diff --check: clean

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder tool/vision Vision analysis and image generation provider/zai ZAI provider labels May 16, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Supersedes closed (never merged) PR #19346 which addressed the same GLM/ZAI vision error 1210 root cause. This PR takes a narrower approach (custom endpoint domain matching + temperature stripping on retry) vs #19346's broader endpoint rewriting. Also related to #26827 (upstream issue), #26880 (first-class GLM provider request), #26881 (skip_parameters config).

@cardtest15-coder

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists provider/zai ZAI provider tool/vision Vision analysis and image generation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vision_analyze tool fails with GLM (glm-4v-flash) provider: error 1210 request format mismatch

3 participants