Skip to content

[WRONG BRANCH] fix(cursor): catch EOF terminal budget overflow - #317

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-cursor-eof-synthesis-vulnerability
Draft

[WRONG BRANCH] fix(cursor): catch EOF terminal budget overflow#317
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-cursor-eof-synthesis-vulnerability

Conversation

@luvs01

@luvs01 luvs01 commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Motivation

  • A synthesized terminal on clean Cursor EOF could call push() outside the existing guarded frame-processing path, and push() can synchronously throw TranslatorBudgetExceededError, which previously produced an unhandled rejection and left the turn unsettled.

Description

  • Change the EOF drain promise chain to route any exception raised while synthesizing terminal events into the existing failure path by replacing the .then(..., onRejected) tail with a .then(...).catch(...) that calls failAndClear in src/adapters/cursor/live-transport.ts.
  • Add a focused regression test in tests/cursor-hardening.test.ts that constrains the translator budget, simulates many small assistant text frames followed by a clean EOF, and asserts a typed TranslatorBudgetExceededError is observed and that budget ownership is released.
  • Keep the behavior of synthesizing typed truncation finalizeTurnEvents() unchanged while ensuring any transport-budget overflows during synthesis settle the turn consistently.

Testing

  • Ran focused typecheck with bun run typecheck which succeeded.
  • Ran the Cursor hardening tests with bun test tests/cursor-hardening.test.ts (Bun 1.3.14) and observed the new and existing Cursor tests pass (34 passed, 0 failed).
  • Ran bun run privacy:scan which completed successfully, and attempted a full bun run test but the repository-wide suite hit unrelated integration timeouts/failures outside the changed area.

Codex Task

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of asynchronous errors when a live connection ends.
    • Ensured repeated text frames correctly report translator budget exhaustion instead of ending silently.
    • Confirmed translator resources are fully released after the error.
  • Tests

    • Added coverage for clean connection termination and translator budget limits.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 265043bd-a29c-42b5-8f26-72b9b625f65a

📥 Commits

Reviewing files that changed from the base of the PR and between e97fb26 and 6752130.

📒 Files selected for processing (2)
  • src/adapters/cursor/live-transport.ts
  • tests/cursor-hardening.test.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The live transport now catches asynchronous frame-drain failures through .catch(). A hardening test covers repeated text frames, clean Connect EOF, translator budget exhaustion, and complete buffer release.

Changes

Live transport hardening

Layer / File(s) Summary
Transport failure cleanup and regression coverage
src/adapters/cursor/live-transport.ts, tests/cursor-hardening.test.ts
At line 1078, asynchronous frame-drain failures now invoke failAndClear through .catch(). Lines 447–500 add coverage for repeated assistant text frames that exceed the 1,000-byte translator budget, assert TranslatorBudgetExceededError with translation_buffer_limit, and verify that zero buffered bytes remain.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 67521

This localized change routes EOF terminal-synthesis budget errors into the existing failure path and adds focused regression coverage; no actionable merge-blocking risk remains at the current head.

Suggested reviewers: lidge-jun, wibias, yansigit

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the Cursor EOF error-handling fix for terminal translator budget overflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-cursor-eof-synthesis-vulnerability

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

@github-actions github-actions Bot changed the title fix(cursor): catch EOF terminal budget overflow [WRONG BRANCH] fix(cursor): catch EOF terminal budget overflow Aug 18, 2026
@github-actions

github-actions Bot commented Aug 18, 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 August 18, 2026 09:14
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