Repository navigation
[PR] fix(#5595): keep fork children sendable when raw-history rebuild emits empty tool-call arguments - #5602
ranxianglei wants to merge 7 commits into
Conversation
…tbound OpenAI wire A fork child whose parent held multimodal/thinking content cannot be textually compared, so adoption degrades to a full raw-history rebuild whose unrecovered tool-call cores serialize as empty function.arguments - a hard provider 400 (InvalidArgument) that compaction/preflight cannot rescue, bricking the child. Enforce the provider contract at the two OpenAI finalize sites (proxy prepare + loop adapter), mirroring MALFORMED_PROXY_TOOL_ARGS_REPLAY: valid arguments pass byte-exact, only empty/non-object JSON is swapped for a parseable placeholder.
When durable storage is legacy-only (json) there are no unified tail rows, so the fork raw-tail reconstruction bails permanently - but it reported the transient 'sidecar-missing' reason, mislabeling a structural gap as a recoverable open failure. Report the actionable cause instead.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10071-pr.5602.78d5419This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5602.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重:不重复,但与在途 PR #5537(镜像 #5540)同机制家族、存在直接代码冲突 —— 先报这个,因为它影响合入顺序:
标签:bug / dsh / scope/wiring / p1(fork 子会话永久不可用 = owner 2026-10-19 修订的「fork 继承被永久放弃」类 p1;车道按报告环境取 dsh)。 CI 状态:head 初审已发现一处需修的小问题(F4): 完整八问结论 + 本地验证结果随后补一条。 |
…rage stamp Review follow-up on 0964efe: inside the !replicasAvailable() branch, liveStorageStamp === "legacy" is always true (the stamp reads legacy whenever the sidecar is absent/disabled), so the previous ternary's else branch was dead code and every unified-configured instance with a down sidecar (3-strike latch, corrupt-index boot-without-index) got stamped "durable storage is legacy-only" — mislabeling exactly the recoverable/ latched cases F4 exists to tell apart. Discriminate on the constructor-time resolution instead: new SessionStore.configuredUnified getter (enabled AND knob tier non-legacy AND no encryption hard-block; the block flag is now stored as a ctor-time field instead of a local const). Structurally legacy-only instances keep the actionable config message; unified-configured instances whose sidecar is down right now keep the #5188 sidecarDownReason() vocabulary. Tests: three store-level pins appended to tests/issue5595-fork-empty-tool-args.test.ts (legacy knob / full with a 3-strike-latched sidecar via the #4942 seam / encryption hard-block), including the conflation assertion itself (live stamp reads "legacy" while configuredUnified stays true).
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Review 结论:可合(等新 head 八问
行为变更披露(旧→新):①出站 OpenAI body 中空/非对象 JSON 的 我补的 commit 合并期协调事项(两条,均不阻塞本 PR 单独成立):
CI:新 head 收工判定:代码与行为审毕,可合;等 c156bc0 CI 绿 + 上述两条协调事项落定(建议 owner 拍板 #5537 合并顺序)。 |
|
(ai: vllm-qwen/qwen3.8-27b) 结论:REQUEST_CHANGES —— 一个阻塞项(CI 红即该问题,非继承红);其余通过。 阻塞发现
修法(选项 A,推荐):删掉 非阻塞发现(已验证,本分支无需动作)
回归审查(diff 触碰路径的既有行为,逐项结论)
八问
合并判定:现状不可合。 按选项 A 回退 adapter 侧守卫后分支其余部分干净——F1+F4 正确、双向测试齐全、覆盖所报复现。选项 B 需 owner 签核(见 🔶 评论)。 |
|
🔶 需要决策 PR #5602(head c156bc0)被卡 diff: 选项:
请裁定 A/B。(Responses wire 同源暴露 |
[bot] 🏷 审核完成 → REQUEST_CHANGES(现状不可合),已走 🔶 决策流。 结论:PR #5602(fix #5595 fork 空 tool-call arguments)有一个阻塞项,其余通过。
投递:完整审核 → PR #5602 评论;🔶 需要决策 评论 + |
…in prepare only Owner review of PR #5602: the hardenOpenaiToolCallArguments call added to the openai LOOP adapter's buildRequest broke #1039's tool-args-verbatim corpus (toolargs-adversarial 'C chat rebuild verbatim': bare empty / whitespace-only / unparseable-truncated args must ride byte-exact). The host re-sends its own history on the loop re-request, so any rewrite desyncs the session (#1039/#1960). Remove the guard from the adapter (loop path stays verbatim); it remains in the proxy-mode prepare path (prepare-openai), which covers this issue's fork-rebuild repro. Replace the now-invalid adapter-heals wiring test with a boundary pin asserting the loop forwards degenerate args verbatim. Builds on bb1b6e0's configuredUnified F4 refinement (kept) and its three F4 store-level pins.
Resolve the single conflict in src/persist.ts (constructor jsonWriterOff block): take master's newer pure-sqlite-default logic (resolveJsonWriterChoice / knobEffectiveJsonWriterOff / knobJsonWriterOffRequested / writerBackendIsSqlite, #6480) and keep the PR's unifiedBlockedByEncryption readonly field (bb1b6e0) as the encryption-block source instead of the pre-merge local const. Closes the merge-conflict blocker on PR #5602 (mirror #5604).
(ai: vllm-qwen/qwen3.8-27b) Merge conflict resolved and pushed. Seven-question summary: 1. What was the problem? 2. What did I do? 3. How was the conflict resolved? 4. What was verified?
5. Any regressions? 6. Any remaining red / inherited issues? 7. Verdict? |
The latched subtest opens a real node:sqlite sidecar via UnifiedShadow.maybeOpen and never released the handle before rmrf. On Windows, unlinking an open index.db is EBUSY, so the tmp-rm retry ladder (9.4s) always exhausts — deterministic red on the windows shard owning this file (PR #5602, job 132676351907). closeQuietly() releases the handle, restoring the #2799/#2908 invariant: no self-handle at rmrf time (same pattern as tests/issue5188-sidecar-recoverable-open.test.ts). Fixes the red 'test (windows-latest, 22, 2)' check on PR #5602.
(ai: vllm-qwen/qwen3.8-27b) Red check fixed and pushed ( 1. What was the problem? 2. What did I do? 3. How was it fixed? 4. What was verified?
5. Any regressions? 6. Any remaining red / inherited issues? 7. Verdict? |
Closes #5595
What
A fork child whose parent held multimodal/thinking content cannot be textually compared, so adoption degrades to a full raw-history rebuild. That rebuild serializes unrecovered tool-call cores as empty
function.arguments, which OpenAI-compatible providers reject with a hard 400 (InvalidArgument:...function.arguments must be a valid JSON object string). Compaction/preflight cannot rescue it — it is a validation failure, not a size failure — so the forked session stays unusable forever.This PR makes the reported bricking go away at the boundary we own, plus fixes a misleading diagnostic on the same path.
Changes
F1 — outbound arg-validity guard (the availability fix). Enforces the provider contract that every OpenAI
tool_calls[].function.argumentsis a valid JSON object string, at BOTH finalize sites where bili assembles the outbound OpenAI body:src/server/prepare-openai.ts(proxy-mode rebuild)src/loop/adapter-openai.ts(compress-loop re-request)New
hardenOpenaiToolCallArgumentsinsrc/util.tsmirrors the existingMALFORMED_PROXY_TOOL_ARGS_REPLAYprecedent (src/loop/core.ts, which already fixes the model-produced non-JSON case): valid arguments pass byte-exact; only empty/non-object JSON is swapped for a parseable placeholder, and one warn line records how many were rebuilt. Wire fidelity holds (§7.3): no legitimate argument bytes change.F4 — name the permanent legacy-storage bail. When durable storage is legacy-only (
storage.unified="legacy"), there are no unified tail rows, so fork raw-tail reconstruction bails permanently — but it reported the transientsidecar-missingreason, mislabeling a structural gap as a recoverable open failure. It now reports the actionable cause.Scope & what is deliberately NOT here
kernel/src/wire/responses.ts, etc.) but were not hit by this report, andprepare-responses.tshas no single convergence point, so host-guarding only some branches would be a partial-coverage trap. The complete all-wires fix belongs in the kernel serializers — human-gated (Kernel Boundary) — and is tracked separately, not bundled here.src/plugin.ts:1264) collides with in-flight PR [PR] fix(plugin-fork): lift the thinking hard gate — thinking sessions can fork (#4266) #4900 (which rewrites that exact line) — deferred to avoid a hot-line conflict.In-flight overlap on the broader "fork adoption fails → child unusable" family: #4900 (thinking gate), #3024 (retryable snapshot), #5126 (false-success receipt), #5538 (oversized rebuild). This PR covers the distinct facets §4.2 (empty-args schema 400) + §4.3 (legacy no-reconstruction diagnostic) uncovered by those.
Verification
npm run typecheckclean (exit 0).tests/issue5595-fork-empty-tool-args.test.ts(8 tests incl. gate-negative byte-exactness + a livebuildRequestwiring test) passes.issue3661-malformed-proxy-args-replay,issue3926-empty-tool-calls,loop-adapters— 52 pass / 0 fail (no regression in the touched adapter/wire path). Full-suite verdict = remote CI on the pushed head.No config surface added/changed. No kernel change. No dependency added.