fix(images): bound bridge iteration buffering - #4388
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe image loop now enforces per-iteration limits for retained events and tool-call arguments. It propagates collection failures, passes bounded ChangesMedia iteration budget
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant Adapter
participant ImageLoop
participant Scanner
Adapter->>ImageLoop: runTurn emits adapter events
ImageLoop->>ImageLoop: retain events and enforce iteration budget
ImageLoop->>Scanner: pass collectedEvents without replay
Scanner-->>ImageLoop: process bounded iteration events
Merge Risk: ⚪ Minimal · up to The new per-iteration buffering limits are implemented and exercised across both supported collection paths, with no concrete unresolved merge risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
리뷰 · 우선순위 69 / 80설명 이 PR은 이미지/비디오 bridge의 숨은 iteration이 adapter event를 무제한으로 모아 두지 못하게 막습니다. 지금 패치는 iteration마다 독립 budget을 만들고, heartbeat를 제외한 이벤트를 JSON 직렬화 크기(+배열 구분자)로 청구합니다. tool_call_delta는 UTF-8 argument 누적과 surrogate pair 보정을 하고, 한도를 넘으면 producer를 abort한 뒤 라인 - 이게 무슨 문제다
surrogate pair 보정 (
structure 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
|
✅ Deterministic PR hygiene checks passed. |
|
Exact-head CI for 69a2e71 completed with failure: https://github.com/luvs01/opencodex/actions/runs/34681059993 Recorded recurring assertion groups concern Cline inventories (#4386), injection/journal fixtures (#4380), Devin paths (#4384), and pnpm shims (#4379). No media-loop assertion failure was identified in the inspected logs. These observations support separating shared failures from this change; they do not certify the entire run or prove every failure causal chain. The Combos |
⏳ DRAFT
What to do
Review readiness checklist
3/4 boxes ticked. This PR stays in draft until every box above is ticked. |
ebb4245 to
fd92048
Compare
|
Readiness update: the checklist in the description is now 4/4, and the evidence behind the first box is in the description. Short version. This head is rebased onto The first attempt of the matrix above failed the One thing I cannot do from my side: GitHub refuses |
fd92048 to
597a6a5
Compare
597a6a5 to
9518b52
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9518b52816
ℹ️ 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".
| if (!accepting || signal.aborted) return; | ||
| try { | ||
| // Check at emission, before even a synchronous producer can fill the queue. | ||
| iterationBudget.retain(event); |
There was a problem hiding this comment.
Charge the queue's coalesced events instead of discarded deltas
When a runTurn producer emits many small adjacent text or thinking deltas before the consumer is scheduled, createAdapterEventQueue coalesces them into chunks of up to 64 KiB, but this line charges every original event—including its JSON envelope—before queue.push performs that coalescing. For example, roughly 1,016,801 one-character text deltas occupy about 1 MiB in the retained, coalesced queue yet are charged over 32 MiB, causing a spurious translation_buffer_limit for output far below the documented limit. Charge the resulting coalesced representation, or otherwise keep the budget accounting synchronized with the queue's replacements.
Useful? React with 👍 / 👎.
Summary
Earlier focused verification (before this rebase)
bun test ./tests/images/loop.test.ts ./tests/images/loop-reasoning-replay.test.ts— 52 passed, 0 failed.bun run typecheck,bun run structure:check,bun run privacy:scan, andgit diff --checkpassed.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
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.
Current verification (2026-09-13)
Head: 597a6a5, rebased onto dev@17da84f89.
Focused tests, typecheck, structure check and privacy scan passed on this rebased source:
(pass) runWithImageBridge — runTurn adapter > runTurn adapter → preserves _cursorConversationId across iterations [1.09ms]
51 pass
0 fail
183 expect() calls
Ran 51 tests across 1 file. [4.25s]
The previous green matrix tested an older PR head with the pending #4384 fix added. It is integration evidence only, not a passing full-suite result for this published head. Full CI readiness remains open. The current dev tip has advanced beyond this tested base; further refresh will be coordinated with the shared Windows fixture fix to avoid repeatedly queuing matrices that inherit the same failure.
Summary by CodeRabbit
Bug Fixes
Documentation