Repository navigation
[PR] fix(incremental): continue repeated-message identities across delta turns - #5743
mariopasquali wants to merge 0 commit into
Conversation
(ai: vllm-qwen/qwen3.8-27b) 收到,开始审核这个 PR。先给接单结论: 查重: 不重复。 open/closed 全量检索过(关键词: repeated content / canonical ID / cluster counter / cache mark twin):没有其它线程覆盖「增量车道每次 delta 独立转换导致 content-ID 簇计数器归零、重复消息复用旧行身份」这一症状+机制组合。最接近的 #5610(整代缓存命中塌到 1–12%)是不同症状不同机制;#5569(omp advisor 串扰)是会话键控问题,不相关。本线程也没有并列的第二个修复 PR(唯一在途的就是本 PR;它叠在 #5742 之上,#5742 是独立的兼容补丁线程)。 标签: bug / opencode / scope/wiring / p2(缺陷类;回归证据来自 OpenCode V2 车道的滚动缓存标记场景,但修的是共享增量车道;协议接线层而非内核——kernel ID 生成器未动;p2:特定条件触发(增量车道 + 跨回合字节相同的重复消息),后果是缓存标记落错行 + 账本身份碰撞的潜在误引用,不是整体不可用;若后续有生产上缓存命中塌方证据可升 p1)。 审核进行中:已在读 diff( |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 —— 已对 #4599(CI 总控)查重:无既有条目处理本 PR 的红;继承红的根因已有哨兵修复(ci-fixes@0470bec62),按政策不为 CI 问题开新 issue。 标签: bug + scope/ci + p3(CI 继承红,仅内部流水线,零用户影响) 八问
判定:修复已推送(9c3faf3 → 763abe7),等 CI 重跑转绿;#4599 总控已留一行报备(inherited + ci-fixes merged + sha)。两枚 flake 若复现,attempt 2/3 继续。 |
(ai: vllm-qwen/qwen3.8-27b) 审核进展(中间通报,完整八问结论随后): 已完成的核对
先不下结论,等定界证据齐了再发最终审核意见。 |
[bot] 🏷 本轮完成(attempt 1/3):11 个 test 分片全红 = master 继承红(#5656 sidecar residual 的 dsh 回归钉,哨兵修复已在 ci-fixes@0470bec62)+ 两枚已知时序 flake(msgid-lane-flow :139 settle race ×2、wire-exit-matrix abort ×1),与本 PR diff 无关(逐分片扫过日志,21 处红全部映射到上述签名)。处置:merge origin/ci-fixes 进 PR 分支并推送,新 head 763abe7,全矩阵重跑中;#4599 已报备一行。等 CI 转绿;若两枚 flake 复现,attempt 2/3 继续。详细八问见上一条回复。 |
|
(ai: vllm-qwen/qwen3.8-27b) Heads-up: one test-only commit was added to this branch after review (
No product behavior changed. Full review write-up with the eight-question conclusion is in the issue thread (#5741). |
(ai: vllm-qwen/qwen3.8-27b) 审核结论(结构化八问)— PR #5743,head
|
🔶 需要决策 背景一句话:审 #5743 时发现一个与叠层对(#5742/#5743)相关的性能取舍——修好身份碰撞后,「每轮有 mark 就保守失效 serialized-prefix 缓存」的旧逻辑对 rolling-mark 宿主变成了每轮全量重渲。 待决问题:这个精修要不要做、在哪做? 机制(给决策用的一句话): 选项:
我的推荐:B——bugfix PR 保持最小面先行合并;性能精修等数据说话再单开 PR(若数据显示占比可忽略则就此关闭,不浪费调度)。 不决定的默认行为:不动现有代码,#5743 正常走合并流程,此观察作为已知取舍记录在本线程。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI 车道确认:新 head |
|
看起来有问题,这个增量车道不是按照msgid做的吗?怎么变成自己派发id了? |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE — root-cause fix, arithmetic verified against the kernel's id-minting contract, regression test with teeth, clean diff. Extended analysis: linked issue thread (#5741). Structured conclusion below.
What it does. The incremental lane converts each delta turn independently, so anthropicToCore's per-pass content-cluster counter restarts at zero every turn: when the host re-sends byte-identical content (repeated continue prompts), the new row re-derives an ID an acknowledged row already owns, and the new row's cache mark lands on the older twin. continueContentClusters() continues each cluster's ordinal space from the acknowledged prefix (max retained ordinal + 1, sparse/folded-prefix safe), remaps cache marks through the same rename map; resync still starts fresh; client-pinned ids keep precedence (renaming runs before pin validation, claimed-id hard check unchanged). Kernel untouched.
Verified.
- Offset arithmetic matches kernel minting exactly (
h_+ sha256 first-16-hex, duplicate suffix_N; kernel/src/wire/message-id.ts:50-58); the rename is injective (constant per-cluster offset ⇒ cannot create a new collision). - Differential test over all 39 splits of a 40-message corpus: continued prefix+delta ids/marks deepEqual one full conversion; mutation negative control (disabling the continuation) fails the new regression test — the test has teeth.
- Regression audit of touched paths: resync / retouch / msgIds pinning / boundary hash / cold rebuild all preserved; the only behavior change IS the fix (repeated content gets distinct continuing ids, mark on the intended row). Historical sessions' legacy colliding rows are NOT repaired (disclosed in the PR body; out of scope).
- Head
e2fad486cadds one test-only commit fixing a pre-existing structural flake: cross-instance raw byte comparison vs the wall-clocktime="…"attribute embedded in rendered ACP tags (kernel/src/render-refs.ts:72) — strips that attribute only (precedent: the sanctioned normalization clause in #5403/#5418); every other byte still must match.
Procedural notes for the owner merge.
- Stacked PR — the head contains #5742's commits: merging this subsumes #5742 (close #5742 afterwards), or merge #5742 first.
- Branch is currently BEHIND master (
6ddade163, #5700 T1 harvest-stall): no file overlap with this PR; auto-merge should be clean. - Touches message-ref/id logic → §7.4 human-review tier: no auto-merge. CI on
e2fad486cis green (13 success / 17 gated-skip / 0 fail) — ready for the owner to merge. - PR is marked draft — un-draft when ready.
- One non-blocking perf observation is pending as 🔶 需要决策 in-thread (after the fix, rolling-mark hosts pay a full O(n) prefix re-render every marked turn because the coarse
marksVersioninvalidation was designed for the old collision case; options A/B/C with recommendation B = measure-first; default if undecided: ship as-is, zero correctness impact).
中文结构化八问
- 是什么问题:增量车道每轮独立转换 delta,同内容簇计数器每轮从零重启——宿主重发逐字节相同内容时,新消息复用旧孪生行的 content ID,且新消息的 cache mark 落到旧孪生行上。
- 什么原因导致的:跨轮簇状态不连续(delta 转换丢失「该内容在已确认前缀中已出现几次」);根因在增量车道而非 kernel(kernel 对完整历史的铸造是正确的,本 PR 未动 kernel)。
- 影响范围与严重程度:走增量车道的插件宿主(opencode V2 rolling-mark 暴露面最大)+ 跨轮重发相同内容;p2——会话全程可用,后果为 mark 错位→命中率受损、身份碰撞→下游潜在误归属。
- 怎么修复的:delta 参与身份校验前按「前缀保留最高序号+1」续号(稀疏恢复安全),mark 随同一 rename map 迁移;resync 全新转换与客户端钉死 ID 的优先级均不变。
- 是否有回归问题:resync/retouch/pinning/boundary/冷恢复逐项清点保持;唯一行为变更即修复本身(重复内容拿不同 ID + mark 落意图行,已披露);历史碰撞账本行不修(已披露)。测试侧发现一个既有结构性 flake(墙钟 time 属性致跨实例裸字节比较必挂),已由本分支 e2fad48 修掉,纯测试变更。
- 是否破坏缓存:否——修复的是 mark 指向错误的问题;已确认前缀字节从不改写。(性能观察另列决策,非正确性问题。)
- 是否改了设计方向:否——架构/身份层级(msgid>顺序>hash)/两种压缩模式/kernel 均未动。
- 是否引入了新的配置:无。
判定:代码层面可合;按 §7.4 属人工评审层,由 owner 合并(注意与叠层 #5742 的合入顺序)。
(ai: vllm-qwen/qwen3.8-27b) Review lane 完成:GitHub review APPROVE 已提交(head 标签: bug/opencode/scope/wiring/p2 + pr + needs-decision(重判重打:severity 定为 p2——会话全程可用,后果为 mark 错位+身份碰撞潜在影响,与 floor 14 Q3 一致;scope 定为 wiring——缺陷在增量车道协议接线,scope/ci 系 CI 分片协调期的临时标,该工作已在 thread 完结;p3 移除;needs-decision 保留——性能观察 A/B/C 待 owner 裁决,推荐 B)。 无需顺手修项:flake 已由 ci-engineer-r1 在分支内修掉(e2fad48),其余审计未发现可当场修的小问题。剩余事项均为 owner 动作:① 合并(叠层 #5742 的合入顺序 + §7.4 人工评审层 + PR 当前 draft 需 un-draft);② 🔶 性能观察决策(floor 15;不决定的默认行为 = 现状发布,零正确性影响)。 |
…anxianglei#4542/etc (conflict resolution for ranxianglei#5743) # Conflicts: # tests/opencode-rolling-cache-marks.test.ts
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 冲突解决(本轮) 八问:
关于你的问题(msgid vs 自己派发 id) 车道仍是 msgid 优先,这个 PR 没有改那个层级。看
判定:冲突已解并推送(新 head |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 状态更新:冲突已解并推送(merge origin/master bfabcd1 → 新 head |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Re-review of merge commit 21a676891 (absorbs master bfabcd1ca) — APPROVE, verdict unchanged.
Delta vs the previously approved head (e2fad486c):
- The merge pulls in master's recent work (#5540, #4542, #5698 T1 harvest-stall incl. its kernel bump, #5638, #5690, docs, and #5742 itself, which landed on master separately via
9a2d51d65). None of it is this PR's contribution. - The true PR payload vs current master is byte-identical to what I approved:
git diff bfabcd1ca..21a676891= the same 3 files (+110/-1).src/incremental-lane.tsandtests/incremental-content-clusters.test.tsare untouched by the merge (verified byte-equal to the reviewed commits). - One conflict resolution, in
tests/opencode-rolling-cache-marks.test.ts: master'scanonMessages()wall-clock-time masking (the same sanctioned cross-instance normalization, citing #4313/#5471) replaced the branch-sidewithoutTagTime()at all five comparison sites; the old helper is fully removed with no remnants, and both of this PR's regression tests ("repeated prompts retain distinct IDs…", "continued content IDs can be replaced by client pins…") survive and use the shared normalizer. Semantically equivalent (mask-to-constant vs strip, applied symmetrically to both A/B arms). - CI on
21a676891: 18 success / 12 gated-skip / 0 fail (mirror cache, fetched 17:20Z).
Prior procedural notes, updated: (1) the stacking dependency is now moot — #5742 is on master, so merging this PR lands exactly its own three-file diff; (2) the branch is current with master; (3)–(5) unchanged: §7.4 human-tier gate still applies, the PR is still marked draft, and the 🔶 performance observation (marksVersion over-invalidation, options A/B/C, recommendation B) remains open for owner decision.
Full original justification and 八问 stand in review 5787378806.
(ai: vllm-qwen/qwen3.8-27b) 复审完成(第二轮):新 head 本轮变更与判定(八问速览,完整体例见上轮回复):
顺带确认:上轮「#5742 须先合」的堆叠依赖已自然消解——#5742 已在 master( 标签:维持 bug / opencode / scope/wiring / p2 / pr / needs-decision(状态未变,无需改标)。 收工判定:代码与 CI 均就绪,等 owner un-draft + 合并(§7.4 human tier);性能观察走 🔶 决策流,不阻塞合并。 |
…oth seams ranxianglei#5741 redo, per maintainer direction: stop patching the derived-id symptom (content clusters continued across delta turns) and give the lane what it was designed to receive — the host's own session-scoped message ids. What was wrong with the premise: opencode 2.x was assumed to expose no host ids ("weakest of the four host seams"). It does: ctx.session.hook("context") fires immediately before EVERY provider-request assembly carrying the full { id, role, content }[] conversation plus sessionID (verified live on @opencode/cli 2.0.4, anthropic AND openai-compatible providers). V1 keeps its experimental.chat.messages.transform seam as before; both now feed one per-session store. With real ids riding, byte-identical repeated prompts get distinct vouched ids (msg_r1 vs msg_r2), so the server-side pin creates one row per occurrence and the collision class of ranxianglei#5741 disappears at the root. Changes: - opencode-v2.ts: register the "context" hook in createOpencodeV2Setup (shared by V1+V2 hosts; try/catch — hosts without the seam keep the documented id-less degrade; never fail startup over it) - opencode-msgids.ts: deriveEntry now proves BOTH event shapes onto the wire 1:1 with semantic part tokens (text bytes; tool call/result anchored by provider tool-use id, not input bytes; reasoning↔thinking; media↔image); host role "tool" normalizes to wire "user"; bookkeeping parts skip; ANY unrecognized shape still drops the whole field (宁可降级不可错位) - tests/opencode-msgids.test.ts: tool-session end-to-end through the V2 seam, the ranxianglei#5741 repeated-prompt scenario (distinct fresh ids per occurrence), reasoning/thinking alignment, unknown-part and duplicate-id degrade paths Server side needed NO changes: the claimed-set validation and pin remap landed with ranxianglei#5742/ranxianglei#5743 already. continueContentClusters stays as the fallback path for hosts/turns without a usable harvest. Verified: tsc --noEmit clean; opencode-incremental/msgids/rolling-marks, incremental-content-clusters, msgid-pin/algebra/lane-flow, dsh/pi-msgids, incremental-lane, issue5403 fastpath, pins-wire-id-mints all green.
增量车道改用真正的 host 消息 id(#5741 的修法按 owner 指示返工,
|
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI 车道核对返工 head |
… the V2 setup registration list CI fix: setup now registers a second "context" seam (host-id harvest for incremental msgIds) next to http.request, right before ws.handshake and the report-filter loop's own "context"/compaction/title/generate entries.
|
CI 修复($4c8a2b5a):上一版新增的 "context" 采集 hook 让 tests/opencode-native.test.ts:270 的注册表精确断言多了一项,已把期望列表更新为实际顺序(http.request → context(采集) → ws.handshake → context/compaction/title/generate(报表过滤))。三个红 shard(ubuntu-22/24、windows-22)都是这同一个失败,重试确认非 flake。其余 e2e/构建 workflow 在 $2fa9dc47 上已全部绿。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI 车道核对修复 commit |
…ake, ranxianglei#5743 ubuntu-24 shard) msgid lane flow: pin carries client ids... failed at tests/msgid-lane-flow.test.ts:139 with 'an edit lands as a FRESH row' 3 !== 4 on head 4c8a2b5 (run 42218432005). Same signature as the two reds on head 9c3faf3 and PR ranxianglei#5709 — all went green on rerun; sibling subtests and the other ten shards passed here. The store's afterNextFlush verdict is scoped to writes currently queued or in flight, while the lane wrap-up floats behind the ack (ranxianglei#5155/ranxianglei#3798), so the resync's fresh row can settle one flush cycle after the first verdict on loaded runners. Bounded re-probe (four settle cycles, 25 ms spacing > 15 ms debounce) before the strict assert: a row that never lands still fails, just later — no weakening.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI 修复完成(新 head
判定:flake 修复已推送(新 head |
|
(ai: openai-sub2api/gpt-6.1-sol) @ranxianglei Could you review the current head and confirm what remains before this can be marked ready? Conflicts are resolved; CI has 36 passed and 13 skipped checks. The native/WS jobs were skipped in CI. Our local native compression test also fails on unchanged master. Do you need further validation or a decision on the earlier cache-mark performance concern? |
|
Landed via batch PR #6482 (merged) — closing as superseded. |
…oth seams
(content clusters continued across delta turns) and give the lane what it was
designed to receive — the host's own session-scoped message ids.
What was wrong with the premise: opencode 2.x was assumed to expose no host
ids ("weakest of the four host seams"). It does: ctx.session.hook("context")
fires immediately before EVERY provider-request assembly carrying the full
{ id, role, content }[] conversation plus sessionID (verified live on
@opencode/cli 2.0.4, anthropic AND openai-compatible providers). V1 keeps
its experimental.chat.messages.transform seam as before; both now feed one
per-session store. With real ids riding, byte-identical repeated prompts get
distinct vouched ids (msg_r1 vs msg_r2), so the server-side pin creates one
row per occurrence and the collision class of ranxianglei#5741 disappears at the root.
Changes:
- opencode-v2.ts: register the "context" hook in createOpencodeV2Setup
(shared by V1+V2 hosts; try/catch — hosts without the seam keep the
documented id-less degrade; never fail startup over it)
- opencode-msgids.ts: deriveEntry now proves BOTH event shapes onto the wire
1:1 with semantic part tokens (text bytes; tool call/result anchored by
provider tool-use id, not input bytes; reasoning↔thinking; media↔image);
host role "tool" normalizes to wire "user"; bookkeeping parts skip; ANY
unrecognized shape still drops the whole field (宁可降级不可错位)
- tests/opencode-msgids.test.ts: tool-session end-to-end through the V2 seam,
the ranxianglei#5741 repeated-prompt scenario (distinct fresh ids per occurrence),
reasoning/thinking alignment, unknown-part and duplicate-id degrade paths
Server side needed NO changes: the claimed-set validation and pin remap
landed with ranxianglei#5742/ranxianglei#5743 already. continueContentClusters stays as the
fallback path for hosts/turns without a usable harvest.
Verified: tsc --noEmit clean; opencode-incremental/msgids/rolling-marks,
incremental-content-clusters, msgid-pin/algebra/lane-flow, dsh/pi-msgids,
incremental-lane, issue5403 fastpath, pins-wire-id-mints all green.
(cherry picked from commit 2fa9dc4)
805e142 to
2153152
Compare
When each delta is converted independently, the content-identity cluster counter restarts. Repeating a prompt such as
continuereuses an earlier canonical ID, and a cache mark for the new message can also render on its older twin.Continue the derived-ID cluster suffixes from the acknowledged canonical prefix and move cache marks to the resulting IDs. Use the highest retained suffix so a sparse restored prefix cannot collide with a retained occurrence. Resync still starts a fresh conversion. Client-pinned IDs retain precedence through the existing validation and pinning path; the kernel's ID generator is unchanged.
The six-turn repeated-prompt regression fails on the preceding compatibility patch and passes with this change. Differential tests compare IDs and cache marks with full conversion across every split of a 40-message history. Additional cases cover sparse prefixes, preserved payload objects and continuation followed by client pinning. Typecheck, 15 targeted test files (runner reports 144 passed, 0 failed), build and distribution checks passed on commit
9c3faf3cb9d3b7ab2b6d498892c47125cd552f87.This is stacked on #5742, based on commit
a6ea2a0af152c3ea7270e95dbb5e8db4d2f06e60. It does not repair historical migration identity conflicts. No full repository CI or fresh live OpenCode end-to-end result is claimed by these targeted loopback tests.Fixes #5741