def test_stateless_request_isolation(self, mock_redis):
        """Test that each request cycle is independent but shares context via Redis"""
        mock_client = Mock()
        mock_redis.return_value = mock_client

        # Simulate two different "processes" accessing same thread
        thread_id = "12345678-1234-1234-1234-123456789012"

        # Process 1: Creates thread
        initial_context = ThreadContext(
            thread_id=thread_id,
            created_at="2023-01-01T00:00:00Z",
            last_updated_at="2023-01-01T00:00:00Z",
            tool_name="thinkdeep",
            turns=[],
            initial_context={"prompt": "Think about architecture"},
        )
        mock_client.get.return_value = initial_context.model_dump_json()

        success = add_turn(
            thread_id, "assistant", "Architecture analysis", follow_up_question="Want to explore scalability?"
        )
        assert success is True

        # Process 2: Different "request cycle" accesses same thread
        context_from_redis = ThreadContext(
            thread_id=thread_id,
            created_at="2023-01-01T00:00:00Z",
            last_updated_at="2023-01-01T00:01:00Z",
            tool_name="thinkdeep",
            turns=[
                ConversationTurn(
                    role="assistant",
                    content="Architecture analysis",
                    timestamp="2023-01-01T00:00:30Z",
                    follow_up_question="Want to explore scalability?",
                )
            ],
            initial_context={"prompt": "Think about architecture"},
        )
        mock_client.get.return_value = context_from_redis.model_dump_json()

        # Verify context continuity across "processes"
        retrieved_context = get_thread(thread_id)
        assert retrieved_context is not None
        assert len(retrieved_context.turns) == 1
        assert retrieved_context.turns[0].follow_up_question == "Want to explore scalability?"
Test that each request cycle is independent but shares context via Redis
tests/test_conversation_memory.py