Skip to content

diag(executor): 扩展语义拒绝诊断日志覆盖范围,进一步定位 zhipu [1210] 真因#247

Merged
ThreeFish-AI merged 5 commits into
feature/1.x.xfrom
ThreeFish-AI/sacramento-v1
May 25, 2026
Merged

diag(executor): 扩展语义拒绝诊断日志覆盖范围,进一步定位 zhipu [1210] 真因#247
ThreeFish-AI merged 5 commits into
feature/1.x.xfrom
ThreeFish-AI/sacramento-v1

Conversation

@ThreeFish-AI

Copy link
Copy Markdown
Owner

Summary

PR #244 部署后的诊断日志推翻了原推断 —— 失败请求均不含 thinking/cache_control,说明祸根在更细粒度的参数。本 PR 扩展诊断函数覆盖范围至 system / tools / sampling / metadata / content_types / body_bytes 等维度,并配套 14 个单元测试。

Context

  • 2026-05-25 17:26+ 的诊断日志显示:15 次 [1210] 失败请求均为 messages=1、无 thinking、无 cache_control、tokens=[0 0 0 0] duration<1s,被 zhipu 在入口阶段直接拒绝
  • 实际映射为 glm-5-turbo(用户当前配置 claude-haiku-* → glm-5-turbo),而非先前推测的 glm-4.7
  • 参考 智谱官方错误码:1210 专指「参数格式/类型不符规范」,比 1213/1214 更狭义

Changes

  • src/coding/proxy/routing/executor.py:扩展 _build_semantic_rejection_diagnostic 函数
  • tests/test_router_executor.py:新增 TestBuildSemanticRejectionDiagnostic 类(14 个用例)
  • docs/agents/issue.md:记录 [1210] 问题的诊断阶段进展
  • pyproject.toml / uv.lock:版本号升级至 0.4.1a6

Diagnostic fields added (all optional)

字段 触发条件 用途
system_kind=string(len=N) / system_blocks=N[,cc=K] system 存在 区分 prompt 形态 + cache 标记数
tools=N + tool_choice=... 存在 工具配置
max_tokens / temperature / top_p / top_k / stop_sequences=N 存在 采样参数
stream=true/false + metadata_keys=N 存在 请求模式
content_types={text:5,tool_use:2} content 为 list block 类型分布
body_bytes=N 始终(除非不可序列化) 体积排查

Test plan

  • uv run pytest tests/ → 1478 passed
  • uv run ruff check src/ tests/ → All checks passed
  • uv run ruff format src/ tests/ → 已格式化
  • 部署后观察 [1210] 再次出现时诊断日志,对比失败/成功请求形态找出唯一差异维度
  • 拿到铁证后回归 Step 2 修复方案

在 execute_message 和 execute_stream 的 semantic rejection 日志中
附加请求体参数快照(thinking/extended_thinking/reasoning_effort 顶层参数、
会话历史中 thinking blocks 数量、cache_control 存在情况、模型名、消息数),
用于定位 zhipu glm-4.7 [1210] 参数校验拒绝的具体祸根参数。

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
…t_types 等维度

PR #244 部署后的诊断日志反转了原推断:失败请求均不含 thinking/cache_control,
说明祸根在更细粒度的参数。扩展 _build_semantic_rejection_diagnostic 函数:

新增维度(仅存在时输出):
- system 形态(string/blocks + cache_control 计数)
- tools 数量 + tool_choice 形态
- 采样参数(max_tokens/temperature/top_p/top_k/stop_sequences)
- stream / metadata_keys
- messages.content 类型分布(含 string content)
- 请求体字节数估算(json.dumps)

新增 14 个单元测试(TestBuildSemanticRejectionDiagnostic)覆盖各字段组合
与真实失败请求形态。所有测试通过(1478 passed)。
- pyproject.toml: 版本号取上游 0.4.1a8
- tests/test_router_executor.py: 保留两侧新增的 import 与测试类(TestBuildSemanticRejectionDiagnostic + TestSanitizeUserText + TestExtractSessionTitle)
- uv.lock: 同步版本号并重新生成

🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist)
Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
@ThreeFish-AI ThreeFish-AI merged commit 2af7221 into feature/1.x.x May 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant