[BUG] Assistant messages within Task sidechain not streamed when includePartialMessages is enabled
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using the Claude Code SDK with includePartialMessages: true, Task tool calls are missing the assistant messages that should be part of the Task's sidechain execution. While user messages and tool results within the sidechain are streamed correctly, the assistant messages that belong to the Task (with parent_tool_use_id) are not included in the streaming data.
What Should Happen?
Expected Behavior
When includePartialMessages: true is enabled, during Task execution, the sidechain should include both:
✅ User messages (tool results, etc.) with parent_tool_use_id: 'Task_1'
✅ Assistant messages with parent_tool_use_id: 'Task_1'
Actual Behavior
With includePartialMessages: true, within the Task sidechain:
✅ User messages are streamed correctly
✅ Tool result messages are streamed correctly
❌ Assistant messages are not streamed - these should contain the assistant's reasoning, analysis, and responses during Task execution
Comparison with Historical Data
The same conversation stored in .claude/*.jsonl files contains the complete sidechain including:
User messages with tool results
Assistant messages with text responses, analysis, and reasoning during Task execution
All messages properly marked with parent_tool_use_id or isSidechain: true
Impact
This causes significant UX issues where:
Users only see tool executions but not the assistant's reasoning process during Task execution
The Task appears to run "silently" without showing the assistant's thought process
Important context and explanations during Task execution are missing
The conversation flow within Tasks is incomplete and hard to follow
The includePartialMessages feature doesn't provide the full picture of Task execution
Error Messages/Logs
Steps to Reproduce
// Sidechain assistant messages - ❌ Missing
{
type: 'assistant',
parent_tool_use_id: 'Task_1',
message: {
content: [{
type: 'text',
text: 'Let me analyze this file structure...'
}]
}
}
Claude Model
Sonnet (default)
Last Working Version
_No response_
Claude Code Version
1.0.127
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗