You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
标题生成路由在 v3.5.1 上对所有客户端都永远不会命中(死代码)。
title_routing::client_for_request接收的client来自pipeline::request_source的behavior_client,即core::client::classify()的归类名:core/client.rs:CLIENT_CODEX = "Codex"(大写),classify()对 Codex 系 UA 返回"Codex"、ZCode 返回"ZCode"、claude-cli 返回"Claude Code"config/title_routes.rs:CLIENT_CODEX = "codex"(小写),CLIENTS = [("zcode", …), ("claude-code", …), ("codex", …)],面板保存的规则clients就是这些小写 id两套词汇在函数内三处严格相等比较全部失配:
因此
client_for_request恒返回None:titleRoute恒为 null,[Title]改写日志零条。对照旁证:压缩路由能用,因为compact_routing::client_for_request门卫写死的是 classify 风格的大写"ZCode"。实测证据(OP3T 部署的 v3.5.1):带
x-openai-subagent: thread_title的/v1/responses标题请求(Codex Desktop UA)走普通模型映射返回 200,titleRoute=null;x-codex-turn-metadata、client_metadata.thread_source等四种触发变体全部未命中;网关日志历史零条[Title]改写记录。修复
新增
canonical_client()(小写 + 空白/下划线折叠为连字符),两处统一走归一形态:config/title_routes.rs::match_rule—rule.clients比对前对两侧归一;core/title_routing/mod.rs::client_for_request— Codex 分支判断、ZCode/Claude Code 提示词分支、CLIENTS回查都改用归一后的 id。兼容性设计
validate()/client_label()/ 面板 supported clients 仍只认小写 id,API 契约不变;rules.clients: ["codex"]直接兼容,运行态匹配同时容错"Codex"等写法;classify()输出与配置 id 只差大小写/分隔符即自动命中,无需逐客户端加映射分支。验证
cargo check -p agent2api-server通过(仅既有警告);codex → <标题模型>规则后,携带x-openai-subagent: thread_title的 Codex 标题请求应产生[Title] … 标题生成:source → target日志且请求统计titleRoute非空。