You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A stale keepalive response can disarm a replacement request snapshot #6077
An in-flight Anthropic cache keepalive can disarm a newer successful request's snapshot.
At master 541cf26, firePing checks entry ownership before awaiting response.text(), then handles HTTP 429 and cache misses by session ID. A real request can re-arm that session while the body is pending. When the old body finishes, its stop decision removes the replacement entry and cancels its fresh timer.
Reproduction
Arm a 5-minute snapshot and fire its scheduled ping.
Resolve fetch headers, but hold response.text() pending.
Record a new successful 1-hour request for the same session.
Complete the old response with either HTTP 429 or cache_read_input_tokens: 0.
The newly armed entry is gone, although the response belongs to the previous snapshot.
The deterministic regression against the current base produces 37 passing and 2 failing tests in tests/cache-keepalive.test.ts; a stale cache-hit control passes. The two failures both observe undefined instead of the newly armed 1-hour snapshot.
Expected behavior
Only the currently registered entry may apply a body-dependent stop or success decision. A superseded response must leave the replacement snapshot and timer alone. Normal current-entry hit/miss/429 behavior remains intact.
Scope and prior work
This is a new response-body completion race. #3390 introduced keepalive; #5669/#5672 (integrated through #5847) cover default TTL detection and timer unref, not snapshot ownership after body consumption. It is independent of the previous contribution batch #6046–#6055.
Category A (prefix-cache continuity), proposed priority p2, scope/other.
Activity
ranxianglei commentedon Nov 12, 2026
Fixed in batch PR #6439 (merged).