Skip to content

fix(responses): preserve reasoning continuity ids - #333

Open
SsuJojo wants to merge 1 commit into
aimod-cc:betafrom
SsuJojo:fix/responses-reasoning-item-id
Open

SsuJojo wants to merge 1 commit into
aimod-cc:betafrom
SsuJojo:fix/responses-reasoning-item-id

Conversation

@SsuJojo

@SsuJojo SsuJojo commented Oct 24, 2026

Copy link
Copy Markdown

问题 / Problem

127.0.0.1:3065 是 Agent2API;test-cp 通过自定义 provider 再转发到 Codex Proxy。上游以 store:false 返回 reasoning 项时,id 与 encrypted_content 是一组连续性凭据。Agent2API 原先只保留了 encrypted_content,请求和流式回程都会丢弃或重新生成 rs_* id,因此下一轮会得到 Item with id ... not found。

Port 3065 is Agent2API, which forwards test-cp through the Codex Proxy. With store:false, a reasoning item's id and encrypted_content must remain paired. Agent2API previously retained only encrypted_content and regenerated or dropped the rs_* id in both translation directions, causing the next request to fail with Item with id ... not found.

修改 / Changes

  • 在内部 Chat 消息上同时暂存 reasoning item id 与 encrypted content,并在 Responses 出站请求中原样恢复。

  • 捕获 Codex Proxy SSE 中 reasoning 项的 id 和 encrypted content,回传给客户端。

  • 流式 Responses 输出与聚合输出都复用上游 id,只有缺失时才生成随机 id。

  • 继续使用 _wb_ 内部字段前缀,普通 Chat 上游发送前仍会统一剥离。

  • Preserve the reasoning item id together with encrypted_content across Responses to Chat conversion and restore both on upstream requests.

  • Capture reasoning ids and encrypted continuity payloads from Codex Proxy SSE and return them to the client.

  • Reuse upstream ids in streaming and aggregated Responses output; generate a fallback id only when none exists.

  • Keep the _wb_ isolation so internal fields are still stripped before plain Chat upstreams.

验证 / Verification

  • cargo check -p agent2api-server passed (one pre-existing deprecation warning in cloud_sync/auto_sync.rs).
  • git diff --check passed.
  • No UI was used for diagnosis or verification.

🤖 本条回复由 AI Agent 生成

Generated by an AI agent.

@SsuJojo
SsuJojo force-pushed the fix/responses-reasoning-item-id branch from 48798e1 to 2a7886f Compare October 24, 2026 12:28
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