Skip to content

[PR] fix: watermark fastpath (plugin full-resend watermark fastpath) silently disabled by input release mutation | fix: 水印快路径(plugin full-resend watermark fastpath)被输入释放改动静默禁用 - #6640

Merged
ranxianglei merged 1 commit into
masterfrom
fix/watermark-fastpath-input-release
Nov 14, 2026

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

现象

openai 线上的插件全量重发水印快路径(#5403/#5418)完全不再生效:每轮请求都在做全量重解析+重哈希(内存驻留回归),且没有任何报错——快路径静默失效。仓库自己的 A/B 钉测试(tests/issue5403-watermark-fastpath.test.ts,#5418 A/B byte-equality + residency band)在 master 上是红的。

根因

#4753 的输入释放(src/server/handle.ts:bodyText = undefined,在转发前释放原文省内存)把原文在水印快路径的判定之前扔掉了。快路径的 gate(src/server/prepare-openai.ts:135 bodyText !== undefined && pluginMode && !isTitleGen && featureEnabled(...))从此永不成立——prepareOpenai 收到的 bodyText 恒为 undefined。

修复

handle.ts 只在快路径不可能触发的切片上释放原文(非 openai 线或 flag 关闭);prepare-openai 里的严格 gate(pluginMode + !titleGen)仍是唯一裁决者,不重复判定逻辑。另外把 A/B 钉测试的 turn 0 改成真实 sidecar 形状(4K 预算):#5687 已把 dsh 单次 sidecar 的区分条件从"无工具"改为 sidecar 预算(≤8192),测试里 64K 的无工具 turn 0 现在(正确地)是主回合,原断言过时。

验证

  • tests/issue5403-watermark-fastpath.test.ts:修复前红(B stamp 1: measured wire total — null !== 4),修复后绿
  • tests/request-input-lifetime.test.ts 6/6、tests/fastpath.test.ts 19/19 全绿
  • tsc 无类型错误

同一修复已以 09577a2 直接补进 release 分支 2026-11-13_release-v0.1.214(#6552 的 CI 因合入 master 后变红,即由此修复)。

…mark fastpath (#5403/#5418 regression)

The #4753 input-release (bodyText = undefined before streaming) made the
fastpath gate in prepare-openai (bodyText !== undefined && ...) unreachable:
the watermark fastpath silently never fired, and plugin wire sessions paid
the full reparse+rehash on every turn. Release the text only on the slice
where the fastpath cannot fire (non-openai wire or flag off); the strict
gate (pluginMode + !titleGen) in prepare-openai stays authoritative.

Also update the A/B pin: #5687 moved the dsh single-shot sidecar distinction
from "tool-less" to the sidecar budget (hasSingleShotBudget, <=8192), so the
test's 64K tool-less turn-0 is now (correctly) a main turn — model the real
sidecar with a 4K budget to keep pinning "side lane never stamps".

(cherry picked from commit 09577a2)
@ranxianglei ranxianglei changed the title fix: 水印快路径(plugin full-resend watermark fastpath)被输入释放改动静默禁用 [PR] fix: watermark fastpath (plugin full-resend watermark fastpath) silently disabled by input release mutation | fix: 水印快路径(plugin full-resend watermark fastpath)被输入释放改动静默禁用 Nov 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: fix/watermark-fastpath-input-release (3728f96)

Latest build — install this exact version

npm install -g billion-context@0.0.9834-pr.6640.c875dc2

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
3728f96 billion-context@0.0.9834-pr.6640.c875dc2 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei merged commit e5e1647 into master Nov 14, 2026
34 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1191-master.e5e1647 (rolling master tag).

npm install -g billion-context@0.0.1191-master.e5e1647  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant