Skip to content

fix: enforce Responses state byte cap - #841

Draft
Ingwannu wants to merge 1 commit into
devfrom
agent/bound-responses-state
Draft

fix: enforce Responses state byte cap#841
Ingwannu wants to merge 1 commit into
devfrom
agent/bound-responses-state

Conversation

@Ingwannu

@Ingwannu Ingwannu commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • measure retained continuation entries in serialized UTF-8 bytes before admission
  • reject a single entry larger than the 64 MiB store budget instead of keeping it as the last survivor
  • preserve unrelated valid chains when an oversized candidate is rejected
  • remove stale same-ID state when its replacement cannot be admitted
  • apply the same admission rule while loading snapshots

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 typecheck
  • bun run privacy:scan

Compatibility

An entry that individually exceeds 64 MiB now becomes a normal previous_response_id cache miss, so the client may need to resend history. Smaller stored chains and the existing disk snapshot limits are unchanged.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 299aff23-dfbe-4198-815a-6b84fcd0b56e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@Ingwannu

Ingwannu commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

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.

@lidge-jun

lidge-jun commented Aug 2, 2026

Copy link
Copy Markdown
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants