Skip to content

[WRONG BRANCH] fix(responses): bound combo recall memory - #472

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-memory-exhaustion-vulnerability-x7bxrc
Draft

[WRONG BRANCH] fix(responses): bound combo recall memory#472
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-memory-exhaustion-vulnerability-x7bxrc

Conversation

@luvs01

@luvs01 luvs01 commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent untrusted upstream response.model strings from being stored unbounded in the process-global combo recall cache and causing aggregate memory exhaustion.
  • The existing map limited entries to 256 but did not limit per-entry bytes or register a periodic TTL sweep, allowing dormant large entries to persist.

Description

  • Add a per-entry UTF-8 size guard that rejects upstream response.model values above 1 KiB before remembering them in rememberComboForLane (bounded early on the JS string).
  • Track and account retained bytes with responseModelBytes and enforce a 64 KiB aggregate model-string budget that evicts oldest entries when exceeded, in addition to the existing 256-entry cap.
  • Add a periodic TTL sweeper sweepExpiredComboRecall and register it in STATE_STORE_REGISTRATIONS so dormant expired lanes are reclaimed by the global state-store sweeper.
  • Add regression tests covering oversized ASCII and multibyte model ids, aggregate eviction behavior, and periodic expiry, and provide a clearComboRecallForTests reset hook.

Testing

  • bun test tests/oauth/state-store-sweeper.test.ts — focused regression tests passed.
  • bun run typecheck — typecheck passed.
  • bun run privacy:scan — privacy scan passed.
  • bun run test:changed — unavailable in this checkout (no dev comparison ref), and a full bun run test was started but exposed unrelated parallel-suite failures in other subsystems and was not used as the focused verification; the targeted tests for this change remained green.

Codex Task

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-09T04:24:56.540361Z 5619d6a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c3f38d27-146f-44b5-89d2-ba593cb30b81


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 9, 2026
@github-actions github-actions Bot changed the title fix(responses): bound combo recall memory [WRONG BRANCH] fix(responses): bound combo recall memory Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft September 9, 2026 04:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5619d6a777

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

): void {
if (!lane || !comboId || !responseModel.trim()) return;
const modelBytes = boundedModelBytes(responseModel);
if (modelBytes === undefined) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear stale recall when rejecting an oversized model

When a lane already has a cached entry and its next completed combo response reports a model over 1 KiB, this early return leaves the previous response registered as the lane's latest result. If the client later submits that previous bare model for compaction, recallComboForLane can incorrectly route it back through the old combo even though a newer response completed on the lane. After validating the writer generation and owner, invalidate the lane when the new model cannot be retained, and add a valid-to-oversized transition test.

Useful? React with 👍 / 👎.

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

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant