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(replay-vision): break circular import crashing manage.py commands (#70479)

Tomás Farías Santana0fb79a4d66b6
diff --git a/products/replay_vision/backend/api/prompt_suggestions.py b/products/replay_vision/backend/api/prompt_suggestions.py
index d0c1aac5814e..9fa5008d5864 100644
--- a/products/replay_vision/backend/api/prompt_suggestions.py
+++ b/products/replay_vision/backend/api/prompt_suggestions.py
@@ -38,6 +38,7 @@ from products.replay_vision.backend.models.replay_scanner_prompt_suggestion impo
SuggestionStatus,
)
from products.replay_vision.backend.prompt_evaluation import (
+ EVALUATE_PROMPT_SUGGESTION_EXECUTION_TIMEOUT,
EVALUATION_SESSION_CAP,
EVALUATION_SESSION_DEFAULT,
build_running_evaluation,
@@ -51,7 +52,6 @@ from products.replay_vision.backend.prompt_suggestions import (
)
from products.replay_vision.backend.quota import compute_quota_snapshot
from products.replay_vision.backend.temporal.constants import (
- EVALUATE_PROMPT_SUGGESTION_EXECUTION_TIMEOUT,
EVALUATE_PROMPT_SUGGESTION_WORKFLOW_NAME,
build_evaluate_prompt_suggestion_workflow_id,
)
diff --git a/products/replay_vision/backend/prompt_evaluation.py b/products/replay_vision/backend/prompt_evaluation.py
index 11133bebff35..519a9c8c9c09 100644
--- a/products/replay_vision/backend/prompt_evaluation.py
+++ b/products/replay_vision/backend/prompt_evaluation.py
@@ -12,7 +12,10 @@ from products.replay_vision.backend.billing import observation_credits_for_model
from products.replay_vision.backend.models.replay_observation import ObservationStatus, ReplayObservation
from products.replay_vision.backend.models.replay_scanner import ReplayScanner, ScannerType
from products.replay_vision.backend.models.replay_scanner_prompt_suggestion import ReplayScannerPromptSuggestion
-from products.replay_vision.backend.temporal.constants import EVALUATE_PROMPT_SUGGESTION_EXECUTION_TIMEOUT
+
+# Sized for a full run at the session cap (100 sessions, 4 concurrent, a few minutes each).
+# Lives here rather than temporal/constants so quota-path imports don't drag in the temporal package.
+EVALUATE_PROMPT_SUGGESTION_EXECUTION_TIMEOUT = dt.timedelta(hours=3)
# Each evaluated session is a full scanner run, so keep the bill bounded.
EVALUATION_SESSION_CAP = 100
diff --git a/products/replay_vision/backend/temporal/constants.py b/products/replay_vision/backend/temporal/constants.py
index e37e723592be..6ad9b5609782 100644
--- a/products/replay_vision/backend/temporal/constants.py
+++ b/products/replay_vision/backend/temporal/constants.py
@@ -114,8 +114,6 @@ def build_apply_scanner_workflow_id(scanner_id: UUID, session_id: str) -> str:
EVALUATE_PROMPT_SUGGESTION_WORKFLOW_NAME = "replay-vision-evaluate-prompt-suggestion"
-# Sized for a full run at the session cap (100 sessions, 4 concurrent, a few minutes each).
-EVALUATE_PROMPT_SUGGESTION_EXECUTION_TIMEOUT = dt.timedelta(hours=3)
def build_evaluate_prompt_suggestion_workflow_id(suggestion_id: UUID) -> str:
diff --git a/products/replay_vision/backend/tests/test_prompt_evaluation.py b/products/replay_vision/backend/tests/test_prompt_evaluation.py
index 48275d5f027d..5b8e3fc557b1 100644
--- a/products/replay_vision/backend/tests/test_prompt_evaluation.py
+++ b/products/replay_vision/backend/tests/test_prompt_evaluation.py
@@ -20,6 +20,7 @@ from products.replay_vision.backend.models.replay_scanner_prompt_suggestion impo
SuggestionStatus,
)
from products.replay_vision.backend.prompt_evaluation import (
+ EVALUATE_PROMPT_SUGGESTION_EXECUTION_TIMEOUT,
EVALUATION_SESSION_CAP,
EVALUATION_SESSION_DEFAULT,
classify_outcome,
@@ -33,7 +34,6 @@ from products.replay_vision.backend.temporal.activities.evaluate_prompt_suggesti
record_evaluation_result_activity,
select_evaluation_sessions_activity,
)
-from products.replay_vision.backend.temporal.constants import EVALUATE_PROMPT_SUGGESTION_EXECUTION_TIMEOUT
from products.replay_vision.backend.temporal.evaluation_types import (
EvaluationSession,
FinalizeEvaluationInputs,