Dev/issue 1#147
Conversation
tiktoken's recursive BPE merging overflows the call stack on very long inputs, causing pyo3_runtime.PanicException: StackOverflow. Split text into chunks (<= 100k chars) at line boundaries before encoding. Short text takes the original fast path unchanged. Fixes #116
The server currently does not support session.finish event for qwen3.5-omni-flash-realtime, returning an error instead of session.finished. Previously end_session() would wait the full timeout duration (20s) before falling back to ws.close(). Now the method detects server error events immediately and closes the connection without waiting, reducing wait time from 20s to <0.1s when the server rejects session.finish. Related to issue #140
There was a problem hiding this comment.
Code Review
This pull request introduces several enhancements, including proxy support via trust_env=True in aiohttp sessions, incremental response merging for application streams, improved error handling during real-time audio session teardown, and text chunking in the Qwen tokenizer to prevent stack overflow on long inputs. The review feedback highlights critical issues: a potential AttributeError when merging responses due to a missing choices attribute, a risk of overwriting the default SDK user-agent header, the need to raise an exception rather than silently ignoring errors during session termination, and an O(N^2) performance bottleneck in the tokenizer's text-splitting logic.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
- Add trust_env=True to base_api.py async task polling (issue #112) - Extract user_agent from kwargs in api_request_factory to ensure incremental_to_full flag reaches HTTP header (issue #4) - Update test to verify user_agent doesn't leak into request body Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Description
[Describe what this PR does and why]
Related Issue: Fixes #[issue_number] or Relates to #[issue_number]
Security Considerations: [Check if API keys or sensitive credentials are exposed in code/logs]
Type of Change
Component(s) Affected
Checklist
Testing
[How to test these changes]
Additional Notes
[Optional: any other context]