[BUG] Breaking Change in Claude Code SDK v1.0.124 Session Resume Behavior
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?
Summary
Claude Code v1.0.124 introduced a breaking change that fundamentally alters how session resume functionality works:
- v1.0.123 and earlier: Creates a NEW session ID when using
--resume - v1.0.124 and later: Reuses the SAME session ID when using
--resume
This change breaks systems that rely on the previous behavior of creating new session IDs on resume, causing issues with session tracking, conversation branching, and event storage systems.
What Should Happen?
when new sessions are created with --resume, they should get a new session_id
Error Messages/Logs
Steps to Reproduce
Prerequisites
- Docker and Docker Compose installed (optional, recommended)
- Anthropic API Key
- Set your API key:
``bash``
export ANTHROPIC_API_KEY="your-api-key-here"
Method 1: Using Docker (Recommended)
- Create a new directory for testing:
``bash``
mkdir claude-session-test && cd claude-session-test
- Save the test files provided below
- Build the Docker image:
``bash``
docker compose build
- Test version 1.0.123 (creates new session IDs):
``bash``
docker compose run --rm claude-test ./test.sh 1.0.123
- Test version 1.0.124 (reuses session IDs):
``bash``
docker compose run --rm claude-test ./test.sh 1.0.124
Method 2: Direct Installation (Local)
- Save the test script below as
test.sh - Make it executable:
``bash``
chmod +x test.sh
- Run tests:
``bash``
./test.sh 1.0.123 # Old behavior
./test.sh 1.0.124 # New behavior
Expected Results
Version 1.0.123 (Old Behavior)
Session IDs are DIFFERENT (creates_new_id)
Initial: 66658f92-2cd1-48a5-a904-9acbbf0197cb
Resumed: dc038920-1cb0-4d21-b417-98fcb753b54c
Version 1.0.124 (New Behavior)
Session IDs are IDENTICAL (reuses_same_id)
Initial: b41d4917-26d4-4dcd-84bf-dc429457ed39
Resumed: b41d4917-26d4-4dcd-84bf-dc429457ed39
Test Files
docker-compose.yaml
services:
claude-test:
build: .
environment:
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
Dockerfile
FROM ubuntu:22.04
# Install dependencies
RUN apt-get update && apt-get install -y \
curl \
bash \
jq \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set up working directory
WORKDIR /app
# Copy test script
COPY test.sh /app/test.sh
RUN chmod +x /app/test.sh
CMD ["/bin/bash", "/app/test.sh"]
test.sh
#!/bin/bash
set -e
VERSION="${1:-1.0.124}"
echo "================================================"
echo "Testing Claude Code version: $VERSION"
echo "================================================"
# Install specific Claude version
echo "Installing Claude $VERSION..."
echo "Downloading installer..."
# Download and run installer with timeout and error checking
if ! timeout 60 bash -c "curl -fsSL https://claude.ai/install.sh | bash -s -- '$VERSION'" 2>&1; then
echo "ERROR: Failed to install Claude $VERSION"
exit 1
fi
export PATH="$HOME/.local/bin:$PATH"
# Verify installation
INSTALLED_VERSION=$(claude --version 2>/dev/null || echo "Not installed")
echo "Installed: $INSTALLED_VERSION"
if [ "$INSTALLED_VERSION" = "Not installed" ]; then
echo "ERROR: Claude installation failed"
exit 1
fi
# Check API key
if [ -z "$ANTHROPIC_API_KEY" ]; then
echo "ERROR: ANTHROPIC_API_KEY not set"
exit 1
fi
echo "API key is set"
# Test 1: Create initial session
echo -e "\n1. Creating initial session with 'say foo'"
echo "----------------------------------------"
if ! timeout 30 claude --print --output-format=stream-json --verbose "say foo" > session1.jsonl 2>&1; then
echo "ERROR: Failed to create initial session"
cat session1.jsonl
exit 1
fi
SESSION1_ID=$(grep -o '"session_id":"[^"]*"' session1.jsonl | head -1 | cut -d'"' -f4)
if [ -z "$SESSION1_ID" ]; then
echo "ERROR: No session ID found in response"
cat session1.jsonl
exit 1
fi
echo "Initial session ID: $SESSION1_ID"
# Test 2: Resume session
echo -e "\n2. Resuming session with 'say bar'"
echo "----------------------------------------"
if ! timeout 30 claude --print --output-format=stream-json --verbose --resume "$SESSION1_ID" "say bar" > session2.jsonl 2>&1; then
echo "ERROR: Failed to resume session"
cat session2.jsonl
exit 1
fi
SESSION2_ID=$(grep -o '"session_id":"[^"]*"' session2.jsonl | head -1 | cut -d'"' -f4)
if [ -z "$SESSION2_ID" ]; then
echo "ERROR: No session ID found in resume response"
cat session2.jsonl
exit 1
fi
echo "Resumed session ID: $SESSION2_ID"
# Compare results
echo -e "\n3. Results"
echo "----------------------------------------"
if [ "$SESSION1_ID" = "$SESSION2_ID" ]; then
BEHAVIOR="reuses_same_id"
IDENTICAL=true
echo "✓ Session IDs are IDENTICAL (reuses_same_id)"
else
BEHAVIOR="creates_new_id"
IDENTICAL=false
echo "✓ Session IDs are DIFFERENT (creates_new_id)"
fi
# Extract turn counts
TURNS1=$(grep -o '"num_turns":[0-9]*' session1.jsonl | tail -1 | cut -d: -f2)
TURNS2=$(grep -o '"num_turns":[0-9]*' session2.jsonl | tail -1 | cut -d: -f2)
echo "Conversation turns: $TURNS1 -> $TURNS2"
# Save summary
cat > summary.json <<EOF
{
"version": "$VERSION",
"installed_version": "$INSTALLED_VERSION",
"behavior": "$BEHAVIOR",
"session_ids": {
"initial": "$SESSION1_ID",
"resumed": "$SESSION2_ID",
"identical": $IDENTICAL
},
"conversation_turns": {
"initial": $TURNS1,
"resumed": $TURNS2
}
}
EOF
echo -e "\nSummary:"
cat summary.json | jq -c .
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
1.0.123
Claude Code Version
1.0.124
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Please either:
- Revert to the v1.0.123 behavior (create new session IDs on resume), OR
- Document this breaking change clearly in the release notes and provide a migration guide, OR
- Add a flag to control this behavior (e.g.,
--resume-same-sessionvs--resume-new-session)
Potentially related to https://github.com/anthropics/claude-code/issues/8176
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗