Repository navigation
[Fix] 限制 Responses round-2 重映射 message ID 长度 - #243
ranxianglei merged 4 commits into
Conversation
ranxianglei
left a comment
There was a problem hiding this comment.
Model: qwen3.8-27b (vllm)
Reviewed — the core fix is correct and clean. Reusing the existing hashId() (sha256-16hex) is better than minting a new digest: deterministic, 64-bit collision space, one less new API. Lifecycle references stay consistent through the shared remapped map, and the 54-char fixture + <= 64 assertion covers the regression nicely. (The build-artifact ENEEDAUTH failure is the known fork-PR limitation — npm secrets are invisible to forks — not a code issue.)
One real gap: this prevents new over-long ids but does not heal already-poisoned rollouts. The exact scenario from #242 — a Codex rollout that persisted a 66-char msg-proxy-2-… id and now 400s on every turn — still stays dead, because the poisoned id lives client-side and gets replayed as input[].id before the adapter ever runs. --passthrough doesn't help either.
I had opened #244 with the same root-cause fix plus an ingress healing step: sanitizeResponsesInputIds() in prepareResponses rewrites any input[].id longer than 64 chars to a short deterministic id before the request goes upstream, so a rollout that is currently 400-ing recovers by itself on the next request. Two ways forward, either is fine:
- I push that healing commit onto this branch (maintainer edits enabled) and we close #244 as superseded, or
- This merges as-is and I rebase #244 down to healing-only.
Preference: option 1 — one PR, full fix, your authorship on the root-cause commit.
…#242) Sanitize over-long input item ids before the projection reads them so conversations stuck on 400 recover on the next request. Complements the root-cause fix (hashId remapping) in this branch.
|
Model: qwen3.8-27b (vllm) Added the ingress-healing commit (
Verified on this branch: typecheck ✅, 594/594 ✅, build ✅. #244 closed as superseded — the root-cause fix credit stays with this PR. |
背景
Responses API 的 ACP round 2 会为 assistant message 重映射 ID。原实现将
msg-proxy-${round}-直接拼到上游 ID 前;当 Codex 返回 54 字符的 message ID 时,重映射结果为 66 字符,超过 Responses input item 的 64 字符限制。客户端下一轮回放该 ID 后会持续收到 400。Closes #242
修改
hashId()对上游 message ID(缺失时使用 output index)生成 16 位确定性哈希。msg-proxy-${round}-前缀,最终常规 ID 长度从 66 降为 28。output_item.added、文本 delta、content part、output_item.done引用一致。验证
npm run typecheck:通过npm run build:通过node --import tsx --test tests/responses-round2-lifecycle.test.ts:通过got 66;恢复本补丁后通过npm test:593 项中 591 项通过;上述回归测试通过。另 2 项为本机 Windows 环境既有失败:系统代理使预期的direct变为windows-system,以及临时目录清理偶发EPERM,均不涉及本次修改路径GitHub CI
version-guard通过build-artifact在发布 npm PR 包时失败:fork PR 无法读取上游 npm secret,日志显示NODE_AUTH_TOKEN为空并报ENEEDAUTH;编译阶段本身已通过