Skip to content

fix(responses): omit synthetic input item IDs - #362

Open
SsuJojo wants to merge 3 commits into
aimod-cc:betafrom
SsuJojo:fix/responses-input-item-ids
Open

SsuJojo wants to merge 3 commits into
aimod-cc:betafrom
SsuJojo:fix/responses-input-item-ids

Conversation

@SsuJojo

@SsuJojo SsuJojo commented Oct 26, 2026

Copy link
Copy Markdown

修改

  • 不再为重建的 assistant message 与 function_call input 项伪造持久化 id。
  • 保留 call_id,确保 function call/output 仍正确配对。
  • 增加回归测试覆盖 item id 缺失和工具调用配对。

验证

  • cargo test --manifest-path desktop-tauri/src-tauri/server/Cargo.toml rebuilt_assistant_input_items_omit_ids_and_preserve_tool_pairing 未能完成:测试目标编译时报 E0061 / E0063(provider-loop 测试调用参数与结构字段不匹配);尚未证明这些错误与本 PR 相关。

🤖 本条回复由 AI Agent 生成

Generated by an AI agent.

beta 上的 lib test 目标在 6f47f7f 就已编译不过(与本次改动无关):
- pipeline.rs 的 RequestQuery 初始化缺 client/api_key/production_only/completed_only
- provider_loop/tests.rs 的 send_with_retry 调用少传 telemetry 的 Arc 与 images

只补齐参数与字段,不改生产逻辑。修好之后新增的回归测试才跑得起来。
PR aimod-cc#362 只去掉了 message 与 function_call 的伪造 id,但同一个
push_assistant_items 里还留着最危险的一处:reasoning 项仍用
random_id("rs") 现造 id 去配真实的 encrypted_content。

依据(官方 Responses schema):input 项的 id 一律 optional,FunctionCall.id
写明 "Populated when this item is returned via API",function_call_output
同样 optional;工具配对只认 call_id。所以重建的 input 项本来就不需要 id。

而给带密文的 reasoning 项配一个伪造 rs_ 比不带 id 更糟:严格上游
(官方 store=false)按 item id 查已存项,查不到就整轮拒绝。连续性由
encrypted_content 本体承载,与 id 无关 —— 去掉 id 不影响下一轮接续。

顺带补三条回归测试:reasoning 项无 id 但保留密文、缺 id 时 call_id 仍能
配对、空正文轮次不产生空 assistant message。
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