Repository navigation
[PR] fix: responses rebuild keeps images when a plain-text user item sits before a multi-part one (#4150) - #4155
ranxianglei wants to merge 5 commits into
Conversation
…ge drop) New judge tests/verif-wire-responses-stability.test.ts over kernel/src/wire/responses.ts (responsesToCore / coreToResponses / patchResponsesInput / normalizeEasyInputItem): - P1 pinned #4150: string-content user item directly before a multi-part (text+image) user item → flushUserRun picks the STRING item as rawCarrier → imageParts=[] → image silently dropped; items also merge. Documented today-broken pin, flips when fixed. - P1b: round-trip without the #4150 shape — user multi-part verbatim (image kept), function pair verbatim, assistant array-content stringified (cross-lane inconsistency with patchResponsesInput, recorded in #4150 comment), trailing user verbatim. - P2 idempotence + input non-mutation of the full codec. - P3 Easy-stamp stability: type-less items stamped {..,type:"message"} from turn 1 — consistent across folds (append-stability of survivors). - P4 fold locality: folding image/text cores keeps exactly the surviving part; no sidecar resurrection of folded parts (#3642 semantics). - P4b anchor semantics: insertions land before surviving anchors. - P5 append-stability of patchResponsesInput under tail growth. - P6 both-parts-folded: slot drops from layout without touching others. Full suite 73/73 green with solver; tsc clean.
flushUserRun took the FIRST sidecar core as THE carrier for a whole multi- core run, so a string-content user item ahead of a multi-part item starved the image cores of their parts (image silently dropped) and the items merged into one. The run now groups by source item (wireIndex, sidecar- identity fallback) and rebuilds each group: full coverage + unchanged bytes => the original item verbatim; partial survival => a filtered view of that item's own surviving parts (images resolved from the group's own item, never resurrecting folded content); text-only split groups without a sidecar synthesize from the cores. Single-core rendering extracted verbatim into flushUserCore (byte-identical). Assistant lane gets the same raw-sidecar verbatim fast path: an array- content item whose text survived unrewritten round-trips byte-exact (shape included) instead of being stringified — closing the cross-lane divergence vs patchResponsesInput's slot.original (#3837 family). Regression suite: kernel/tests/issue4150-responses-split-rebuild.test.ts (issue matrix, cross-image assignment, marker leak, partial folds, rewritten-byte locality, assistant shapes, cross-lane agreement). kernel-change: bugfix in wire/responses.ts rebuild path — image parts lost on outbound reconstruction when a plain-text user item is adjacent to a multi-part one (#4150); owner-approved via issue triage.
P1 was the inverted control while broken (image-drop shape); with the per-source-item grouping landed it asserts deepEqual(STAMPED) again. P1b drops the assistant-stringification expectation — the array-content assistant item now round-trips byte-exact like every other item.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4950-pr.4155.8bb4201This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr4155.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 检索 open+closed issue/PR(input_image、coreToResponses、responses rebuild):最接近的 #3290(工具结果图片上游丢失,机制不同,已关闭)、#3701(WS 1009 体积,已关闭)、#3412(媒体计数,已关闭)、#3676(split 边缘字节漂移而非内容丢失,已关闭),均与「纯文本 user item 紧邻多部件 item 时重建丢图」这一症状+机制不同;无并行修复 PR 在途(#4151 是 judge 钉桩的 stacked base,不是竞争修复)。 标签: bug · codex · opencodev2 · scope/kernel · p2 —— Responses 车道缺陷(codex/opencodev2 宿主),改动在 kernel/src/wire 编解码层;p2:特定消息形状下的功能性缺陷,主代理车道不受影响,非会话丢失/缓存泄露类。 状态:审核进行中,先报一个已顺手修掉的问题。 CI 上 |
(ai: vllm-qwen/qwen3.8-27b) PR #4155 审核结论(独立审核,非复读 issue 侧分析)查重:不重复。检索 open+closed issue/PR(input_image、coreToResponses、responses rebuild):最接近的 #3290(tool-result 图片在上游丢失,机制不同)、#3701(WS 1009 尺寸)、#3412(media 计数)、#3676(split-edge 字节漂移而非内容丢失),均不同症状+不同机制;无并行修复 PR(#4151 是堆叠基座,不是竞争修复)。 标签:bug · codex · opencodev2 · scope/kernel · p2(保留原有 结构化八问
测试有效性(④)新套件 本地定向验证(仅跑窄范围,全量交给 CI):kernel 新套件 7/7、judge 回放测试 9/9、verif-subset-guard 2/2、typecheck + build 干净。全量裁决 = 远程 CI。 顺手修掉的 CI 红(lock-sync,#3782 漂移类)d9110fb 把
CI 状态与 windows 车道 flake 说明CI @ 42f1ccf:除一条车道外全绿(ubuntu×{22,24} 全部 shard、windows/24、以及所有 e2e 工作流:real codex / native dsh·opencode·pi / fake-codex / pi-codex-ws / local-registry / ci-image / codex-persona / build artifact)。唯一失败 合并顺序说明本 PR 堆叠在 #4151(judge-pinning)之上:#4151 先合则本 diff 自动缩小到纯修复;judge 翻转(P1 回到 verbatim 断言、P1b 去掉 stringify 预期)依赖修复落地才成立,所以两者不能颠倒单独合。master 领先 3 个提交仅为 release-notes v0.1.203 critical entry 的陈旧基座产物,无冲突风险(mergeable=true)。 判定可合——全量 CI @ 42f1ccf 已全绿(kernel 层变更按规约由人工执行合并,合并顺序注意 #4151)。修复方向正确、打到根因(载体选择错误而非症状遮蔽)、回归面逐项核过、测试有牙且有跨车道一致性钉。 |
|
(ai: zhipuai-lb/glm-5.3) 陈旧票清理(第三批动作①):issue [4150] 已由已合并 PR [4151] 修复。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。 |
Closes #4150
kernel-change: bugfix in
kernel/src/wire/responses.tsrebuild path — when a plain-text (string-content) user item was adjacent ahead of a multi-part (text+image) item, outbound reconstruction silently dropped the image parts (#4150). Owner-approved via issue triage.What was broken
flushUserRun(multi-core path) took the FIRST sidecar core as THE carrier for the whole run of adjacent user cores. When the leading item had string content,imageParts=[], so image cores resolved toundefinedand were skipped — the model never saw that image again. Cross-item runs also merged into ONE wire item, and full-cover required only a count match against one raw item (stale bytes could be resurrected after text rewrites).Fix
wireIndex(sidecar-identity fallback), each group carrying its own raw item.flushUserCore(byte-identical behavior).patchResponsesInput's slot.original, OpenAI/Codex channel: Per-request body rewriting causes the prefix cache to periodically reset to zero (degenerate foldi | OpenAI/Codex 通道:每请求改写请求体导致前缀缓存周期性归零(退化折叠 foldPoint=m00001 + abort 后 stamped 漂移),单会话 66.7% 计费为全价输入 #3837 family).Behavior changes (old → new)
[text, [text,image]]full rebuild[text,text]/[multipart,text]full rebuildUnchanged: single-core rendering, string-content assistants, rewritten text (ref-tag/demoted-thinking falls back to synthesized form), the patch lane (
patchResponsesInputuntouched), and the main proxy lane (coreToResponsesWithToolImageswraps per-message — zero change there).Coordination
Stacked on #4151 (responses wire judge): this PR flips judge P1 back to the verbatim assertion and drops P1b's stringification expectation. If #4151 lands first, this diff shrinks to just the fix.
Tests
kernel/tests/issue4150-responses-split-rebuild.test.ts(7 tests: issue matrix, cross-image assignment, marker leak, partial folds, rewritten-byte locality, assistant shapes, cross-lane agreement on the full state).verif-subset-guardgreen (wire/responses stays inside the translatable sublanguage); judge test 8/8 green with flipped pins; targeted responses-lane bili batch (76) + toolargs-adversarial (674) green locally; typecheck + build clean. Full-suite verdict = remote CI.