Repository navigation
[PR] fix(opencode): acknowledge V2 turns and preserve rolling cache marks - #5742
Conversation
…decar residual (ranxianglei#4599) 01fcc5d (ranxianglei#5656/ranxianglei#5584, merged via ranxianglei#5687) diverts tool-less dsh single-shot requests onto the verbatim side lane (kernel no-touch); the residual for main turn 1 is documented in the commit's own comment. Five pre-existing pins assumed turn 1 rides the full pipeline and went born-red at merge (master red since; every PR head inherits it). Test-only realignment codifying the documented behavior: - issue2419/2446/2447/2481 guard-stamp subtests: two turns; the BLOCKED ref is witnessed on the first FULL-PIPELINE turn (turn 2). No fold can happen before turn 2 (nothing compressible, no action surface), so protection against every possible fold is unchanged. - issue2817: stats.requests off by one (turn 1 uncounted); the persona-fold teeth are intact, assertions shifted -1. - issue5403 A/B golden: turn 0 rides the side lane in BOTH phases (the gate ignores the rollout env), so rb[0] is unstamped by design; stamps resume at turn 1. Byte equality holds at i=0 (both phases forward verbatim). No src/, kernel/, config, or version changes. Locally green: all six files + side-lane-invariants + issue5656-single-shot-sidecar + dsh-persona-fingerprint.
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 检索了 open+closed 的 issue/PR:没有其他条目针对 OpenCode V2 增量车道的 ack 丢失或滚动 cache mark 触发全量 resync。最接近的在途 [PR] 行 "fix(incremental): continue repeated-message identities across delta turns" 是不同机制(重复消息的 msgid 身份延续,不是 ack 归因/装饰对齐)。PR 正文引用的 credential-forwarding 修复已合入 master(base 包含它,未重复搬运)。本 PR 的目标 issue 即其来源 issue,符合一 issue 一 PR。 标签: 审核进行中:已拉取分支(单提交 |
(ai: vllm-qwen/qwen3.8-27b) 七问(CI 修复轮)1. 什么红了? 全部 11 个 test 分片(windows-22 ×5、ubuntu-22 ×3、ubuntu-24 ×3),head 2. 什么原因? 不是本 PR 的代码——是继承性失败:master( 3. 继承还是自引入? 继承,本地 A/B 钉死:同一棵 built 树上,裸 master 精确挂其中 3 枚(2446/2447 guard-stamp + 2817),merge ci-fixes 后 5 枚全绿;本 PR 新增的 rolling cache_control 等测试在 CI 里全过(如 ok 2375–2382)。抽了三个平台分片日志(ub22-s1 / win22-s1 / ub24-s3),失败集合 = 且仅是上述 dsh pin,无任何其他失败。 4. 怎么修的? 把 5. 回归风险? 无。ci-fixes 只改 5 个测试文件(钉对齐),不碰 src/kernel/wire/config;本 PR 行为面不变。 6. 现在状态? 新 head 7. 残留? master 本身仍红(同家族),路线 A/B 决策在 #5722(ci-fixes 暂留 A)。本分支已含 re-pin 提交 0470bec——若 B(#5709 源收窄)先落地,按舰队惯例由哨兵统一清扫,本 PR 无需单独动作。已在 #4599 留一行记录(PR #5742 红,已 merge ci-fixes,sha=b7f6e0bfd)。 |
[bot] 🏷 CI 修复收工确认:本 PR 的 11 个红 test 分片为继承性失败(master 自身红的 #5656 sidecar 残留家族,五枚 dsh 回归钉),非本 PR 代码问题——本地 A/B 已钉死。已将 结果:新 head 全量 CI 已绿(0 failed / 0 pending),PR 可合并,等人工合并。已在 #4599 留一行协调记录;详细七问见上一条回复。无需决策、无新增 issue。 |
…ing-cache A/B comparisons Review fix on top of a6ea2a0. The new suite's byte-exact A/B assertions compared raw rendered history across two separately-run arms; ranxianglei#4313 message timestamps are on by default and each arm's kernel renders carry that arm's first-sight wall clock in time="..." attributes, so 8/10 tests failed deterministically whenever the arms crossed a second boundary (they always do). Apply the same normalization tests/issue5403-watermark-fastpath.test.ts already sanctions (ranxianglei#5471): mask only the time attribute before comparing. Product code untouched; with this, 10/10 pass standalone.
(ai: vllm-qwen/qwen3.8-27b) PR #5742 审核结论(独立复审,非复读 issue)查重:不重复(首条已报)。标签:bug / opencodev2 / scope/wiring / p2。 结构化八问1. 是什么问题 2. 什么原因导致的 3. 影响范围与严重程度 4. 怎么修复的 5. 是否有回归问题(逐项审过既有行为)
6. 是否破坏缓存 7. 是否改了设计方向 8. 是否引入新配置 测试有效性 + 一处已在分支上修掉的缺陷A/B byte-exact 对比、精确 mode 序列断言(含 验证状态与判定
判定:方向正确、代码质量达标、测试缺陷已就地修复 → 建议 CI 在 |
…msgid-lane-flow settle flake (3!==4, green locally 6/6; see ranxianglei#4599)
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1043-master.9a2d51d # this exact build
npm install -g billion-context@master # always the newest merged build
|
…anxianglei#4542/etc (conflict resolution for ranxianglei#5743) # Conflicts: # tests/opencode-rolling-cache-marks.test.ts
…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.
…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)
OpenCode V2 uses
http.requestto divert incremental turns, but an attached proxy has no fetch interceptor to collect their acknowledgement. Registerhttp.responseand correlate its acknowledgement with the outgoing request's turn-id header. This lets the next turn send a delta.OpenCode also moves its ephemeral cache marks as the conversation grows. Including those marks in prefix alignment makes unchanged history look edited and forces a full resync. Align content separately from its cache decoration and carry validated mark updates for acknowledged wire messages. The server replaces their marks and opaque-block decorations, preserving signatures, tool arguments and media bytes.
The optional
retouch: [{ index, message }]envelope is sent only when the capability probe explicitly advertisescacheControlRetouch: true. Without that advertisement, a moving mark keeps the original full request. Unknown/cold wire spans or changed payloads return HTTP 409 before applying the delta; the existing resync path recovers. The extension is documented inPLUGIN.mdand adds no storage schema or configuration setting. Marks also follow client-pinned IDs instead of being left keyed by discarded derived IDs.Validation:
a6ea2a0af152c3ea7270e95dbb5e8db4d2f06e60.The credential-forwarding fix from PR #5661 is already in the base and is not duplicated. These are loopback adapter/proxy tests; fresh live OpenCode 2.2 end-to-end qualification and production rollout are separate. The change reduces resends, without claiming to eliminate the server's whole-history processing cost.
Fixes #5740