Feature: Pass reasoning_effort config to Gemini CLI (thinking output leaks to Telegram)
Summary
When using Gemini CLI with models that support thinking (e.g., gemini-3-flash-preview), the thinking/reasoning output appears as literal text in the streamed response. Specifically, [Thought: true] markers and the reasoning content that follows are included in the message events and delivered directly to Telegram without filtering.
Current Behavior
- Config
reasoning_effortexists inconfig.jsonbut is only passed to Codex, not Gemini CLI - Gemini CLI bundle has a
thought_levelsession config option, but ductor doesn't configure it gemini_events.py_parse_message_content_block()treats alltexttype blocks as regular content — no filtering of thinking markers- Result:
[Thought: true]+ reasoning text appears in Telegram messages
Expected Behavior
reasoning_effortconfig should be propagated to Gemini CLI (e.g., viaGEMINI_THINKING_LEVELenv var or Gemini settings)- Alternatively,
gemini_events.pyshould filter out thinking content from message events before delivering to Telegram
Environment
- ductor: 0.15.0
- Gemini CLI: installed via npm (
@google/gemini-cli) - Model:
gemini-3-flash-preview(thinking enabled by default) - Python: 3.12.3
Relevant Code
gemini_events.py_parse_message_content_block()— no thinking filter (Codex'sstream_events.pyhasThinkingEventhandling, but Gemini parser doesn't)gemini_provider.py—reasoning_effortparameter not passed to Gemini CLI command- Gemini CLI bundle contains
thought_levelas a session config category
Suggested Fix
- Pass
reasoning_effortto Gemini CLI (e.g., environment variable or CLI flag) - Add thinking marker filtering in
gemini_events.pyas a fallback for models that embed thinking in text content
Fixed in v0.16.0 (commit fd80c42).
Root cause traced to the Gemini CLI bundled chunk (chunk-EA775AOR.js::toPart2) wrapping thought: true parts as [Thought: ${value}]\n<text>. The fix lives at the NDJSON parser boundary (gemini_events.py::_split_thought_and_text) — thought markers are filtered out and routed into the existing provider-neutral ThinkingEvent. Any non-thought content after the marker is preserved. Version-agnostic: the fix holds regardless of your settings.json or Gemini CLI version.