Repository navigation
[PR] fix: re-land incremental-turns pull receipt + opencode v1 seam onto master (#3352, #3481) - #3599
ranxianglei wants to merge 2 commits into
Conversation
opencode's v2 http.request hook sees requests but never responses, so an
incremental seed was never acked and every later turn re-seeded — the
feature could never ride for that host. The lane now answers
GET /__bili/plugin/turn?conversation=<id> with { appliedSeq, boundary },
the canonical length plus the wire hash of its last applied wire message
(byte-identical formula to the client helper). Hosts without a response
seam pull the receipt before planning and settle their last unacked turn
ONLY on a boundary match — a cold (null) or foreign boundary is declined
(one decline re-seeds, a streak falls back per #3369). Pulls are always
fresh, never the 30s probe cache.
opencode v1 (fetch patch installed) is wired through beforeSend: bodies
converted in place, marker + turn id stamped atomically (#3370), acks on
the response seam per turn id (#3329); the pull reconcile heals a missed
seam there too. sweepStale moved from the adapter entry to the
single-flight scan — an aged stash is still the reconcile's only record
of the last turn, and sweeping it first forced a resync after every idle
gap.
Stacked on #3340 (turn-id mechanism). Boundary is warm-cache-only by
design; store-rebuilt canonicals never claim one (core-form rows cannot
prove wire parity) — resync re-arms it.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4254-pr.3599.00722dfThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3599.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(bot) 🏷 开始审核本 PR。先交查重结论与已验证的事实,完整八问结论随后。 查重:不重复。 open PR 里没有第二个做同一 re-land 的条目;相关在途工作只有 #3535 / #3529(#3304 follow-up,同文件不同区域)和 #3440(#3433,anthropic-wire-only 守卫)——机制与目标均不同。注意:#3440 也碰 已独立验证(不是转述 PR 描述):
接下来:核对 PR 声称的三个 master 侧语义重叠点(#3511/#3400/#3461)、跑定向测试、看 CI,然后给八问结论。 |
…s gate #3599 review: the re-landed #3481 exported IncrementalReceipt although no module imports it by name (consumers use pullIncrementalReceipt's inferred return type). The CI unused-exports gate classifies it INTERNAL_ONLY and fails the head, which fail-fast-skipped every test lane. Dropping the leading export keeps the type available through the exported signature.
(ai: vllm-qwen/qwen3.8-27b) PR #3599 审核结论(独立审核,不引用 issue 侧结论) ⓪ 独立性:以下所有判断均基于对 diff、master 现状与 git 历史的重新核查,未复用 #3352/#3481 的既有表述。查重已在首楼给出(不重复)。 ① 原 issue 方向(最高优先):#3352 拍板的 dir-2「pull receipt」设计(客户端每轮拉取 lane 权威 canonical 状态,boundary 匹配才结算)本 PR 忠实落地。我先核实了「丢失」本身为真: ② 回归审查(既有行为清点):
③ 代码审查:pull receipt 校验严格(safe integer ≥0、boundary 限定 string|null、任何异常→null);boundary 在 lane 侧对 wire 形态消息计算、客户端同公式( ④ 测试有效性:新测试有牙——跨侧 hash 相等断言(boundary === incrementalWireHash(tail))钉住全设计最关键不变量;冷重建/系统变更下 boundary=null 不可采纳;V2 结算/拒绝/重种三态、V1 seam 转换+盖章+ack-on-response+漏 ack 后 pull 自愈、无 stamp 保持全量重发,均为真实行为断言而非 mock 自证。本地定向跑 6 个相关套件:87 pass / 0 fail,typecheck clean。 ⑤ diff 整洁度:单 commit,+507/-13 八文件,每行都与 re-land 目的相关,无跑题文件、无空行噪音。干净。 CI 发现并已修复(小问题直接修):原 head 热文件协调提醒:除 PR 正文已列的 #3535/#3529,还有 #3440(enforce anthropic-wire-only contract,动 src/incremental-lane.ts + tests/incremental-lane.test.ts)也触碰本 PR 的文件——合并排序需把三者放在一起看。 结构化八问
判定:可合(等当前测试矩阵转绿即可;合并动作留给人工——我不能合并 PR:https://github.com/ranxianglei/billion-context/pull/3599)。合并排序建议:与 #3535/#3529/#3440 协调先后,避免 incremental-lane/opencode-native 上的语义冲突。 |
(ai: vllm-qwen/qwen3.8-27b) CI 唯一红灯已查明: 失败签名与判定
已做的两件事
回归问(第 5 问)更新:windows 分片红灯不构成对本 PR 的回归证据——失败路径与本 PR 触碰的代码无交集,且同代码在本地/master/其他分片三处全绿。其余既有行为清点维持原结论(默认 rollout percent:0 字节级不变、probe 响应纯增量、sweepStale 时序仅在启用后生效、#3511/#3400/#3461 区域核查无交互)。 判定不变:可合(待 attempt 2 矩阵转绿后即为全绿状态);合并动作仍由你执行。热文件协调提醒不变:#3535 / #3529 / #3440 与本 PR 共享 incremental-client.ts / opencode-native.ts / incremental-lane.ts,合并顺序请一并考虑。 |
(ai: vllm-qwen/qwen3.8-27b) 重跑结果:绿。 run 39050206203 attempt 2(仅重跑失败的 windows-22 分片)完成,head 这同时反证了上一轮的判定:同一代码、同一分片配置,重跑即过 → 偶发竞态(已立项 #3616),非本 PR 回归。 收工判定:CI 全绿,审核结论维持——可合。本 PR 两个 commit:
合并动作由你执行;合并顺序请留意热文件协调(#3535 / #3529 / #3440 与本 PR 共享 incremental-client.ts / opencode-native.ts / incremental-lane.ts)。 |
|
(ai: zhipuai-lb/glm-5.3) 孤儿票清理:标题指向的 issue 已关闭,修复已由其他路径落地。关单;误判请 reopen。 |
What this is
Part of the opencode-support umbrella #3594 (gap G1).
PR #3481 ("Incremental turns: pull receipt for hosts without a response seam + opencode v1 wired", single commit 4f01bd1) closed #3352 — but it was merged into PR #3340's branch (
2026-10-16_fix-incr-ack-url-keying), which then merged to master separately. Verified with ancestry checks: merge commit 3736aad is NOT an ancestor of master, so none of #3481's content reached master despite both issues being closed as fixed.Consequence on master @ v0.1.198:
http.requesthook observes requests, not responses) → each turn re-plans as a full-resync resend → the feature yields ZERO savings, exactly Incremental turns give opencode native zero savings in either generation (V1: no divert seam; V2: no response-ack channel) | opencode 原生插件的增量轮次两个版本下都不生效 #3352's reported symptom.This PR re-lands that exact reviewed commit onto current master (cherry-pick of 4f01bd1). No new design: the pull-receipt approach was already approved in #3352 (direction 2) and implemented/reviewed in #3481.
Changes (verbatim from #3481)
src/incremental-lane.ts:GET /__bili/plugin/turn?conversation=<id>now returns{ conversation: { appliedSeq, boundary } }— the warm canonical's length plus the wire hash (sha256(role NUL JSON.stringify(content))[:16]) of its last applied wire message. Boundary is warm-cache-only by design (cold rebuilds report null); a partial store-rebuilt entry is deliberately never cached.src/agent/incremental-client.ts: exportedincrementalWireHash(same formula, must not diverge from the lane) +pullIncrementalReceipt(fresh fetch, 3s timeout, any failure → null = skip incremental this turn).src/agent/opencode-native.ts: V2 adapter pulls the receipt before planning and settles the last unacked turn ONLY on boundary match (mismatch/null declined → one decline re-seeds, only a streak falls back per Incremental lane: one transient failure (5xx/409) permanently demotes the conversation to full resend; built-in recovery hook is dead code | 增量通道:一次瞬时故障(5xx/409)就把会话永久打回全量重发,内置的恢复钩子是死代码 #3369);sweepStalemoved after the reconcile (an aged stash is still the only record of what the last turn sent — sweeping first forced needless resync after idle gaps). New V1 seam:state.beforeSend = maybeIncrementalOpencodeV1on the installed fetch patch — anthropic bodies converted in place, marker + turn id stamped on the same init (dsh 增量轮次:标记竞态可让增量体不带标记直发,模型在无历史状态下静默答错(需开启 rollout 才触发) #3370 atomic), acks ride the existingonResponseper turn id ([bug] incremental turns (#3248): pending-ack maps are keyed by request URL, not conversation id — a late response mis-attributes x-bili-applied-seq to another conversation and kills incremental turns for both #3329), pull reconcile heals a missed seam; installs without plugin stamping stay full-resend.src/server/handle.ts: probe route parses?conversation=.tests/opencode-incremental.test.ts(+186),tests/incremental-lane.test.ts(+70).Rebase notes vs current master
Only textual conflict was CHANGELOG.md ([Unreleased] entries from both sides — kept both, newest-first order preserved). Semantic overlap checked against the three master commits that touched the same files since #3481's base: #3511 (zod opaque specifier, inside V1
server()), #3400 (image rescale arming in handle.ts), #3461 (nudge "gated" self-heal) — all sit clear of the new code paths.Hot-file note: open PRs #3535 and #3529 (both #3304 follow-ups) touch
src/agent/incremental-client.tsandsrc/agent/opencode-native.tstoo. Whichever merges first needs a rebase of the other; the changes are independent regions (direct-send give-up/fallback vs pull reconcile/V1 seam) but please re-read together at merge time.Behavior changes
None by default: rollout feature
pluginIncrementalTurnsstays at 0% (every install byte-identical). When enabled: V2 conversations now actually ride incremental turns (previously seeded once and re-sent full every turn); V1 conversations gain the same capability via the fetch patch. No config surface added, no wire-shape change beyond the additiveconversationsection on the probe response.Verification
Local (targeted, per repo test discipline):
npm run typecheckclean;node --import tsx --test tests/opencode-incremental.test.ts tests/incremental-lane.test.ts tests/incremental-client-recovery.test.ts tests/issue3343-incremental-divert-authz.test.ts tests/opencode-native-v1.test.ts tests/opencode-native.test.ts tests/opencode-v2.test.ts→ 86 pass / 0 fail. Full-suite verdict: remote CI on this head.References #3594 (umbrella), restores #3352 via #3481.