Skip to content

test: anthropic-wire cache_control breakpoint stability across turns - #1103

Merged
ranxianglei merged 1 commit into
masterfrom
2026-09-21_anthropic-cc-breakpoint-e2e
Sep 22, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-09-21_anthropic-cc-breakpoint-e2e

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Salvage from held PR #1092, per @ranxianglei's review direction on that PR ("值得无条件拆走" item 1). This is the anchor-independent half of the coverage: it passes on master today and needs no part of the held anchor feature.

What it adds

One e2e in tests/e2e-anthropic.test.ts (real proxy + mock upstream, Anthropic wire): a client sends cache_control breakpoints on the system block and an early history user block across three turns where the system head legitimately changes (V1 → V2 → V2) and history grows. Asserts:

  • breakpoint count is invariant — exactly the two client markers on every turn;
  • the system breakpoint follows the client's current head verbatim (no anchoring on master — old head bytes do not linger);
  • the history-block breakpoint stays on the same logical block every turn (identity-keyed carry-over through the kernel round-trip, never index-based);
  • no breakpoint migrates to newer history blocks or lands on content the client did not mark.

This pins the invariant #1097's risk section names as a prerequisite ("扩 #1085 follow-up 的 anthropic cache_control 回归测试") and guards against the opencode#43507 class of regression: a breakpoint on a message that can never prefix-match silently disables caching for everything after it.

Pre-flight

  • npm run typecheck ✅
  • npm test ✅ 2163 pass / 0 fail / 2 skipped (pre-existing skips)
  • npm run build not run (test-only change; no src touched)

Test-only diff, 55 added lines in one file. No wire, config, or behavior change.

Related: #1092 (held, redesign pending), #1097 (prerequisite coverage).

Anchor-free e2e salvaged from held PR #1092 per review direction: client-sent cache_control breakpoints (system block + early history block) must ride the same logical blocks on every turn — identity-keyed carry-over through the kernel round-trip, invariant under legitimate head changes and history growth, never migrating to newer blocks. Prerequisite coverage named in #1097's risk section.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-21_anthropic-cc-breakpoint-e2e (7c93619)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-1103

Each push to this PR publishes a new version under the pr-1103 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr1103.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

Verified this PR end-to-end — pulled branch 2026-09-21_anthropic-cc-breakpoint-e2e @ 7c93619 and cross-checked code + CI + local runs. It matches the description in every detail.

Code cross-check

  • Diff vs master: exactly one commit, tests/e2e-anthropic.test.ts only, +55 lines, zero src/wire/config touched. Test-only, as claimed.
  • Base freshness: PR sits directly on current master tip (9c01dbe) — no stale-base exposure, no hot-file contention (the only other open work touching this area is held feat: stable head-system anchor for prefix-cache preservation (#1085) #1092, which this PR deliberately avoids).
  • New test exercises the real proxy + mock upstream over the Anthropic wire across 3 turns with a legitimately changing system head (V1 → V2 → V2) and growing history. All four invariants from the description are asserted: count-invariant (exactly 2 client markers every turn), system bp follows the current head verbatim with no old-head lingering, history bp stays on the same logical block (identity-keyed carry-over, never index-based), and no migration onto unmarked/newer blocks. It correctly pins the Feature: content-addressed message store — ID-referenced tool results + acp_retrieve (built-in CCR) #1097 prerequisite ("扩 [Feature] Optimize the cache by reorganizing the context. #1085 follow-up 的 anthropic cache_control 回归测试") and guards the opencode#43507 class. No dependency on the held anchor feature — the "no anchoring on master" assertion makes that explicit.

CI status (head 7c93619) — all 8 check runs green:

  • test ubuntu-latest 22 / 24 ✅, windows-latest 22 / 24 ✅
  • build-artifact ✅, version-guard ✅
  • codex zero-token e2e ✅, codex CODEX_HOME/MCP ✅

Local verification (exact PR tree, npm ci):

  • npm run typecheck ✅
  • tests/e2e-anthropic.test.ts: 5/5 pass, including the new breakpoint-stability test ✅
  • full suite: 2163 pass / 0 fail / 2 skipped (pre-existing skips) — matches the stated pre-flight exactly ✅
  • build: not run locally (no src touched); covered by the green CI build-artifact.

Assessment against §7 review discipline: clean single-purpose diff, fresh base, deterministic test (ports via harness, no fixed-port assumptions), regression coverage for a named invariant, no load-bearing infra touched. Nothing to fix.

中文摘要:纯测试改动(新增 anthropic-wire cache_control 断点跨轮稳定性 e2e),已核对 diff 与描述一致、基线为当前 master 最新、CI 8 项全绿且本地复跑 2163 通过无失败,可以合并。

Per repo rules, merging stays human-only — ready whenever you are.

@ranxianglei

Copy link
Copy Markdown
Owner Author

Independent review: MERGE

Verified the PR's central claim: applied this diff onto plain master and ran the new e2e — 1/1 pass (node --import tsx --test --test-name-pattern="cache_control breakpoints"). It genuinely needs none of the held anchor feature.

The test is the right shape: identity-keyed breakpoint assertions (count invariant across turns, no migration to newer blocks, head changes forwarded verbatim with their breakpoint, no stale-head lingering), no wall-clock or port-luck dependencies (harness listen(0)). This is the "值得无条件拆走" item 1 from my #1092 review, and it names itself as prerequisite coverage for #1097 — good.

No findings. Mergeable as-is.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

Your independent check converges with mine — three independent passes now agree:

  • Yours: diff applied onto plain master, new e2e 1/1 pass via --test-name-pattern="cache_control breakpoints" → confirms anchor-independence end-to-end (no part of held feat: stable head-system anchor for prefix-cache preservation (#1085) #1092 required).
  • Mine (prior comment): exact PR tree, full suite 2163 pass / 0 fail / 2 skipped, typecheck clean.
  • CI on head 7c93619: all 8 checks green (ubuntu/windows × 22/24, build-artifact, version-guard, codex zero-token + CODEX_HOME/MCP).

No findings from either pass. Base is still at master tip, single-commit clean diff, nothing outstanding on my side.

One thing I can't do: execute the merge itself. Repo rules make PR merging a human-only operation, so please merge it yourself:
#1103

中文摘要:你我的独立验证已收敛(纯 master 上跑新 e2e 通过 + 本地全量 2163 通过 + CI 全绿),无遗留问题;按仓库规则我不能执行合并,请手动合并上述 PR。

@ranxianglei
ranxianglei merged commit f0959e3 into master Sep 22, 2026
8 checks passed
@ranxianglei
ranxianglei deleted the 2026-09-21_anthropic-cc-breakpoint-e2e branch October 15, 2026 05:32
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