Skip to content

test(#2653): pin the #2648 global-scope cache_control ordering constraint in the wire-contract ledger (WC-016) - #2655

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-10_wc016-global-scope-order
Oct 11, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-10_wc016-global-scope-order

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #2653

Background

The production 400 from #2648 revealed an upstream validation constraint on Anthropic cache_control.scope:"global" breakpoints that was never recorded in the WIRE_RULES ledger — §7.3 "Wire-constraint ledger only grows" requires every constraint learned in production to become a permanent ledger entry (+ gate + validation-parity enforcement) INSIDE the fixing PR. PR #2650 added the e2e behavior test but no ledger entry; this closes that gap.

Direction correction (vs issue body)

The issue's summary sentence ("a narrower scope must not appear after a global") is reversed relative to the API error quoted in #2648 itself. The rule as encoded by the API wording:

In render order (tool definitions → system → message content blocks), a scope:"global" breakpoint is valid only while EVERY preceding block is also globally scoped. Unmarked blocks default to session scope, so they poison any later global breakpoint. Narrowing AFTER a global breakpoint (global → ephemeral) stays legal.

The validator encodes exactly this direction. Evidence for the strict reading of "unmarked = narrower": bili's injected tools carry no cache_control at all (mergeOwnedTools, src/server/inject.ts) and bili never stamps scope:"global" (src/loop/cache-control.ts) — yet #2648's request with six unmarked tools 400'd against a global system block.

Changes (test-only, no src/ touched)

Behavior-change disclosure

None in product code — src/ untouched. CI strictness only: the anthropic validation-parity fake now rejects shapes the real API also 400s. No config surface added, no env vars, no persistence changes. Independent of PR #2650's merge order (zero file overlap).

Verification

  • npm run typecheck clean
  • node --import tsx --test tests/wire-contract.test.ts — 17/17 pass (targeted; full suite left to CI per local-test discipline)

…straint as WC-016 in the wire-contract ledger
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-10_wc016-global-scope-order (aca8fb8)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2870-pr.2655.8532d8e

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

Option B — Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 收到,开始审查 PR #2655(WC-016 ledger 条目)。步骤:① 核对原 issue #2653/#2648 方向 → ② 拉分支通读 diff(代码关+测试有效性+diff 整洁度)→ ③ 本地定向验证(typecheck + wire-contract 套件)→ ④ 看 CI。结论按结构化八问回复。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 审查完成,判定:可合并。 新 head aca8fb8f0 上 CI 全绿(24/24)。

审查要点

结构化八问

  1. 是什么问题:[Bug][claude MITM] 注入 ACP 工具破坏宿主请求:scope:"global" 缓存前缀 400 + Threads continue 指纹不符(thread_fingerprint_mismatch) #2648 生产 400 揭示的 Anthropic global-scope 缓存断点排序约束从未入 WIRE_RULES ledger(§7.3 要求生产学到的约束在修复 PR 内成为永久 ledger 条目 + gate + validation-parity enforcement);fix: passthrough anthropic requests carrying a global-scope system block (#2648) #2650 只加了 e2e 行为测试,留下此缺口。
  2. 什么原因导致:契约文档化强度缺口,非产品缺陷——约束知识只存在于 [Bug][claude MITM] 注入 ACP 工具破坏宿主请求:scope:"global" 缓存前缀 400 + Threads continue 指纹不符(thread_fingerprint_mismatch) #2648 的报错原文和 fix: passthrough anthropic requests carrying a global-scope system block (#2648) #2650 的 e2e 测试里,没有进入 CI 可执行的 ledger;另 issue 正文摘要句与 API 原文方向相反,需先更正再编码(PR 已做并留证)。
  3. 影响范围与严重程度:纯测试层,src/ 零改动。影响 = CI 严格度:anthropic validation-parity fake 现在会拒绝真实 API 同样 400 的形状。无用户可见影响;爆炸半径已验证受限(见回归清点)。
  4. 怎么修复的:ledger 增 WC-016 一条(summary + provenance 逐字引 [Bug][claude MITM] 注入 ACP 工具破坏宿主请求:scope:"global" 缓存前缀 400 + Threads continue 指纹不符(thread_fingerprint_mismatch) #2648 报错与环境 + KDD#9 边界注记:fix: passthrough anthropic requests carrying a global-scope system block (#2648) #2650 的 gate 只扫 system,predicate 扩到 tools[] 需流量证据先行,当前无此类流量);validateAnthropicBody 增渲染序校验条款;self-check probe + 专门单测(两违例/两合法形状)。
  5. 是否有回归问题:无。既有条目/probe/golden/其他套件逐项核查不受影响;无语义漂移、无 fail-fast 变吞错、无阈值/时序/输出格式变化。
  6. 是否破坏缓存:不涉及——未触碰运行时缓存/重试/游标/去重逻辑。
  7. 是否改了设计方向:不涉及——纯 §7.3 契约层补充;边界注记明确把 fix: passthrough anthropic requests carrying a global-scope system block (#2648) #2650 gate 的 tools[] 扩展留给流量证据(KDD#9 纪律),不扩大本 PR 范围。
  8. 是否引入新配置:不涉及——无新 config/env/默认值。

判定:可合并——分支基于当前 master,与 #2650 合并顺序无关(零文件重叠),head aca8fb8f0 CI 24/24 绿。

@ranxianglei
ranxianglei merged commit 58c83db into master Oct 11, 2026
24 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.248-master.58c83db (rolling master tag).

npm install -g billion-context@0.0.248-master.58c83db  # 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.

@ranxianglei
ranxianglei deleted the 2026-10-10_wc016-global-scope-order branch October 15, 2026 05:33
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.

[Gap] #2648 发现的 global-scope 缓存断点排序约束未入 wire-contract ledger(WIRE_RULES 缺条目)

1 participant