Repository navigation
[PR] fix: retry unreadable cache keepalive responses - #6735
Conversation
[bot] 🏷 查重: 不重复. Searched open+closed issues/PRs for the keepalive family: #6737/#6739 (credential rotation leaves an unregistered snapshot held by its timer — different mechanism: timer retention, not response handling), #6650 (client-facing stream watchdog — different surface), #6078/#6077 and #6238/#6227 (closed; stale-body ownership and TTL-detection scope — adjacent facets, already fixed; this PR's rearm test pins the #6078 guard), #3390 (original feature that introduced the empty-string fallback). No existing PR addresses the response-body read-failure path. Review of PR #6735 — fix: retry unreadable cache keepalive responses (Closes #6734) I re-ran the author's claims independently instead of trusting the description:
Layer judgment (root cause, not symptom). The producer of the defect is Regression review — existing behaviors on the touched path, each checked:
Intended behavior change (disclosed per policy): a 200 response whose body fails to read (truncated Content-Length, bad gzip) — old: single failure → immediate disarm Test validity: real loopback Auto-merge gate (§7.4): single-module, regression-tested, clean diff, references its issue — but the failure-routing/fallback semantics change is "fallback/default-value change" territory, so it stays human-merge. No code changes needed from me; nothing to fix on the branch. 8问(结构化审核清单):
判定:可合(mergeable)——方向正确(根因级修复)、diff 最小且干净、4 个新失败在 master 上真实复现原 bug 且在 head 上通过、既有行为逐项核过无回归。等 CI 全绿(test 车道与 guard 车道提交时仍在跑),合并权在你。 Suggested labels for the PR (not applied — the source PR's labels are the author's to manage): |
Closes #6734.
Problem
An idle Anthropic cache ping can receive HTTP 200 headers and then fail while reading the response body. The current empty-string fallback turns that transport or decompression failure into a missing cache-usage result, drops the snapshot after one attempt, and stops future keepalive pings.
Change
Route response-body read failures through the existing three-consecutive-failure budget and normal cadence. A subsequent cache hit resets the streak. HTTP 429 still stops immediately, and complete responses with zero/missing cache usage keep their existing stop policy. The existing entry-ownership check also protects a replacement snapshot when an older body fails.
This does not add settings, change the ping request bytes, or alter the retry budget.
Validation
a8bbb8d23108ba9148d09512927041364625d910: 4 new regressions fail and 7 controls pass. The existing two keepalive suites pass 45/45.npm run typecheck,npm run build, andgit diff --checkpass. Full regression status remains the remote CI result on this PR's head.The tests do not call a live model provider; cadence is driven through the existing scheduler seam, while HTTP transfer and decoding are real.
Prior work
My #6078/#6077 protect a newly armed snapshot from a stale successful body; #6238/#6227 exclude tool data from TTL discovery. Their complete patches and the original #3390 were checked: this response-read failure path remained unchanged. Open/closed keepalive searches found no matching correction.