[BUG] include_partial_messages unreliable with ClaudeSDKClient (streaming input mode)

Resolved 💬 2 comments Opened Jan 13, 2026 by fohara Closed Feb 27, 2026

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 ClaudeSDKClient from the Python SDK with include_partial_messages=True, StreamEvent objects are either never yielded or yielded unreliably (related to #15055).

Documentation inconsistency: The CLI help states:

--include-partial-messages    Include partial message chunks as they arrive 
                              (only works with --print and --output-format=stream-json)

However, ClaudeSDKClient operates in streaming input mode (--input-format stream-json) rather than --print mode. This suggests --include-partial-messages should have no effect when using ClaudeSDKClient, yet #15055 shows StreamEvent objects ARE sometimes returned.

The issue: It's unclear whether:

  1. The CLI help text is outdated and the flag DOES work in streaming input mode
  2. The flag is intended to work but has reliability issues
  3. The flag is not supposed to work in streaming input mode (and any StreamEvents received are incidental)

Steps to Reproduce

import asyncio
from claude_agent_sdk import ClaudeSDKClient
from claude_agent_sdk.types import ClaudeAgentOptions, StreamEvent

async def main():
    options = ClaudeAgentOptions(
        include_partial_messages=True,
        permission_mode="bypassPermissions",
    )
    
    async with ClaudeSDKClient(options) as client:
        await client.query("Count from 1 to 5, one number per line")
        
        stream_event_count = 0
        async for message in client.receive_response():
            if isinstance(message, StreamEvent):
                stream_event_count += 1
                print(f"StreamEvent: {message.event.get('type', 'unknown')}")
            else:
                print(f"Message type: {type(message).__name__}")
        
        print(f"\nTotal StreamEvents received: {stream_event_count}")

asyncio.run(main())

Expected: StreamEvent objects should be consistently yielded when include_partial_messages=True.

Actual: Zero StreamEvent objects received in some/all runs.

What Should Happen?

  1. The CLI documentation should clarify whether --include-partial-messages is supported in streaming input mode (--input-format stream-json)
  2. If supported, StreamEvent objects should be reliably yielded
  3. If not supported, the SDK should either warn users or not pass the flag in streaming mode

Environment

  • Claude Code version: 2.1.5
  • claude-agent-sdk version: 0.1.18
  • Platform: macOS
  • Python: 3.13

Related Issues

  • #15055 - Shows 20-70% of concurrent sessions fail to receive StreamEvent objects

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗