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.

fix(hogai): prevent frozen-time pydantic schema failures (#97842)

Matt Puaf2106a8d69e9
diff --git a/ee/hogai/chat_agent/taxonomy/types.py b/ee/hogai/chat_agent/taxonomy/types.py
index 830ed1e00ff1..db767568076f 100644
--- a/ee/hogai/chat_agent/taxonomy/types.py
+++ b/ee/hogai/chat_agent/taxonomy/types.py
@@ -3,7 +3,7 @@ from typing import Generic, Optional, TypeVar
from langchain_core.messages import BaseMessage as LangchainBaseMessage
from langgraph.graph import END, START
-from pydantic import BaseModel, Field
+from pydantic import BaseModel, ConfigDict, Field
from ee.hogai.utils.types.base import BaseStateWithIntermediateSteps, BaseStateWithMessages
@@ -16,6 +16,9 @@ class TaxonomyAgentState(BaseStateWithIntermediateSteps, BaseStateWithMessages,
Only includes fields relevant to filter options generation.
"""
+ # URL imports can run inside frozen-time tests, where Pydantic sees Freezegun's datetime as arbitrary.
+ model_config = ConfigDict(arbitrary_types_allowed=True)
+
output: Optional[OutputType | str] = Field(default=None)
"""
The output of the taxonomy agent.