Skip to content

fix(cursor): catch EOF terminal budget overflow - #2224

Merged
Ingwannu merged 1 commit into
lidge-jun:devfrom
luvs01:agent/cursor-eof-terminal-budget-current
Aug 21, 2026
Merged

fix(cursor): catch EOF terminal budget overflow#2224
Ingwannu merged 1 commit into
lidge-jun:devfrom
luvs01:agent/cursor-eof-terminal-budget-current

Conversation

@luvs01

@luvs01 luvs01 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • route exceptions thrown by Cursor clean-EOF finalization through the same terminal failure handler used for drain failures
  • prevent a translator-budget exception raised inside the fulfilled continuation from becoming an unhandled rejection that can leave the turn unsettled
  • preserve the existing EOF classification, single-shot settler, and idempotent backlog-lease cleanup contracts

Exact base: 03735eca62398c55056d4595145561aecc444e91
Exact head: deacd53f79e1ff4eaea6baa28a4d849809e8d673

Verification

  • Bun 1.4 Cursor hardening — 41/41 passed
  • Bun 1.4 adjacent EOF terminal and live transport — 23/23 passed
  • Bun 1.4 typecheck — passed
  • privacy scan and git diff --check — passed
  • independent current-diff review — no findings

The full repository suite was not duplicated locally; maintained cross-platform CI remains the merge gate. No GUI, configuration, credential, or protocol surface is changed.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed; this internal error-routing fix adds no user-facing workflow or configuration.
  • Failure, terminal-settlement, and retained-budget cleanup behavior were reviewed for unsafe defaults and residual ownership.

Review readiness checklist

  • All CI tests are green on my local testing.
  • I pushed my PR to the latest dev commit.
  • I resolved all correct Codex and CodeRabbit findings.
  • My PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

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

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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: 950c935d-a575-4917-80c3-053ff9c03a90

📥 Commits

Reviewing files that changed from the base of the PR and between 03735ec and deacd53.

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

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Cursor stream hardening

Layer / File(s) Summary
Stream finalization and budget regression
src/adapters/cursor/live-transport.ts, tests/cursor-hardening.test.ts
The stream-end promise routes failures through chained .catch(...) handling and failAndClear at line 1132. The new test sends repeated text frames through clean EOF synthesis, verifies TranslatorBudgetExceededError with translation_buffer_limit, and confirms that no buffered bytes remain at lines 626–678.

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

Merge Risk: ⚪ Minimal · up to deacd

This localized fix routes EOF finalization failures through the existing terminal failure path without changing user-facing configuration or protocol behavior. No actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: lidge-j

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the fix for Cursor EOF terminal budget overflow, which is the main change in the pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 Aug 20, 2026

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

4/4 boxes ticked.

This pull request is already Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers: @lidge-jun @Ingwannu

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 63 / 80

구멍은 Promise 2인자임. 지금 dev src/adapters/cursor/live-transport.ts onStreamEnd가 drain 루프를 .then(성공, 실패)로 붙임. 프레임 체인은 이미 .catchfailAndClear를 탐 (:1009-1011). EOF 최종화만 2인자라서 onFulfilled 안에서 터진 예외는 거기로 안 감. finalizeTurnEvents / push / settleFinishTranslatorBudgetExceededError 내면 언핸들드 리젝션이고 턴은 안 끝남. 백로그 리스도 안 풀릴 수 있음.

이 PR은 그 .then.catch로 바꿈. 한 줄. 성공 콜백에서 난 예외도 failAndClear로 감. failAndClearreleaseBacklogLease 다음에 세틀러로 들어가니 아이덴포턴트 정산 계약은 그대로임. 분류/싱글샷 세틀러/리스 정리는 안 건드림. 방향 맞음.

테스트가 maxTurnBytes: 1_000에 텍스트 프레임 37개 + clean Connect EOF를 넣음. TranslatorBudgetExceededError / translation_buffer_limit 나오고 budget.snapshot().currentBytes가 0임. 예외만 잡고 바이트를 안 풀면 실패하는 케이스임. ㅋㅋ 그 어서션이 핵심임.

#2195 터미널 가드 델타랑 다른 선임. 그건 머지됨. 이건 EOF 합성 경로의 캐치 구멍임. #2210 스톨 워치독이랑도 다름. 브릿지 idle이 아니라 트랜스포트 버짓임. #2212 composer-2.5 continuation이랑 안 섞을 것. types.ts/config.ts 스플릿 안 씹힘. live-transport.ts랑 테스트만임. base가 지금 HEAD 03735eca6랑 같음. 리베이스 필요 없음. 닫을 중복 아님.

review-ready고 draft 아님. Cursor hardening 41, adjacent EOF 23, typecheck 그린이라 했음. 전체 스위트는 로컬에서 안 돌렸다 함. CI가 머지 게이트임. 2.28 블로커는 아님. 그래도 턴이 안 끝나는 구멍이라 점수는 높음.

해결방안: CI 그린이면 dev 머지. .then(ok, err)를 이 파일에 다시 넣지 말 것. 프레임 체인처럼 .catch만 쓸 것. 버짓 초과 실패 뒤에 currentBytes === 0 어서션 유지.

이 댓글은 grok-bot이 작성했습니다

@Ingwannu Ingwannu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed exact head deacd53. The EOF finalization rejection now reaches the existing failAndClear path, and the regression covers both the translation_buffer_limit failure and released budget bytes. No unresolved threads remain and the exact-head CI rollup is green. Approved for dev.

@Ingwannu
Ingwannu merged commit 826a1b7 into lidge-jun:dev Aug 21, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants