Repository navigation
fix(providers/transport): 回放的调用名里端点不收的字符换成下划线 - #407
Merged
Merged
Conversation
- 根因:function_call 的 name 是模型写出的字符串,原样存进 session;模型写过一个带冒号的 名字(app::pet_say,回执 [unknown tool])之后,Responses 端点对每次重放都回 400 「Invalid 'input[N].name': string does not match pattern '^[a-zA-Z0-9_.-]+$'」,整个会话卡住。 - 只改出线副本,不看来源、不认前缀:[a-zA-Z0-9_.-] 以外的每个字符换成 _。call_id、回执、 session 记录不动,合法的名字逐字节不变。 - 字符集取上游拒收时报出的那一个。Open Responses 规范给 FunctionCallItemParam.name 的是 ^[a-zA-Z0-9_-]+$ 且最长 64,点号和长度没有被拒的现场,不处理。 - Chat Completions 出口不动:接口文档只给工具声明的名字定了字符集,没有给历史里 tool_calls 的名字定,也没有被拒的现场。 - 测试:历史里有 app::pet_say 的调用和它的 [unknown tool] 回执时,出线的名字合法、call_id 不变、回执仍对得上、记录里的名字没改;修复前这条失败。 Refs Pal-AI-Lab/Coopanion#703 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 12, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refs Pal-AI-Lab/Coopanion#703
问题
function_call的name是模型写出的字符串,原样存进 session。模型写过一个带冒号的名字之后(#703 里是app::pet_say,当时的回执是[unknown tool]),Responses 端点对之后每一次重放都回 400:400 不重试,下一批从同一份记录组出同样的请求,会话不再有回应。
改动
responsesInput()出线时把function_call.name里[a-zA-Z0-9_.-]以外的每个字符换成_。和「别的端点记下的项出线时不带id」在同一处,只改出线副本:app::这类前缀。call_id、回执、session 记录不动;调用和回执仍按call_id配对。docs/providers.md和src/providers/README.md同改。范围
src/protocol/open-responses/openapi.json)给FunctionCallItemParam.name的是^[a-zA-Z0-9_-]+$、最长 64;点号和长度没有被拒的现场,这里不处理。name的历史项只有function_call。history.ts)不动:接口文档只给工具声明的名字定了字符集(tools[].function.name),没有给历史里tool_calls[].function.name定,也没有被拒的现场。验证
app::pet_say的调用和它的[unknown tool]回执时,出线的名字是app__pet_say、call_id不变、回执对得上、记录里的名字没改;带点号和连字符的名字原样出线。去掉修复这条失败。pnpm test、pnpm run typecheck、pnpm run typecheck:web通过。🤖 Generated with Claude Code