anthropics / anthropics/claude-agent-sdk-typescript

[BUG] Assistant messages within Task sidechain not streamed when includePartialMessages is enabled

Aperta
#22 1 commento 3 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Shell
Stelle
1.8k
Fork
226
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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

```shell

```

### Steps to Reproduce
```json
// 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

0.1.14

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

_No response_

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.