: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
feat(tasks): read user default inheritance from the task profile (#126077)
Charles Vienab65fa526a0c
diff --git a/products/tasks/backend/models.py b/products/tasks/backend/models.pyindex d01d01696cbc..7c1d102d0033 100644--- a/products/tasks/backend/models.py+++ b/products/tasks/backend/models.py@@ -819,7 +819,9 @@ class Task(Taggable, DeletedMetaFields, models.Model):explicitly set `reasoning_effort` survives injection; the default triple's effortonly fills a gap."""- if self.internal or self.runtime == Task.Runtime.PI:+ profile = self.stored_profile+ inherits = profile.inherit_user_defaults if profile is not None else not self.internal+ if not inherits or self.runtime == Task.Runtime.PI:returnfrom products.tasks.backend.logic.services.ai_run_defaults import ( # noqa: PLC0415 — breaks the circular import with ai_run_defaults, which imports this modulediff --git a/products/tasks/backend/tests/test_ai_run_defaults.py b/products/tasks/backend/tests/test_ai_run_defaults.pyindex ca9fbb5129d6..9bd5cf10c09a 100644--- a/products/tasks/backend/tests/test_ai_run_defaults.py+++ b/products/tasks/backend/tests/test_ai_run_defaults.py@@ -309,9 +309,15 @@ class TestCreateRunAppliesDefaults(APIBaseTest):assert run.state["model"] == "gpt-5"assert "ai_defaults_source" not in run.state- def test_internal_task_never_inherits_defaults(self):+ @parameterized.expand(+ [+ ("internal_task", {"internal": True}),+ ("profile_without_user_defaults", {"profile": "business_knowledge"}),+ ]+ )+ def test_task_that_opts_out_never_inherits_defaults(self, _name: str, overrides: dict[str, Any]):update_team_ai_run_preferences(self.team.id, **TEAM_TRIPLE)- run = self._task(internal=True).create_run()+ run = self._task(**overrides).create_run()assert "model" not in run.statedef test_acp_task_never_inherits_a_pi_default(self):