feat(tasks): assign folder='Tasks' at creation + backfill migration (#2834)

* feat: assign folder='Tasks' to task sessions at creation

Task sessions (LLM, action, research) now set folder='Tasks' on their
DbSession row, matching the pattern used by the Assistant folder. This
enables sidebar lens filtering without changing existing session
behaviour.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add backfill script for task session folders

One-shot script to set folder='Tasks' on existing [Task]/[Research]
sessions that predate the folder assignment in task_scheduler.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: replace standalone backfill script with automatic migration

Convert scripts/backfill_task_folders.py into _migrate_backfill_task_folders()
in core/database.py, called from init_db(). The migration is idempotent (only
touches rows where folder IS NULL/empty) and runs automatically on upgrade,
so operators no longer need a manual step to tag pre-existing task sessions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
danielroytel
2026-06-07 23:33:17 +10:00
committed by GitHub
parent 04d6a5ccaa
commit 5d3e3c7053
3 changed files with 57 additions and 0 deletions
+3
View File
@@ -1315,6 +1315,7 @@ class TaskScheduler:
endpoint_url=endpoint_url,
model=model,
owner=task.owner,
folder="Tasks",
created_at=_utcnow(),
updated_at=_utcnow(),
)
@@ -1463,6 +1464,7 @@ class TaskScheduler:
endpoint_url=endpoint_url or "",
model=model_name or "",
owner=task.owner,
folder="Tasks",
created_at=_utcnow(),
updated_at=_utcnow(),
)
@@ -1755,6 +1757,7 @@ class TaskScheduler:
endpoint_url=endpoint_url,
model=model,
owner=task.owner,
folder="Tasks",
created_at=_utcnow(),
updated_at=_utcnow(),
)