: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(evals): stop the harness forcing workflow dispatch flags on (#86188)
Georgiy Tarasov160accd9db69
diff --git a/products/posthog_ai/eval_harness/harness/lifecycle.py b/products/posthog_ai/eval_harness/harness/lifecycle.pyindex f19d4c9ac665..253e0393e6dc 100644--- a/products/posthog_ai/eval_harness/harness/lifecycle.py+++ b/products/posthog_ai/eval_harness/harness/lifecycle.py@@ -17,6 +17,10 @@ from posthoganalytics import Posthogfrom posthog.ph_client import get_client+from products.tasks.backend.constants import (+ WORKFLOW_DISPATCH_ASYNC_FEATURE_FLAG,+ WORKFLOW_DISPATCH_RESTART_FEATURE_FLAG,+)from products.tasks.backend.temporal.process_task.utils import get_reasoning_effort_errorfrom ..engines.base import EvalEngine@@ -51,6 +55,22 @@ from .temporal_env import (logger = logging.getLogger(__name__)+# Exceptions to the blanket "every flag is on" stub the run installs below. These two hand a+# task run to `run_task_workflow_dispatcher` instead of starting its Temporal workflow inline,+# and the harness never starts that command — so a forced-on flag leaves every case parked in+# QUEUED, with nothing to fail it, until the case's poll budget runs out.+FORCED_OFF_FEATURE_FLAGS = frozenset(+ {+ WORKFLOW_DISPATCH_ASYNC_FEATURE_FLAG,+ WORKFLOW_DISPATCH_RESTART_FEATURE_FLAG,+ }+)+++def eval_feature_enabled(key: str, *_args: object, **_kwargs: object) -> bool:+ """Stands in for `posthoganalytics.feature_enabled` so evals exercise flagged code paths."""+ return key not in FORCED_OFF_FEATURE_FLAGS+class SandboxedEvalHarness:"""Boots the shared eval infrastructure once, then runs every selected suite concurrently.@@ -264,7 +284,7 @@ class SandboxedEvalHarness:if overrides:stack.enter_context(override_settings(**overrides))- stack.enter_context(patch.object(posthoganalytics, "feature_enabled", return_value=True))+ stack.enter_context(patch.object(posthoganalytics, "feature_enabled", eval_feature_enabled))if Infra.SANDBOX in required:# Stale workflows from a prior run make the worker provision sandboxes fordiff --git a/products/posthog_ai/eval_harness/test/test_sandboxed_harness.py b/products/posthog_ai/eval_harness/test/test_sandboxed_harness.pyindex 23199c52d321..6638a1a3679d 100644--- a/products/posthog_ai/eval_harness/test/test_sandboxed_harness.py+++ b/products/posthog_ai/eval_harness/test/test_sandboxed_harness.py@@ -16,8 +16,13 @@ from parameterized import parameterizedfrom products.posthog_ai.eval_harness import runnerfrom products.posthog_ai.eval_harness.config import AgentArtifacts, SandboxedEvalCasefrom products.posthog_ai.eval_harness.harness.cli import parse_args+from products.posthog_ai.eval_harness.harness.lifecycle import eval_feature_enabledfrom products.posthog_ai.eval_harness.harness.live_server import EvalLiveServerfrom products.posthog_ai.eval_harness.harness.providers import ModalProviderStrategy, SandboxProviderStrategy+from products.tasks.backend.constants import (+ WORKFLOW_DISPATCH_ASYNC_FEATURE_FLAG,+ WORKFLOW_DISPATCH_RESTART_FEATURE_FLAG,+)from products.tasks.backend.facade.agents import TurnPollResult@@ -143,6 +148,17 @@ def test_parse_args_resolves_team_setup_concurrency(assert options.team_setup_concurrency == expected_concurrency+ [+ ("workflow dispatch async", WORKFLOW_DISPATCH_ASYNC_FEATURE_FLAG, False),+ ("workflow dispatch restart", WORKFLOW_DISPATCH_RESTART_FEATURE_FLAG, False),+ ("anything else", "tasks-modal-vm-sandbox", True),+ ]+)+def test_eval_feature_enabled_leaves_dispatcher_flags_off(_name: str, flag: str, expected: bool) -> None:+ assert eval_feature_enabled(flag, distinct_id="distinct-1") is expected++@pytest.mark.asyncioasync def test_success_waits_for_workflow_cleanup_before_returning(monkeypatch: pytest.MonkeyPatch) -> None:handle = _FakeWorkflowHandle(complete_on_signal=False)