def test_claude_can_use_continuation_id(self, mock_redis):
        """Test that Claude can use the provided continuation_id in subsequent calls"""
        mock_client = Mock()
        mock_redis.return_value = mock_client

        # Step 1: Initial request creates continuation offer
        request1 = ToolRequest(prompt="Analyze code structure")
        continuation_data = {"remaining_turns": 4, "tool_name": "test_continuation"}
        response1 = self.tool._create_continuation_offer_response(
            "Structure analysis done.", continuation_data, request1
        )

        thread_id = response1.continuation_offer.continuation_id

        # Step 2: Mock the thread context for Claude's follow-up
        from utils.conversation_memory import ConversationTurn, ThreadContext

        existing_context = ThreadContext(
            thread_id=thread_id,
            created_at="2023-01-01T00:00:00Z",
            last_updated_at="2023-01-01T00:01:00Z",
            tool_name="test_continuation",
            turns=[
                ConversationTurn(
                    role="assistant",
                    content="Structure analysis done.",
                    timestamp="2023-01-01T00:00:30Z",
                    tool_name="test_continuation",
                )
            ],
            initial_context={"prompt": "Analyze code structure"},
        )
        mock_client.get.return_value = existing_context.model_dump_json()

        # Step 3: Claude uses continuation_id
        request2 = ToolRequest(prompt="Now analyze the performance aspects", continuation_id=thread_id)

        # Should still offer continuation if there are remaining turns
        continuation_data2 = self.tool._check_continuation_opportunity(request2)
        assert continuation_data2 is not None
        assert continuation_data2["remaining_turns"] == 8  # MAX_CONVERSATION_TURNS(10) - current_turns(1) - 1
        assert continuation_data2["tool_name"] == "test_continuation"
Test that Claude can use the provided continuation_id in subsequent calls
tests/test_claude_continuation.py