Skip to content

Fix/streaming output tracking#343

Closed
chrisnestrud wants to merge 11 commits intocecli-dev:mainfrom
chrisnestrud:fix/streaming-output-tracking
Closed

Fix/streaming output tracking#343
chrisnestrud wants to merge 11 commits intocecli-dev:mainfrom
chrisnestrud:fix/streaming-output-tracking

Conversation

@chrisnestrud
Copy link
Copy Markdown

fix: avoid empty response warning when only tool calls are present

Problem:
--------
When using models that return tool calls without any text content (e.g., DeepSeek
models in non-streaming mode), aider incorrectly displayed the warning:
"Empty response received from LLM. Check your provider account?"

This was misleading because the model had actually returned valid tool calls - it
just didn't return any text content to display.

Root Cause:
-----------
The empty response warning logic only checked if text content was received, but
didn't account for other valid response types:
- Tool calls (function invocations)
- Function calls (legacy format)
- Reasoning content (for reasoning models)

In non-streaming mode, the code called assistant_output() with an empty string
when there were only tool calls, which triggered the warning in the TUI's
assistant_output() method.

Solution:
---------
1. Added partial response tracking system with flags for:
   - content: Regular text content
   - reasoning: Reasoning/thinking content
   - tool_calls: Tool/function call invocations
   - function_call: Legacy function call format

2. Modified show_send_output() to detect and register all response types in
   non-streaming mode before calling assistant_output()

3. Updated the empty response check to only show the warning when NO response
   type was received (truly empty response)

4. Added comprehensive test coverage for:
   - Flag initialization and registration
   - Response type detection in both streaming and non-streaming modes
   - Edge cases (tool calls only, reasoning only, etc.)

Changes:
--------
- aider/coders/base_coder.py:
  - Added _reset_partial_response_flags()
  - Added _register_partial_response()
  - Added _received_any_partial_response()
  - Enhanced show_send_output() to detect all response types
  - Updated empty response warning logic

- tests/basic/test_coder.py:
  - Added 20+ new tests covering partial response tracking

Impact:
-------
- Users will no longer see misleading "Empty response" warnings when models
  return valid tool calls without text content
- The warning will still be shown for truly empty responses (no content, no
  tool calls, no reasoning)
- No breaking changes to existing functionality

Co-authored-by: aider-ce (synthetic/hf:zai-org/GLM-4.7)
Co-authored-by: aider-ce (synthetic/hf:Qwen/Qwen3-Coder-480B-A35B-Instruct)
Co-authored-by: aider-ce (openai/gpt-5-codex)
Co-authored-by: aider-ce (openai/gpt-5-codex)
Co-authored-by: aider-ce (openai/gpt-5-codex)
@chrisnestrud chrisnestrud marked this pull request as draft January 1, 2026 16:19
@chrisnestrud chrisnestrud marked this pull request as ready for review January 4, 2026 21:36
@gopar
Copy link
Copy Markdown

gopar commented Jan 5, 2026

Hey @chrisnestrud are you able to update the pr so that it passes CI?

Resolved merge conflicts by accepting HEAD's version for:
- cecli/coders/base_coder.py
- cecli/io.py
- cecli/tui/io.py
- tests/basic/test_coder.py
@dwash96
Copy link
Copy Markdown
Collaborator

dwash96 commented Jan 17, 2026

This should also be addressed in v0.96.0

@dwash96 dwash96 closed this Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants