Bug fix: Gemini CLI bridge crashes on large MCP tool responses - raise gemini cli stream buffer limit to 10 MB#1242
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 29 minutes and 56 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughSets the subprocess StreamReader buffer limit to 10 MB by passing Changes
🚥 Pre-merge checks | ✅ 7 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (7 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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 |
the default asyncio StreamReader limit of 64 KB causes crashes when an MCP tool returns a large response (e.g. kubernetes events list). closes ambient-code#1126 Signed-off-by: Vishali <vsanghis@redhat.com>
spawns a real subprocess that outputs 100 KB on a single line and verifies readline() succeeds — would crash with the default 64 KB StreamReader limit. Signed-off-by: Vishali <vsanghis@redhat.com>
49ca627 to
191c091
Compare
Summary
Raises the
asyncio.StreamReaderbuffer limit from the default 64 KB to 10 MB when spawning the Gemini CLI subprocess. Preventsasyncio.LimitOverrunErrorcrashes when an MCP tool (e.g.mcp_kubernetes_events_list) returns a large NDJSON line.Closes #1126
What changed
One-line fix in
session.py— addedlimit=10 * 1024 * 1024to theasyncio.create_subprocess_execcall.How I tested
Unit test —
test_stream_buffer_limit_raisedmockscreate_subprocess_execand asserts thelimitkwarg is10 * 1024 * 1024.Integration test —
test_large_stdout_line_does_not_crashspawns a real subprocess that outputs 100 KB on a single line (well above the old 64 KB default) and reads it with the 10 MB limit. This would crash withValueError: Separator is found, but chunk is longer than limitunder the old default. Passes with our fix.Full E2E reproduction (triggering an actual Gemini CLI session with a large MCP tool response) requires a running ACP instance with Gemini API keys, so that's not included here. The integration test proves the mechanism at the
asynciolevel.Summary by CodeRabbit
Bug Fixes
Tests