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(posthog-ai): title an untitled imported chat "(no title)" (#105978)

Jake Ruth7e51fa43557b
diff --git a/products/posthog_ai/backend/conversation_mirror.py b/products/posthog_ai/backend/conversation_mirror.py
index dc0dc0dcb845..bff83060bc22 100644
--- a/products/posthog_ai/backend/conversation_mirror.py
+++ b/products/posthog_ai/backend/conversation_mirror.py
@@ -333,7 +333,7 @@ def _ensure_import_target(
created = tasks_facade.create_imported_task(
team.id,
user.id,
- title=conversation.title or "Imported chat",
+ title=conversation.title or "(no title)",
origin_key=origin_key,
internal=bool(conversation.is_internal),
created_at=created_at,
diff --git a/products/tasks/backend/migrations/0132_retitle_untitled_imported_chats.py b/products/tasks/backend/migrations/0132_retitle_untitled_imported_chats.py
new file mode 100644
index 000000000000..97bf31b247d7
--- /dev/null
+++ b/products/tasks/backend/migrations/0132_retitle_untitled_imported_chats.py
@@ -0,0 +1,28 @@
+from django.db import migrations
+
+OLD_TITLE = "Imported chat"
+NEW_TITLE = "(no title)"
+
+
+def _retitle(apps, schema_editor, old: str, new: str) -> None:
+ Task = apps.get_model("tasks", "Task")
+ Task.objects.using(schema_editor.connection.alias).filter(
+ origin_product="posthog_ai",
+ title=old,
+ # A title the person set on the task outranks the one the copy generated.
+ title_manually_set=False,
+ ).update(title=new)
+
+
+def retitle_forwards(apps, schema_editor):
+ _retitle(apps, schema_editor, OLD_TITLE, NEW_TITLE)
+
+
+def retitle_backwards(apps, schema_editor):
+ _retitle(apps, schema_editor, NEW_TITLE, OLD_TITLE)
+
+
+class Migration(migrations.Migration):
+ dependencies = [("tasks", "0131_taskrun_github_pr_run_idx")]
+
+ operations = [migrations.RunPython(retitle_forwards, retitle_backwards)]
diff --git a/products/tasks/backend/migrations/max_migration.txt b/products/tasks/backend/migrations/max_migration.txt
index 1190cd4390f8..b2b7e315b2c4 100644
--- a/products/tasks/backend/migrations/max_migration.txt
+++ b/products/tasks/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0131_taskrun_github_pr_run_idx
+0132_retitle_untitled_imported_chats