Repository navigation
fix: scope Responses ingress id healing to Bili's msg-proxy namespace - #1475
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1404-pr.1475.ed89c82This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1475.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Second-pass verification review of #1475 (fix for #1474) — this PR is from my earlier session on #1474; per protocol I did not redo it but independently re-verified code, base freshness, tests, and CI against live master. ① Original issue (direction) — #1474's attribution is sound and was verified in triage before implementation: ② Regression review (existing behaviors on the touched path) — the only touched behavior surface is
No unintended regressions found. ③ Code review — one added conjunct ④ Test validity — the stale test that pinned the generic rewrite was replaced, not just deleted: (a) byte-identical pass-through asserted via ⑤ Diff cleanliness — 4 files, every line purpose-related: gate (+9/-4 incl. comment), test replacement (+30/-7), devlog REQ/WORKLOG (repo convention). Single linear commit, base = current master Evidence (re-verified locally on head Verdict: ready to merge. 中文摘要:复核了本 PR(把 Responses 入口的超长 id 改写限定到 Bili 自己的 |
7bc5388 to
efd1e46
Compare
…#1474) sanitizeResponsesInputIds rewrote ANY over-64-char input item id to msg-fix-<hashId> regardless of item type, renaming provider-issued opaque ids (reasoning rs_*, function_call fc_*, custom_tool_call, item_reference, compaction) that upstreams with id-shape validation reject with HTTP 400 on every turn. The length rewrite now applies only to msg-proxy-* ids — the exact namespace the #242 healing was written for; everything else crosses ingress byte-identical.
efd1e46 to
5dc12ad
Compare
What changed
sanitizeResponsesInputIds(Responses ingress, called fromprepareResponsesat src/server.ts:3444) rewrote anyinput[]item id longer than 64 chars tomsg-fix-<hashId>without checking item type. Provider-issued opaque items (reasoningwithrs_*ids,function_callfc_*,custom_tool_call,item_reference,compaction) were therefore renamed on every request; upstreams that validate id shape/namespace (e.g. Copilot Responses API: "Expected an ID that begins with 'rs'") rejected the rewritten id with HTTP 400 on every turn (#1474).Fix: the length-based rewrite now applies only to ids starting with
msg-proxy-— the exact namespace #242's healing was written for (pre-hashId round-2 ids embedded the full 54-char upstream id → 66 chars; seedevlog/2026-08-25_responses-id-length). Everything else crosses ingress byte-identical. The existingmsg-proxy-*assistant-message handling (omit local id on full-message replay) is unchanged. No prefix-compliant substitutes (rs_<hash>etc.) are introduced: prefix compliance ≠ acceptance, and renaming breaks identity/replay correspondence (reasoning id ↔encrypted_content).Behavior change (old → new)
input[].id→ rewritten tomsg-fix-*.msg-proxy-are rewritten; all other ids pass through byte-identical.msg-proxymessage ids would no longer be healed. In practice such ids only ever came from old bili versions (allmsg-proxy-*) or from the provider itself, so no real healing case is lost — while provider-owned ids on shape-validating upstreams stop 400ing.Tests
tests/responses-proxy-id-replay.test.ts: replaced the stale boundary/healing test (which pinned the generic rewrite) with two tests — over-64 ids onreasoning/function_call/custom_tool_call/item_reference/compaction/ providermessagestay byte-identical; over-64msg-proxy-*ids keep deterministic, idempotentmsg-fix-*healing with the 64-char boundary preserved.tests/responses-round2-lifecycle.test.ts[Bug] Responses ACP round 2 生成 66 字符 message id,导致 Codex 后续请求持续 400 #242 regression (poisonedmsg-proxy-*rollout) unchanged and still green.Pre-flight on rebased head (master
cae30bb3): typecheck ✅ · full suite 2884 pass / 0 fail / 12 skip (gated e2e) ✅ · build ✅. Real-client E2E auto-runs in CI (diff touchessrc/loop/**).Fixes #1474