: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(phai): missing import (#62577)
Joshua Snyder41eceabcc10f
diff --git a/ee/hogai/core/agent_modes/presets/ai_observability.py b/ee/hogai/core/agent_modes/presets/ai_observability.pyindex f3458d1b7fa8..e14e23f77ecd 100644--- a/ee/hogai/core/agent_modes/presets/ai_observability.py+++ b/ee/hogai/core/agent_modes/presets/ai_observability.py@@ -149,7 +149,7 @@ class AIObservabilityAgentToolkit(AgentToolkit):@propertydef tools(self) -> list[type["MaxTool"]]:- from products.ai_observability.backend.tools.run_hog_eval_test import RunHogEvalTestTool+ from products.ai_observability.backend.tools.run_hog_eval import RunHogEvalTestToolfrom products.ai_observability.backend.tools.skills import (ArchiveLLMSkillTool,CreateLLMSkillTool,diff --git a/products/ai_observability/backend/tools/run_hog_eval_test.py b/products/ai_observability/backend/tools/run_hog_eval.pysimilarity index 100%rename from products/ai_observability/backend/tools/run_hog_eval_test.pyrename to products/ai_observability/backend/tools/run_hog_eval.pydiff --git a/products/ai_observability/backend/tools/test_run_hog_eval_test.py b/products/ai_observability/backend/tools/test_run_hog_eval.pysimilarity index 94%rename from products/ai_observability/backend/tools/test_run_hog_eval_test.pyrename to products/ai_observability/backend/tools/test_run_hog_eval.pyindex adee417b356b..79976dc650ac 100644--- a/products/ai_observability/backend/tools/test_run_hog_eval_test.py+++ b/products/ai_observability/backend/tools/test_run_hog_eval.py@@ -9,7 +9,7 @@ from parameterized import parameterizedfrom posthog.hogql_queries.ai.utils import HEAVY_COLUMN_NAMES-from products.ai_observability.backend.tools.run_hog_eval_test import RunHogEvalTestTool+from products.ai_observability.backend.tools.run_hog_eval import RunHogEvalTestTooldef _make_event(@@ -52,7 +52,7 @@ class TestRunHogEvalTestTool(BaseTest):("length_check", "return length(output) > 0;", True),])- @patch("products.ai_observability.backend.tools.run_hog_eval_test.execute_with_ai_events_fallback")+ @patch("products.ai_observability.backend.tools.run_hog_eval.execute_with_ai_events_fallback")def test_compilation_and_execution(self, _name, source, expected_verdict, mock_query):mock_response = MagicMock()mock_response.results = [_make_event()]@@ -74,7 +74,7 @@ class TestRunHogEvalTestTool(BaseTest):assert "Compilation error" in resultassert artifact is None- @patch("products.ai_observability.backend.tools.run_hog_eval_test.execute_with_ai_events_fallback")+ @patch("products.ai_observability.backend.tools.run_hog_eval.execute_with_ai_events_fallback")def test_no_events_found(self, mock_query):mock_response = MagicMock()mock_response.results = []@@ -86,7 +86,7 @@ class TestRunHogEvalTestTool(BaseTest):assert "No recent AI events" in resultassert artifact is None- @patch("products.ai_observability.backend.tools.run_hog_eval_test.execute_with_ai_events_fallback")+ @patch("products.ai_observability.backend.tools.run_hog_eval.execute_with_ai_events_fallback")def test_runtime_error_handling(self, mock_query):mock_response = MagicMock()mock_response.results = [_make_event()]@@ -98,7 +98,7 @@ class TestRunHogEvalTestTool(BaseTest):assert artifact is Noneassert "Event" in result- @patch("products.ai_observability.backend.tools.run_hog_eval_test.execute_with_ai_events_fallback")+ @patch("products.ai_observability.backend.tools.run_hog_eval.execute_with_ai_events_fallback")def test_result_formatting_includes_previews(self, mock_query):mock_response = MagicMock()mock_response.results = [@@ -116,7 +116,7 @@ class TestRunHogEvalTestTool(BaseTest):assert "Output:" in resultassert "Result: PASS" in result- @patch("products.ai_observability.backend.tools.run_hog_eval_test.execute_with_ai_events_fallback")+ @patch("products.ai_observability.backend.tools.run_hog_eval.execute_with_ai_events_fallback")def test_null_return_shows_na(self, mock_query):mock_response = MagicMock()mock_response.results = [_make_event()]@@ -129,7 +129,7 @@ class TestRunHogEvalTestTool(BaseTest):assert "N/A" in resultassert "ERROR" not in result- @patch("products.ai_observability.backend.tools.run_hog_eval_test.execute_with_ai_events_fallback")+ @patch("products.ai_observability.backend.tools.run_hog_eval.execute_with_ai_events_fallback")def test_runtime_error_shows_error_not_na(self, mock_query):mock_response = MagicMock()mock_response.results = [_make_event()]@@ -142,7 +142,7 @@ class TestRunHogEvalTestTool(BaseTest):assert "Result: ERROR" in resultassert "Result: N/A" not in result- @patch("products.ai_observability.backend.tools.run_hog_eval_test.execute_with_ai_events_fallback")+ @patch("products.ai_observability.backend.tools.run_hog_eval.execute_with_ai_events_fallback")def test_ai_metric_event_type(self, mock_query):mock_response = MagicMock()event_row = [@@ -160,7 +160,7 @@ class TestRunHogEvalTestTool(BaseTest):assert "PASS" in resultassert "$ai_metric" in result- @patch("products.ai_observability.backend.tools.run_hog_eval_test.execute_with_ai_events_fallback")+ @patch("products.ai_observability.backend.tools.run_hog_eval.execute_with_ai_events_fallback")def test_heavy_column_remerge_for_stripped_event(self, mock_query):"""Post-strip rows have empty `properties.$ai_input` on `events`, butthe dedicated `ai_events` table carries the value in the `input`@@ -201,7 +201,7 @@ class TestRunHogEvalTestTool(BaseTest):assert "Result: PASS" in result, f"expected PASS after heavy-merge, got: {result}"- @patch("products.ai_observability.backend.tools.run_hog_eval_test.execute_with_ai_events_fallback")+ @patch("products.ai_observability.backend.tools.run_hog_eval.execute_with_ai_events_fallback")def test_query_targets_ai_events(self, mock_query):"""The constructed SelectQuery must target `posthog.ai_events` — otherwisethe heavy column slots in the projection are NULL on the events table."""