Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(test): remove zero-assertion and mock-choreography Max AI tests (#66421)

Georges-Antoine Assi3229f1c900b5
diff --git a/ee/hogai/chat_agent/parallel_task_execution/test/test_nodes.py b/ee/hogai/chat_agent/parallel_task_execution/test/test_nodes.py
index 69fd4d43273b..c9d7d933304b 100644
--- a/ee/hogai/chat_agent/parallel_task_execution/test/test_nodes.py
+++ b/ee/hogai/chat_agent/parallel_task_execution/test/test_nodes.py
@@ -134,48 +134,6 @@ class TestTaskExecution(TestBaseTaskExecutorNode):
self.assertEqual(execution_order, ["task3", "task2", "task1"])
-class TestReasoningCallback(TestBaseTaskExecutorNode):
- @patch("ee.hogai.chat_agent.parallel_task_execution.nodes.BaseTaskExecutorNode._write_message")
- async def test_reasoning_callback_for_single_task(self, mock_write_message):
- """Test that reasoning messages are sent for single task execution."""
- task = self._create_task("task1")
-
- async def task_coroutine(input_dict):
- # Simulate sending reasoning messages
- await self.node._reasoning_callback("task1", "Starting analysis")
- await self.node._reasoning_callback("task1", "Processing data")
- return self._create_task_result("task1")
-
- state = MockTestState()
- state.test_input_tuples = [(task, [], task_coroutine)]
- config = RunnableConfig()
-
- await self.node.arun(state, config)
-
- @patch("ee.hogai.chat_agent.parallel_task_execution.nodes.BaseTaskExecutorNode._write_message")
- async def test_reasoning_callback_for_multiple_tasks(self, mock_write_message):
- """Test that task execution messages are updated for multiple tasks."""
- task1 = self._create_task("task1")
- task2 = self._create_task("task2")
-
- async def task1_coroutine(input_dict):
- await self.node._reasoning_callback("task1", "Task 1 progress")
- return self._create_task_result("task1")
-
- async def task2_coroutine(input_dict):
- await self.node._reasoning_callback("task2", "Task 2 progress")
- return self._create_task_result("task2")
-
- state = MockTestState()
- state.test_input_tuples = [
- (task1, [], task1_coroutine),
- (task2, [], task2_coroutine),
- ]
- config = RunnableConfig()
-
- await self.node.arun(state, config)
-
-
class TestErrorHandling(TestBaseTaskExecutorNode):
@patch("ee.hogai.chat_agent.parallel_task_execution.nodes.capture_exception")
async def test_handles_task_failure(self, mock_capture):
@@ -276,41 +234,6 @@ class TestArtifactHandling(TestBaseTaskExecutorNode):
self.assertEqual(received_artifacts, [input_artifact])
-class TestMessageFlow(TestBaseTaskExecutorNode):
- @patch("ee.hogai.chat_agent.parallel_task_execution.nodes.BaseTaskExecutorNode._write_message")
- async def test_no_task_execution_message_for_single_task(self, mock_write_message):
- """Test that no TaskExecutionMessage is sent for single task."""
- task = self._create_task("task1")
-
- async def task_coroutine(_: Any):
- return self._create_task_result("task1")
-
- state = MockTestState()
- state.test_input_tuples = [(task, [], task_coroutine)]
- config = RunnableConfig()
-
- await self.node.arun(state, config)
-
- @patch("ee.hogai.chat_agent.parallel_task_execution.nodes.BaseTaskExecutorNode._write_message")
- async def test_task_execution_messages_for_multiple_tasks(self, mock_write_message):
- """Test that TaskExecutionMessages are sent for multiple tasks."""
- task1 = self._create_task("task1")
- task2 = self._create_task("task2")
-
- async def task_coroutine(input_dict):
- task_id = input_dict["task"].id
- return self._create_task_result(task_id)
-
- state = MockTestState()
- state.test_input_tuples = [
- (task1, [], task_coroutine),
- (task2, [], task_coroutine),
- ]
- config = RunnableConfig()
-
- await self.node.arun(state, config)
-
-
class TestEdgeCases(TestBaseTaskExecutorNode):
@patch("ee.hogai.chat_agent.parallel_task_execution.nodes.BaseTaskExecutorNode._write_message")
async def test_empty_input_tuples_raises_error(self, mock_write_message):
@@ -495,43 +418,6 @@ class TestConcurrentExecution(TestBaseTaskExecutorNode):
# Some overlap should exist
self.assertLess(max_start, min_end, "Tasks should have overlapping execution")
- async def test_results_yielded_in_completion_order(self):
- """Test that results are yielded as they complete, not in submission order."""
- task1 = self._create_task("task1")
- task2 = self._create_task("task2")
- task3 = self._create_task("task3")
-
- completion_order = []
-
- async def task1_coroutine(input_dict):
- await asyncio.sleep(0.15)
- completion_order.append("task1")
- return self._create_task_result("task1")
-
- async def task2_coroutine(input_dict):
- await asyncio.sleep(0.05)
- completion_order.append("task2")
- return self._create_task_result("task2")
-
- async def task3_coroutine(input_dict):
- await asyncio.sleep(0.10)
- completion_order.append("task3")
- return self._create_task_result("task3")
-
- state = MockTestState()
- state.test_input_tuples = [
- (task1, [], task1_coroutine),
- (task2, [], task2_coroutine),
- (task3, [], task3_coroutine),
- ]
- config = RunnableConfig()
-
- with patch.object(self.node, "dispatcher"):
- await self.node.arun(state, config)
-
- # Verify completion order matches fastest-first
- self.assertEqual(completion_order, ["task2", "task3", "task1"])
-
class TestTaskDependencies(TestBaseTaskExecutorNode):
"""Test artifact dependency management between tasks."""
diff --git a/ee/hogai/context/test/test_context.py b/ee/hogai/context/test/test_context.py
index 822317354628..9c413da3a68f 100644
--- a/ee/hogai/context/test/test_context.py
+++ b/ee/hogai/context/test/test_context.py
@@ -588,36 +588,6 @@ class TestAssistantContextManager(BaseTest):
self.assertEqual(result[0].content, "New context message")
self.assertEqual(result[1].content, "Another new message")
- async def test_get_context_messages_with_ui_and_contextual_tools(self):
- """Test that context prompts are returned for both UI context and contextual tools"""
- with (
- patch.object(AssistantContextManager, "_get_contextual_tools_prompt") as mock_contextual_tools,
- patch.object(AssistantContextManager, "_format_ui_context") as mock_format_ui,
- patch.object(AssistantContextManager, "get_ui_context") as mock_get_ui,
- patch.object(AssistantContextManager, "_deduplicate_context_messages") as mock_dedupe,
- ):
- # Setup mocks
- mock_contextual_tools.return_value = "Contextual tools prompt"
- mock_format_ui.return_value = "UI context prompt"
- mock_get_ui.return_value = MaxUIContext()
- ctx_tools_msg = ContextMessage(content="Contextual tools prompt", id="1")
- ui_context_msg = ContextMessage(content="UI context prompt", id="2")
- mock_dedupe.return_value = [ctx_tools_msg, ui_context_msg]
-
- state = AssistantState(messages=[HumanMessage(content="Test")])
-
- result = await self.context_manager._get_context_messages(state)
-
- # Verify both prompts are included
- self.assertEqual(len(result), 2)
- self.assertEqual(result[0].content, "Contextual tools prompt")
- self.assertEqual(result[1].content, "UI context prompt")
-
- # Verify methods were called
- mock_contextual_tools.assert_called_once_with()
- mock_get_ui.assert_called_once_with(state)
- mock_format_ui.assert_called_once_with(MaxUIContext())
-
async def test_get_context_messages_with_only_contextual_tools(self):
"""Test that context prompts work when only contextual tools are present"""
with (
diff --git a/ee/hogai/core/test/test_agent_executor.py b/ee/hogai/core/test/test_agent_executor.py
index c13b1958f1db..3b9429280e47 100644
--- a/ee/hogai/core/test/test_agent_executor.py
+++ b/ee/hogai/core/test/test_agent_executor.py
@@ -18,7 +18,6 @@ from products.posthog_ai.backend.models.assistant import Conversation
from ee.hogai.core.executor import AgentExecutor
from ee.hogai.stream.redis_stream import (
ConversationEvent,
- ConversationRedisStream,
MessageEvent,
StatusPayload,
StreamError,
@@ -37,13 +36,6 @@ class TestAgentExecutor(BaseTest):
self.user_id = self.user.pk
self.manager = AgentExecutor(self.conversation)
- def test_init(self):
- """Test ConversationStreamManager initialization."""
- manager = AgentExecutor(self.conversation)
-
- self.assertEqual(manager._conversation.id, self.conversation.id)
- self.assertIsInstance(manager._redis_stream, ConversationRedisStream)
-
@patch("ee.hogai.core.executor.async_connect")
async def test_start_workflow_and_stream_success(self, mock_connect):
"""Test successful workflow start and streaming."""