Bedrock streaming: no idle timeout on hung connections
Problem
When using Claude Code with Bedrock (CLAUDE_CODE_USE_BEDROCK=1), streaming responses occasionally hang indefinitely. The TCP connection establishes successfully, but no further bytes arrive. Claude Code waits forever with no visible output — the user sees a frozen session with no spinner, no thinking indicator, nothing.
Evidence
- CloudWatch shows zero throttles, zero client errors, zero server errors during the hang
- Normal invocation latency for this model (Opus 4.6, cross-region
us.profile) is 4–14s average, 26s max - The hung requests exceed 100+ seconds with no data
- Ctrl+C (user interrupt) recovers the session — confirming the client is alive, just waiting on a dead socket
- This occurs across both Opus 4.8 and Opus 4.6, so it's not model-specific
- Happens with cross-region inference enabled (
us.anthropic.claude-opus-4-6-v1)
Expected behavior
Claude Code should detect "no bytes received in N seconds" on an active streaming connection and either:
- Abort the request and retry (transparent to user), or
- Surface a "connection stalled, retrying..." message
A 30–60s idle timeout on the streaming read would catch this without interfering with legitimate long first-token latency.
Environment
- Claude Code 2.1.159
- macOS (Darwin 25.1.0)
CLAUDE_CODE_USE_BEDROCK=1AWS_REGION=us-east-1- Model:
us.anthropic.claude-opus-4-6-v1[1m] - Cross-region inference active (us-east-1, us-east-2, us-west-2)
Reproduction
Not reliably reproducible on demand. Occurs intermittently (~1-3 times per heavy-use day with 3-4 concurrent sessions). More likely during extended sessions with large context windows.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗