Skip to content

[PR] msgid: server-side record on all four wires + GA pin rollout (#6525/#6539) - #6540

Closed
ranxianglei wants to merge 1 commit into
masterfrom
2026-11-13_msgid-server-foundation
Closed

ranxianglei wants to merge 1 commit into
masterfrom
2026-11-13_msgid-server-foundation

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

msgid: server-side record on all four wires + GA pin rollout

One-line: makes the record half of the msgid lifecycle work on every
wire (openai / anthropic / google / responses) and turns the pin rollout
on by default — complementing #6532, which wired the send half for dsh
(openai+anthropic).

Part of the full-lifecycle plan in discussion #6539 (发/记/用, lane-
independent, all protocols). This PR is the server-side foundation: once
any client stamps the biliMsgIds envelope (or the header/harvest seams
deliver ids), the proxy records real host identity into messages.msg_id
on all four wires.

What changed

1. prepare-google.ts / prepare-responses.ts — pin paths (new)
Read + strip the biliMsgIds envelope before anything reaches the real
upstream, then pin behind the same pluginLaneServerHistory rollout gate
as the existing openai/anthropic twins. A length/shape mismatch is
rejected (bail) at the pin — never leaked to upstream, never mis-pinned.
Google/responses have no watermark fast-path, so there is no wpHit skip
(the openai twin skips pinning on watermark hits by design).

2. handle.ts — non-body id sources stamp every wire
A non-body id source (the x-bili-msg-ids header, or loopback identity
harvest) previously stamped the parsed body only on openai/anthropic. It
now stamps on all four, so every pin-consumer sees the ids uniformly.
The harvest path itself still reads parsed.messages (openai/anthropic
shape) — unchanged.

3. rollout.ts — pluginLaneServerHistory 0% → 100% (GA)
Owner ruling 2026-11-13 (see #6539 §6.1): pinned by default. The pin is the
intended end-state of the msgid infrastructure — stamped ids become the
recorded messages.msg_id, so the resolve/settlement/fork consumers read
real host identity instead of content digests. The co-gated
/__bili/plugin/render endpoint stays inert until a client opts in
(no client calls it yet — verified by grep). Roll back with
BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY=0.

4. Three tests updated — they asserted the old default-off contract
(delete env / "default 0% = hidden"). They now force the off state
explicitly (env=0) so they keep testing both gate states under the new
GA default.

Verification

  • npm run typecheck clean.
  • Core msgid + fork + rollout suites green on the master base:
    msgid-rule-parity, msgid-pin, openai-msgid-pin, plugin-render-endpoint,
    msgid-lane-flow, issue5719-msgid-lane-identity, seq-interval-lane,
    cache-proof, responses-ws-http-fallback, dsh-fork-adopt,
    pi-omp-fork-adopt, plugin-fork, identity-harvest — 178/178.
  • google/responses e2e (e2e-google-compress, e2e-responses-chat-relay,
    -mid-developer, -offhead-system) — 17/17 (confirms the new read+strip
    doesn't disturb normal google/responses traffic).

Boundaries / follow-ups (in #6539)

  • Send half for pi/omp/opencode (A2/A3): their pairing walkers exist
    but are routed to the incremental lane only, not the full-resend
    envelope — next slice.
  • dsh on google/responses (A1): needs new google/responses pairing
    walkers (none exist today) — separate slice.
  • Watermark churn (B7): on dsh watermark fast-path turns the pinned
    rows can be retired by digest re-ingest — pre-existing design behavior,
    now the main follow-up to make recorded identity stable across turns.
  • Non-plugin traffic is unaffected (no msgid channel → stays
    content-derived).

Related: #6525 (gap audit), #6539 (full-lifecycle proposal), #6532 (dsh
send), #4491 (pin), #5825 (parity), #5719/#5759 (resolve consumer).

…6539)

Complements the client-side envelope wiring (#6532 shipped dsh openai+
anthropic). This is the 'record' half of the msgid lifecycle made whole
across every wire:

- prepare-google / prepare-responses: read + strip the biliMsgIds envelope
  before it can reach the upstream, then pin behind the same rollout gate
  as the openai/anthropic twins. A length/shape mismatch is rejected
  (bail) at the pin — never leaked, never mis-pinned.
- handle.ts: a non-body id source (x-bili-msg-ids header / loopback
  harvest) now stamps the parsed body on EVERY wire, not just
  openai/anthropic, so the four pin-consumers all see it uniformly.
- rollout: pluginLaneServerHistory 0% -> 100% (GA, owner ruling
  2026-11-13). No client calls the co-gated /__bili/plugin/render
  endpoint yet, so flipping only activates pinning. Roll back with
  BILI_ROLLOUT_PLUGIN_LANE_SERVER_HISTORY=0.

Three tests that pinned the old default-off contract now force the off
state explicitly (env=0) instead of deleting the var.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-13_msgid-server-foundation (61e6624)

Latest build — install this exact version

npm install -g billion-context@0.0.9563-pr.6540.e9ac0f7

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
61e6624 billion-context@0.0.9563-pr.6540.e9ac0f7 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr6540.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

已收编进统一 PR #6564(提案 #6539 一个 PR 落地,用户要求不拆分)。本 PR 关闭;合并留 owner。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant