Fix: multi-byte text decoding in stdout and stderr streams#2
Conversation
When streaming child process output, using chunk.toString() directly on Buffer chunks splits multi-byte characters (like Korean, Japanese, etc.) if the chunk boundary falls in the middle of a character sequence.
This replaces chunk.toString() with a TextDecoder initialized with { stream: true }, allowing it to safely buffer and decode incomplete bytes across stream chunks.
|
Warning Review limit reached
More reviews will be available in 47 minutes and 19 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo ChangesTextDecoder streaming decode for child process output
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/core/agent/AntigravityProvider.ts`:
- Around line 120-121: TextDecoder objects created with stream mode keep
buffered bytes that must be explicitly flushed when the stream ends. In
src/core/agent/AntigravityProvider.ts at lines 143-151 in the child.on('close')
handler, add calls to stdoutDecoder.decode() and stderrDecoder.decode() without
arguments before using stdoutFull and stderrFull to flush any remaining buffered
bytes from the decoders created at lines 120-121. Apply the same fix in
src/core/cli/ExternalCliRunner.ts at lines 172-179 in the child.on('close')
handler by adding calls to stdoutDecoder.decode() and stderrDecoder.decode()
without arguments before the resolve/reject logic to flush remaining bytes from
the decoders created at lines 154-155.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 591ca732-3cd4-4683-b4a8-47f10e917f85
📒 Files selected for processing (2)
src/core/agent/AntigravityProvider.tssrc/core/cli/ExternalCliRunner.ts
When streaming child process output, using chunk.toString() directly on Buffer chunks splits multi-byte characters (like Korean, Japanese, etc.) if the chunk boundary falls in the middle of a character sequence.
This replaces chunk.toString() with a TextDecoder initialized with { stream: true }, allowing it to safely buffer and decode incomplete bytes across stream chunks.
Korean Explanation (한국어 설명): 터미널에서 데이터를 받아올 때 청크(Chunk) 단위로 바이트가 끊겨서 한글이 `` 마크로 깨지는 문제를 해결하기 위해, TextDecoder에 { stream: true } 옵션을 추가했습니다! 좋은 플러그인 감사합니다.
Before (수정 전)
After (수정 후)
Summary by CodeRabbit