fix: enforce Responses state byte cap - #841
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
CI follow-up: the initial macOS failure was a Bun 1.3.14 Trace/BPT trap (the same bun.report signature also appeared on unrelated PR #844), and the initial Windows failure was an unrelated GUI polling timeout followed by cascading React act failures. Re-running only the failed jobs passed on both macOS and Windows. No production or test code change was needed for those runner flakes. |
|
This is a valuable, focused fix: it closes the oversized-single-entry escape hatch in continuation-state storage, with appropriately narrow semantics and regression coverage. It currently conflicts with dev, so please rebase it onto the latest dev. Before landing, it will also need an independent review from someone other than the author. We’re tracking this under #820 for the next cycle. |
|
Superseded by #892, which implements this defect's fix natively on top of the wave-1 retained-state framework (the PR's shape was used as a reference; see the PR description in #892 for the defect-specific deltas, including where the framework already covered part of it). Thank you for the contribution — the analysis in this PR drove the fix. |
Campaign preparation (docs-only): five units under devlog/_plan/260802_wtN_* with 000 research + 010 implementation roadmaps, claim ledgers verified by a lunasearch fan-out (Anthropic 1M windows, Copilot mixed-wire, DeepSeek service_tier, WHATWG extension origins, POSIX rename-over-symlink). wt1 update-path: PR lidge-jun#871, issue lidge-jun#879 (star-prompt deferral leakage), lidge-jun#557 optional wt2 zero-leak: PRs lidge-jun#840 lidge-jun#841 lidge-jun#843 lidge-jun#844 lidge-jun#845 lidge-jun#847 (tracker lidge-jun#820) wt3 provider-wire: PRs lidge-jun#746 lidge-jun#860 lidge-jun#839/lidge-jun#854, issue lidge-jun#875 triage, lidge-jun#616/lidge-jun#837 optional wt4 server-config: PRs lidge-jun#850 (CORS origin confusion), lidge-jun#869 (symlink destruction) wt5 windows-service: PRs lidge-jun#868, lidge-jun#861 (issue lidge-jun#848)
… bounds Three explorer passes found wave-1 landings already on dev (77243d9 framework, d1408b9 continuation cap+spill, 034d320 cache caps, a616078 translator budgets), so the campaign narrows to refinements: lidge-jun#841 admission boundary (direct-spill oversized, bounded snapshot read, bounded replay), lidge-jun#847 collector per-call scope + mandatory budget + 502 normalization, lidge-jun#844 incremental frames + typed partial-EOF, lidge-jun#845 NOOP (superseded), lidge-jun#843 fixed-size SHA-256 key identities, lidge-jun#840 ACL timeout-memo release + destination keying.
…l replay Oversized candidates (> 64 MiB resident cap) now write directly to durable spill and install only the stub — they never become resident and never demote unrelated chains; candidates above the new 256 MiB single-spill payload ceiling are tombstoned at admission instead of being retained unreadably. Snapshot loading refuses to parse files over 32 MiB and applies the same admission boundary to oversized rows. Spill replay refuses payloads above the ceiling before read/parse with a typed too_large reason (surfaced as spill_too_large; wire shape unchanged). Snapshot selection now measures UTF-8 bytes, not UTF-16 length. Refines lidge-jun#841 on top of the wave-1 spill design.
Summary
Part of #820. This is the focused in-memory bound; it intentionally does not pull in #829 durable spill architecture.
Verification
bun test tests/responses-state.test.ts(43 pass)bun run typecheckbun run privacy:scanCompatibility
An entry that individually exceeds 64 MiB now becomes a normal
previous_response_idcache miss, so the client may need to resend history. Smaller stored chains and the existing disk snapshot limits are unchanged.