Skip to content

Instantly share code, notes, and snippets.

@dexhorthy
Last active September 26, 2025 00:53
Show Gist options
  • Select an option

  • Save dexhorthy/b40c276a49e5590aa70c8c78ff47763c to your computer and use it in GitHub Desktop.

Select an option

Save dexhorthy/b40c276a49e5590aa70c8c78ff47763c to your computer and use it in GitHub Desktop.
Claude Code v1.0.124 Session Resume Behavior Change - Undocumented Breaking Change

Claude Code Session Resume Behavior Change

Summary

Claude Code v1.0.124 introduced an undocumented breaking change in session resume behavior:

  • 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.

Quick Test

# Prerequisites
export ANTHROPIC_API_KEY="your-api-key"

# Build and run tests
docker compose build
docker compose run --rm claude-test ./test.sh 1.0.123
docker compose run --rm claude-test ./test.sh 1.0.124

Results

Version 1.0.123 (Old Behavior)

{
  "behavior": "creates_new_id",
  "session_ids": {
    "initial": "66658f92-2cd1-48a5-a904-9acbbf0197cb",
    "resumed": "dc038920-1cb0-4d21-b417-98fcb753b54c",
    "identical": false
  }
}

Version 1.0.124 (New Behavior)

{
  "behavior": "reuses_same_id",
  "session_ids": {
    "initial": "b41d4917-26d4-4dcd-84bf-dc429457ed39",
    "resumed": "b41d4917-26d4-4dcd-84bf-dc429457ed39",
    "identical": true
  }
}

Impact

This undocumented change can break applications that:

  • Track sessions by Claude session ID
  • Assume new session IDs indicate new conversation branches
  • Store conversation events keyed by session ID

Files

  • README.md - This documentation
  • test.sh - Test script that demonstrates the behavior
  • Dockerfile - Ubuntu container with Claude installation
  • docker-compose.yaml - Docker compose configuration
services:
claude-test:
build: .
environment:
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
volumes:
- ./test.sh:/app/test.sh:ro
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/
RUN chmod +x /app/test.sh
# Entry point
CMD ["/app/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..."
curl -fsSL https://claude.ai/install.sh | bash -s -- --version "$VERSION" >/dev/null 2>&1
export PATH="$HOME/.local/bin:$PATH"
# Verify installation
INSTALLED_VERSION=$(claude --version 2>/dev/null || echo "Not installed")
echo "Installed: $INSTALLED_VERSION"
# Check API key
if [ -z "$ANTHROPIC_API_KEY" ]; then
echo "ERROR: ANTHROPIC_API_KEY not set"
exit 1
fi
# Test 1: Create initial session
echo -e "\n1. Creating initial session with 'say foo'"
echo "----------------------------------------"
timeout 30 claude --print --output-format=stream-json --verbose "say foo" > session1.jsonl 2>&1
SESSION1_ID=$(grep -o '"session_id":"[^"]*"' session1.jsonl | head -1 | cut -d'"' -f4)
echo "Initial session ID: $SESSION1_ID"
# Test 2: Resume session
echo -e "\n2. Resuming session with 'say bar'"
echo "----------------------------------------"
timeout 30 claude --print --output-format=stream-json --verbose --resume "$SESSION1_ID" "say bar" > session2.jsonl 2>&1
SESSION2_ID=$(grep -o '"session_id":"[^"]*"' session2.jsonl | head -1 | cut -d'"' -f4)
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 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment