Repository navigation
fix(cheapmodel): the prefix question keeps the turn's breakpoint (#776) - #777
Conversation
The sweep question at a keep-alive ping moved the turn's last breakpoint onto its "Understood." bridge (#721). The question read the turn's cache entry, but only the entry it named got a new lifetime. The turn's own entry expired 5 minutes after the turn, so the plain ping 2 after the question wrote the whole conversation again. The last message now keeps its breakpoint. The bridge gets a copy only while the request stays at or under the provider's 4 breakpoints. Live, ping 2 after the question, Sonnet 5.5: read 13,487 / write 18,053 before, read 31,542 / write 0 after. Opus 5.5: 13,371 / 18,214 before, 31,592 / 0 after. Fixes #776 Assisted-By: Claude Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Refs #776 Assisted-By: Claude Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | 1d32a460affc |
blocking |
Verdict: blocking
Findings
- cheapmodel/anthropic.go:223 — the doc comment on
CompletePrefixedstill states the old #721 contract this PR reverses- What fails: a maintainer reads
CompletePrefixedto reason about the cache key, and lines 219-225 tell them "The only existing byte it changes is the last message's cache_control, which moves onto the appended message (#721)". After this PR no byte before the appended messages changes. The comment states the exact opposite of the change's own guarantee, in the same file the PR edits. - Proof:
cheapmodel/anthropic.go:223-224versus the rewritteninsertAskMessagecomment atanthropic.go:380-381("every byte before the appended messages is untouched") and the new testTestInsertAskMessageLeavesThePrefixByteIdentical, which asserts that guarantee. - Fix: update that paragraph. Two smaller spots carry the same stale "moves" wording and should go in the same edit:
anthropic.go:417("and the breakpoint lands on it" — at the 4-mark cap it does not) andaskBridgeFor's comment atanthropic.go:503-506("whether a breakpoint moves with it … a breakpoint to move").
- What fails: a maintainer reads
Non-blocking
- At the cap, a trailing user message with a breakpoint still gets a bridge that carries nothing (
insertAskMessagepassescc.Exists()toaskBridgeFor, notbridgeCC.Exists(),anthropic.go:488). For that shape the bridge's only job was to host the copy. It is harmless — the ask stays fresh input, and the PR's live "keep, no bridge copy" rows read the full prefix and wrote 0 — but the extra "Understood." turn serves no purpose there. Worth a sentence in the comment, or dropping the bridge in that case, in a later change. countBreakpointsduplicatesapply.CountBreakpoints's rule by hand. The layering reason is fair, andTestCountBreakpointsMatchesTheCapRulepins the rule, so drift has a tripwire. No change needed.
What I checked
- The full diff of both commits (
697f93d9,1d32a460):cheapmodel/anthropic.go,cheapmodel/anthropic_prefixed_test.go,docs/components/advanced-offload.md, plus the code around each change. - Every
insertAskMessageshape, traced by hand: last role system / user / assistant / empty, breakpoint present or absent, count at 3 / 4 marks. No behavioral defect found. The copy is added only when the body holds 3 or fewer marks, so the total never passes the provider's cap of 4. The copiedcache_controlkeeps its ttl verbatim (marshalAppendedsplicescc.Raw). countBreakpointsagainstapply.CountBreakpoints(apply/metawrite.go:161): both mark spellings, marks on tools, system, message level (Anthropic spelling only) and content blocks. The rules match.- Fail-open: no new error paths.
countBreakpointscannot fail; aninsertAskMessageerror still returns fromCompletePrefixedand the caller declines to the plain ping. The sweep gate (components/offload/prefixask_gate.go) judges usage numbers only, so it does not depend on where the breakpoint sits. - Callers of
CompletePrefixed/ the bridge shape:proxy/prefixask.go,cmd/cg-selarm/main.go, the summarizer paths, and the sweep gate tests. None depends on the old "moved" shape. - Repo rules: the PR names the behavior change at the top (old and new behavior, what users see) and states its data dependence (no change, no new data read or stored) — both sections are present and correct for a mark-only edit.
- Tests were NOT run: live tests are not approved and Go is not on this machine. I read the tests and traced them against the code instead; the three new tests and the rewritten copy test match the new behavior.
- I read the PR title and description only. I read no other review or comment before posting this one.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | 1d32a460affc |
blocking |
Verdict: blocking
Findings
- cheapmodel/anthropic.go:224 —
CompletePrefixed's doc comment still describes the removed #721 behavior- What fails: a reader of
CompletePrefixedis told "The only existing byte it changes is the last message's cache_control, which moves onto the appended message (#721); everything before that message is byte-identical." After this PR,insertAskMessagechanges no existing byte:lastBreakpointonly reads the mark, and the copy lands on the appended bridge. The comment states the opposite of the invariant this PR exists for (#776: every byte before the appended messages is untouched). The doc comments in this package are the design record — the PR's own test (TestInsertAskMessageLeavesThePrefixByteIdentical) pins the opposite of what this comment claims. - Proof:
cheapmodel/anthropic.go:219-226(the "THE ASK IS NOT ALWAYS THE ONLY THING APPENDED" bullet) against the newinsertAskMessageatcheapmodel/anthropic.go:477-494, which never editsparts[len(parts)-1]. - Fix: replace that sentence with:
insertAskMessagechanges no existing byte; it copies the last message's breakpoint onto the appended bridge only while the request stays at or under the provider's cap (#776).
- What fails: a reader of
Non-blocking
cheapmodel/anthropic.go:415-417— the "#725" paragraph still says of a trailing user message with a breakpoint that "the breakpoint lands on it" (the bridge). After this PR it is a copy that lands there, and only below the 4-mark cap. Same stale-wording class as the finding.cheapmodel/anthropic.go:503-506—askBridgeFor's comment still says "a breakpoint to move". Nothing moves now.components/offload/prefixask_gate.go:17-19— the (off-by-default) write-cap comment says "the cap assumes the question's breakpoint sits on the short bridge". With #776 the question's breakpoint sits on the last message, copied onto the bridge. The magnitude reasoning still holds (the write stays a few tokens), and the switch is off, so this is a wording fix only.countBreakpointsdoes not count acache_controlnested inside atool_result's array-formcontent.apply.CountBreakpointshas the same limit, the stash body was accepted by the provider under the same rule, and a miss only skips the bridge copy (the safe direction). Noting for symmetry with the "same rule as apply" claim, not asking for a change.
What I checked
- Read
CLAUDE.mdanddocs/design.md; read the full diff of both commits (697f93d9,1d32a460) and the code around every change. - Traced
insertAskMessageend to end: no existing message is edited (the oldsjson.Deletestrip is gone), the copy is verbatim (ttl survives), and the ask never carries a mark. - Verified the cap guard: the bridge copy is added only when
countBreakpoints(prefixBody) < maxBreakpoints, so the sent body stays at or under 4 marks. The guard's premise holds becauseprefixBodycomes from the sent stash (proxy/prefixask.go:315-322,sentStash), the body the provider already accepted. - Compared
cheapmodel.countBreakpointsagainstapply.CountBreakpoints(apply/metawrite.go:161-211) rule by rule: message-level marks count only thecache_controlspelling; tools, system and content blocks count both spellings; all checks are structural (IsObject).apply'smayHold/strings.Containsguards are perf prefilters only, so the rules match. Checked gjsonForEachon non-arraysystem/toolsvalues is a no-op or safe. - Hand-traced every test in the diff against the new code (no Go on this machine, live tests not approved): the five copy cases, the byte-identity test, the four cap cases, the count-rule test, and the unchanged tests (
TestInsertAskMessage,TestInsertAskMessageAddsNoBreakpointWhenTheLastHasNone,TestInsertAskMessageBridgeOnlyWhereABreakpointMoves, theCompletePrefixedHTTP tests) — all assertions hold under the new behavior. - Checked fail-open: an error or a provider 400 on the question returns an error from
CompletePrefixed; the sweep declines and the ordinary ping goes out. No path loses data or blocks a request. - Confirmed
strconvhad no remaining use inanthropic.go, and no other code referencestakeLastBreakpointor depends on the moved-breakpoint behavior (components/offloadandcheapmodel/zz_live_trailing_system_test.goonly reference the shape, not the move). - Data dependence: unchanged — the question still reads only the stashed sent body, which existed before this PR. No
docs/data-dependence.mdupdate needed. - Per round-1 independence I did not read the PR body or any comments on it, so I did not verify the PR's own behavior-change naming; the change itself (copy-and-keep instead of move) is the PR's stated purpose in the code and docs.
Review round 1 of #777 found doc comments that still described the #721 move. CompletePrefixed, the #725 paragraph, askBridgeFor and the write-cap note in prefixask_gate.go now say the question changes no existing byte and copies the breakpoint onto the bridge only below the provider's 4-breakpoint cap. One test is renamed to match. No code change. Refs #776 Assisted-By: Claude Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Round 1 replies. Fixed in 9826d89 (doc comments and one test name; no code change). Unit tests and Reviewer 1 and 2, finding 1 (blocking): The #725 paragraph,
The empty bridge at the cap for a trailing user message (non-blocking). Left as is, on purpose.
|
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 2 of 2 | 9826d8923045 |
approve |
Verdict: approve
Findings
None. The round-1 finding is fixed, and the one new commit changes comments only.
Non-blocking
components/offload/prefixask_gate.go:17-20— the write-cap note now says the question's breakpoints "sit on the turn's last message and on its copy on the short bridge". At the cap (4 marks) there is no copy on the bridge. The conclusion the note draws (small write, ask stays fresh input) still holds there — the write is even smaller — so this is wording precision only, not a defect.- The author's choice to keep the empty bridge for a trailing user message at the cap is accepted. The reason is right: dropping the bridge there changes the request shape, that shape is not proven live, and the current shape is harmless.
What I checked
- Last review: round 1,
1d32a460affca3d21510e813c9189fef3c96e3d1, 2026-10-29T23:59:34Z. - New commits read: 1 —
9826d892"docs(cheapmodel): say the breakpoint is copied, not moved (#776)". - Read in full: 2 reviews, 1 comment, 0 inline comments (
.review-in-inline.txtis empty). - New items since my last review, and what I did about each:
- Reviewer 2's round-1 review (posted before mine; read now per round-2 rules). Its finding matches my round-1 finding. I checked it myself against the code: confirmed then, fixed now.
- The author's round-1 reply comment. Every claim in it matches the diff.
- Commit
9826d892. Reviewed in full below.
- My round-1 finding 1 (
cheapmodel/anthropic.go:224,CompletePrefixeddoc said the breakpoint "moves"): fixed. The bullet now saysinsertAskMessage"changes no existing byte" and copies the breakpoint onto the bridge only at or under the 4-breakpoint cap (anthropic.go:224-226). Checked against the code atanthropic.go:477-494: the wording is accurate. - My round-1 non-blocking items: the #725 paragraph (
anthropic.go:417-419) fixed — "a copy of the breakpoint lands on it, below the cap only. At the cap the bridge is still sent, with no breakpoint", which matches the guard.askBridgeFor's comment fixed, and the test renamed toTestInsertAskMessageBridgeOnlyWhereABreakpointIsCopied(body unchanged, still passes by hand-trace).prefixask_gate.gofixed (wording). The nestedtool_resultmark note: no change, as I suggested. - Reviewer 2's non-blocking items: the empty bridge at the cap — the author rejected a change with a reason (unproven live shape, harmless as is); I checked the reason and accept it. The
countBreakpointsduplication note needed no change, as both reviews said. - The new commit in full:
git diff 1d32a460..9826d892touches only doc comments incheapmodel/anthropic.go, one test name incheapmodel/anthropic_prefixed_test.go, and the comment incomponents/offload/prefixask_gate.go. No code change. I read each new sentence against the code it describes; each is accurate. The renamed test's body and its own comment still match the behavior. - No new behavior, no new data dependence, fail-open untouched (nothing executable changed since round 1).
- Tests were not run by me: live tests are not approved and Go is not on this machine. The author reports
./cheapmodel/...and./components/offload/...passed with-raceon the box; the change is comment-only, so this claim is consistent with the diff.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 2 of 2 | 9826d8923045 |
approve |
Verdict: approve
Findings
None. The new commit is docs-only and every comment it touches now matches the code I traced in round 1.
Earlier findings
- My finding 1 (blocking),
CompletePrefixed's doc stated the old #721 "moves" contract — fixed.anthropic.go:224-226now says the question changes no existing byte and copies the breakpoint onto the bridge only at or under the 4-mark cap. That is what the code does. Reviewer 1 raised the same finding; I checked the fix myself and agree. - My non-blocking notes, same wording class — fixed. The #725 paragraph (
anthropic.go:418-420) now says a copy lands on the bridge, below the cap only, and that the bridge is still sent at the cap with no breakpoint.askBridgeFor's comment (anthropic.go:505-509) says "carries" and "copy", not "move".prefixask_gate.go:17-20now names both of the question's breakpoints (last message and its bridge copy). The test rename (...WhereABreakpointIsCopied) matches; its body and assertions are unchanged and still hold. - My non-blocking note, the empty bridge at the cap for a trailing user message — rejected by the author, and I accept the reason. The no-bridge shape for a user message at the cap is not proven live (the live "keep, no bridge copy" rows all had a trailing system message, which always gets a bridge), and the current shape is harmless: the ask stays fresh input and the bridge costs a few tokens. Shipping an unproven request shape to save a few tokens is the worse trade. The new #725-paragraph wording documents the behavior, which is what I asked for.
- Reviewer 1's non-blocking note,
countBreakpointsdoes not count acache_controlnested inside atool_result's array-form content — no change, agreed. I checked the same limit inapply.CountBreakpointsin round 1:arrayMarkswalksmessages.#.contentblocks but not atool_resultblock's own nestedcontent. Both counters share the rule, a miss only skips the bridge copy (the safe direction), andTestCountBreakpointsMatchesTheCapRulepins it.
Non-blocking
anthropic.go:228-229still says "every byte before the appended message is prefix", singular, where the question appends two messages (bridge plus ask). The meaning is clear from the fixed bullet above it. Wording only; not worth a commit.
What I checked
- Last review: round 1,
1d32a460affca3d21510e813c9189fef3c96e3d1, 2026-10-29T23:59:03Z. - New commits read: 1 —
9826d892"docs(cheapmodel): say the breakpoint is copied, not moved (#776)". Docs-only: three comment blocks and one test name; no code change, confirmed by reading the full diff1d32a460..HEAD. - Read in full: 2 reviews, 1 comment, 0 inline comments (from
.review-in-reviews.txt,.review-in-comments.txt,.review-in-inline.txt). - New items since my last review: reviewer 1's round-1 review (same finding as mine plus two non-blocking notes — checked both, see items 2 and 4); the author's round-1 reply at 2026-10-30T00:08:21Z (claims each fix — verified each against the code at HEAD; claims tests and
-racepassed on the box — not run by me, see below). - Verified each rewritten comment against the behavior I traced in round 1: the copy goes on the bridge only when the body holds 3 or fewer marks; the last message keeps its mark; the bridge is still sent at the cap; the ask never carries a mark. All four comment blocks now state exactly that.
- Confirmed the renamed test's body and assertions are unchanged, so the rename cannot hide a behavior change.
- Tests were NOT run by me: live tests are not approved and Go is not on this machine. The commit touches no executable code path, so my round-1 hand-trace of the tests still covers the behavior.
Owner decision 2026-10-30: the sweep must not contradict the caching strategy. Where the question cannot renew the cache, it runs as an extra request after the strategy's last ping. - After a turn that ends at a text turn (the last non-system message is not a tool_result; roles and block types only), every planned ping is plain. The question goes out once at the slot after the last planned ping, 30 s before the hold ends. No ping follows it, and it sends nothing if the copy is gone or there is no candidate. - After a tool_result turn the question may take ping 1, as on main: it renews the entry (#777). - This replaces the "plain ping 1, question on the last ping" rule of the first commit, which is reverted. New counters: keepalive_sweep_extra_asked, keepalive_sweep_extra_skipped. Refs #776 Assisted-By: Claude Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
…776) (#779) fix(keepalive): the sweep question takes the last ping, never ping 1 (#776) The sweep question took ping 1 of an idle span. It reads the turn's cache entry but does not renew one that ends at a text turn. After a text turn the entry then expired, and the plain ping 2 wrote the whole conversation again: 22 of the 80 misses in #776 ($50.18 in 3.9 days on one laptop), which #777 could not fix. Ping 1 is now always plain. The question takes the last planned ping of the span. A one-ping plan (the 1-hour tier's default) sends no question, so the question is never the only ping. The summarizer's substitute, the already_asked latch, the cost ceiling and the batch rules are unchanged. Owner decision 2026-10-30. Fixes #776 Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]> fix(keepalive): after a text turn the sweep question comes third (#776) Owner decision 2026-10-30: the sweep must not contradict the caching strategy. Where the question cannot renew the cache, it runs as an extra request after the strategy's last ping. - After a turn that ends at a text turn (the last non-system message is not a tool_result; roles and block types only), every planned ping is plain. The question goes out once at the slot after the last planned ping, 30 s before the hold ends. No ping follows it, and it sends nothing if the copy is gone or there is no candidate. - After a tool_result turn the question may take ping 1, as on main: it renews the entry (#777). - This replaces the "plain ping 1, question on the last ping" rule of the first commit, which is reverted. New counters: keepalive_sweep_extra_asked, keepalive_sweep_extra_skipped. Refs #776 Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]> docs: keep-alive never shortens the cache strategy (#776) The owner asked for the rule in the development docs, so a later change that breaks it is caught. - docs/design.md: a new section, "Keep-alive: the cache strategy comes first". It names the summarizer's substitute as a known gap. - CLAUDE.md, Hard boundaries: one bullet that points at it. - RELEASING.md, Part B: the live check confirms that after a text turn every planned ping is plain and reads the full prefix. - A guard test for the sweep on 1-, 2- and 3-ping plans. Refs #776 Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]> fix(keepalive): the summarizer follows the cache strategy too (#776) Owner decisions 2026-10-30: "summerizer as well so a)" and "a1 it is". - After a text turn the summarizer's keep-alive substitute no longer takes a planned ping. Every planned ping is plain, and the summary goes out once as the extra request after the last one. - A cache_state any summary uses the sweep's slot: 30 s before the normal hold deadline. - A cache_state pre_expiry summary (the medium preset) runs only in its pre-expiry window. Its slot is the middle of that window: 268 s after the last ping at the 5-minute defaults, 32 s before expiry. - The one exception to the hold limit: only for a span that ended at a text turn and still has a pre_expiry summary waiting, the deadline timer re-arms once, to 15 s past the slot (43 s longer at the defaults), never past the cache expiry. Every other span keeps the limit. Counted as keepalive_hold_extensions. - One request in the extra slot. The summary owns it before the sweep. A declining pre_expiry summary is not followed by the sweep. - A missed extra slot is never sent late. - OpenAI is out of scope: its cache has no text-turn rule. - docs/design.md: the known gap is gone. The guard covers every substitute kind. Refs #776 Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]> test(proxy): the summary-at-a-ping tests use a tool_result turn (#776) After a text turn the summary now waits for the extra slot after the last planned ping. These two tests are about a planned ping dispatching the summary, so their last real turn now ends at a tool_result. Refs #776 Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]> fix(keepalive): the summary uses the 210 s slot, no hold extension (#776) Owner decision 2026-10-30: "give it more time, it can run on the 210 sec mark". - The hold extension is removed: the re-armed timer, keepalive_hold_extensions and its tests. Every span keeps today's hold limit. - One extra slot for every substitute: 30 s before the normal hold deadline (210 s after the last ping at the 5-minute defaults). - For the summary's extra request only, the pre-expiry window widens to cover that slot (94 s at the defaults: 90 s left plus two ticks). Planned-ping summaries keep the #715/#717 window. - The summary goes first. The sweep question goes only if the summary declines, in the same slot. Nothing after it. - Kept: a missed slot is never sent late; OpenAI is out of scope. Refs #776 Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]> fix(keepalive): only the summary takes a summary's slot; extra re-checks the breaker (#776) Owner rule 2026-10-30: "as for sweep after summary. dont do that. it can probably have the sweep question pay a cache write like the problem with the ping... so we should probably just do summary at that point". - When a summary is due in the extra slot, only the summary goes, even if it declines. The sweep question takes the slot only when no summary is registered for the thread. Review round 1 on #779: - The extra slot now runs the same route-breaker and dead-credential re-check as a planned ping. On a trip it sends nothing and stops the span. - A short Idle: the slot is at least two ticks after the last ping, and the extra waits until that ping's response is in (pingRunning). - SweepExtraSkipped: the doc names every case it counts. - docs/design.md: endsAtTextTurn is an internal flag, not a metric. - RELEASING.md: the Part B check is numbered like its siblings. Refs #776 Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]>
Summary
Ping 2 after a sweep question now reads the prefix instead of writing it again, on tool_result turns. The sweep question at ping 1 moved the turn's last cache breakpoint away. That let the turn's own cache entry expire 5 minutes after the turn. The question now leaves the breakpoint where it is.
Fixes #776
What we found
From a copy of the laptop dashboard DB (port 8789), metadata columns only, rows after the #712 merge:
Live reproduction (proxy built from
origin/main, a capture forwarder in front of the gateway, a Claude Code sandbox session on Sonnet 5.5). Bodies were compared as metadata: roles, breakpoint positions, hashes.max_tokensandstreamdiffer.Why it happens
What changed
cheapmodel/anthropic.goinsertAskMessage: the last message keeps its breakpoint. The bridge gets a copy of it only while the request stays at or under the provider's cap of 4 breakpoints. At the cap the bridge gets none.countBreakpoints: a small local counter with the same rule asapply.CountBreakpoints(both mark spellings, tools, system, messages and blocks).cheapmodelcannot importapply.max_tokens.docs/components/advanced-offload.md: one paragraph.How it was tested
Unit tests (
cheapmodel/anthropic_prefixed_test.go). All 3 new ones fail onorigin/main:TestInsertAskMessageCopiesTheTrailingBreakpoint(replaces the Prefix questions (sweep, summary substitute) miss the cache: the breakpoint stays on Claude Code's trailing system message #721 "moves" test): the last message is unchanged, and the bridge carries the samecache_control(ttl included).TestInsertAskMessageLeavesThePrefixByteIdentical: system and every original message are byte-identical.TestInsertAskMessageNeverExceedsTheBreakpointCap: 3 marks gives a bridge copy; 4 marks (on system, tools, a message, or a trailing user message) gives none, and the total stays at 4 or fewer.TestCountBreakpointsMatchesTheCapRule: both spellings and every location count; text that only names the field does not.Mutations, each on a copy of the fix, all killed:
>instead of>=cachePointBox:
go vet ./...andgofmt -lclean.-racepassed on./cheapmodel/... ./keepalive/... ./components/offload/... ./proxy/.... Non-race passed on./apply/... ./components/... ./cmd/....Live runs on the laptop. Each run used its own proxy (pipeline
[extract_llm_sweep], idle 200 s, 2 pings) and a capture forwarder. All runs went through theANTHROPIC_UPSTREAMgateway. Rows are from each proxy's own DB, metadata only. "Q" is the sweep question at ping 1. "Ping 2" is the plain ping after it.Direct gateway replays (the owner ran them). Input: the captured real-turn body (17 messages, 3 breakpoints, last message
role: system). Each run has its own nonce, so the runs share no cache entry.origin/main)origin/main)movedreproduces the miss on both models, andkeepmatches the control on both.At the 4-breakpoint cap, the fix drops the bridge's copy, never one of the client's breakpoints.
TestInsertAskMessageNeverExceedsTheBreakpointCap. Mutations: no cap check, and>instead of>=.Data dependence
No change. The fix edits where one
cache_controlmark sits in a request the sweep already sends. It reads no new data and stores nothing. Each storage level (off, metadata only, everything) works as before.docs/data-dependence.mdneeds no update.Behavior change
Open questions
Technical notes
🤖 Generated with Claude Code