Repository navigation
[PR] fix(agent): a single-flight-blocked turn must not burn its msgIds - #4863
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.6308-pr.4863.1ec411cThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4863.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…he turn A turn that the guard discards had already claimed its msgIds client-side (all-or-nothing, #4491). The burned ids were never released, so the host's retry of the same turn lost the whole msgIds field and the server pinned those rows to content-derived identity — the exact host/server divergence #4834 just fixed, self-inflicted here by the client lanes themselves. Hoist the #3370/#3378 single-flight guard above planIncrementalTurn in both native lanes (dsh, omp). The guard only reads the pending-ack table, so the reorder changes nothing for the guard itself; planning now only happens for turns that will actually be dispatched. Regression test: a guard-blocked delta attempt must not burn its ids — after the seed acks, the retry still pins msgIds (pre-fix: the field is silently dropped).
opencode-native.ts had the same claim-before-guard order as dsh/omp (planIncrementalTurn with the harvested msgIds at :979, the #3378 single-flight guard below it). A guard-blocked turn burned its harvested ids the same way; hoist the guard above the planning call. alignedMsgIdsForWire() is a pure read of the harvest map, so it is safe to keep inline in the (now post-guard) plan call. Regression test mirrors the dsh one: blocked attempt must not burn the ids; after the seed acks, the retry still pins them (pre-fix: actual undefined).
17f0ed9 to
8457807
Compare
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复——与 #4834 同族(host/server 身份分叉),但机制不同:#4834 根治的是服务端改写抖动,本 PR 修的是客户端自伤入口(plan-before-guard 烧掉已认领的 msgIds)。无重复条目。 标签: bug + dsh/opencode/omp(三条被改车道)+ scope/wiring(协议接线/请求管道)+ p2(静默身份降级、窄触发窗口、无数据丢失)。 独立审核过程(不照抄 issue 结论):我在 master @ 24e71f6 上逐条复核了根因坐标—— 结构化八问
行为变更披露(Deliverables 第 4 条):被拦回合现在少跑 parse/probe/plan 三步——可观测行为零变化(这些产物本来就会被丢弃),特此声明。 验证证据
判定:PR 自身无阻塞项,方向正确、修法打到根因(源头消灭而非补丁回收)、三车道覆盖完整;等继承红消解(e2e 重跑/哨兵收敛)即可合入。 |
…glei#4491/ranxianglei#4834) The doctrine said stable client ids may only ever be join hints. That was written before the plugin lanes started shipping host msgids in a bili-private envelope (msgIds on the incremental turn / biliMsgIds stripped at ingress) and before ranxianglei#4834 made resolution id-first. Agents reading the docs concluded 'we have no msgids' — true on the model wire, false on the plugin lanes. - AGENTS.md KDD ranxianglei#11 retitled to the full hierarchy: msgid first where the envelope carries it (plugin lanes only, never forwarded upstream), order still primary on id-less resend reconciliation, hash stays the per-cell gate. Three-part PK (session_id, msg_id, content_hash) noted as safety belt. - AGENTS.md KDD ranxianglei#13 evolution updated to four stages (hash -> order -> msgid pinning -> snapshot render). - MESSAGE-IDENTITY.md: new section 'The msgid envelope' documenting the channel, all-or-nothing semantics, resync re-claim, ranxianglei#4834 id-first, ranxianglei#4863 claim-after-guard, and the boundary (model wire unchanged, tool-call ids are pairing keys, proxy-mode resends keep the ladder); Future-direction paragraph refreshed.
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.866-master.dd630f1 # this exact build
npm install -g billion-context@master # always the newest merged build
|
这是啥问题
增量车道在"同 URL 还有一笔未确认(ack)请求"时会拦下后续请求(single-flight 守卫,#3370/#3378)。但三条原生车道(dsh、omp、opencode)都是先规划、后拦截:规划动作会顺带在客户端认领这批消息的 msgIds(#4491,全有全无)。被守卫拦下的回合,计划体被丢弃、已认领的 id 却永远不释放——宿主一重试,同一批 id 撞上残留认领,msgIds 字段整体静默消失,服务端只能按内容 hash 铸身份,这批消息的 host/server 身份从此分叉。这正是 #4834 刚根治的改写抖动家族,这里是客户端自伤入口。
不受影响的客户端:Claude Code 走服务端 anthropic 车道(无宿主侧规划、anthropic wire 本身不带逐消息 id);pi 车道的 pending 表按 sid 记、先对账后规划且结果立即使用,无丢弃路径——均已核对。
根因(代码坐标)
src/agent/dsh-native.ts/src/agent/omp-native.ts/src/agent/opencode-native.ts:planIncrementalTurn(内部经incremental-client.tsclaimableDeltaMsgIds的claims.add)跑在守卫扫描之前incremental-client.tsmsgidClaims:只在下次 seed/resync 整组覆盖或__reset时清,被丢弃的计划没有回收路径改动
守卫只依赖 url + 未 ack 表,与计划无关——把守卫整体提到 planIncrementalTurn 之前(三条车道各一块移动,守卫行为零变化);规划只对真正会发出的回合发生。opencode 的
alignedMsgIdsForWire()是纯读取,留在(现位于守卫之后的)计划调用里不变。验证
msgIds: ["u-2"];stash 复核:改动前失败(actual: undefined)["msg_a1","msg_u2"];stash 复核:改动前失败(actual: undefined)关联
#4491(msgIds 机制)#3370/#3378(单飞守卫)#4834(同族身份分叉的根治)