fix: revert user_id filtering in task loaders to preserve backward compatibility

Avoid filtering loader queries by canonical user_id. Calling loaders with user_id=user_id introduces an exact-ID filter path that can drop valid legacy tasks: several loaders (e.g., load_due_market_trends_tasks) apply ...where task.user_id == user_id, but this commit also shifts discovery toward canonical IDs, so tasks persisted earlier with workspace-safe/sanitized IDs in the same per-user DB will no longer be returned and therefore never execute. Before this change, loaders were invoked as task_loader(db) and did not regress on mixed ID formats.
This commit is contained in:
ajaysi
2026-03-09 14:20:57 +05:30
parent 6c5361ce06
commit 3cfd95d179

View File

@@ -700,14 +700,7 @@ class TaskScheduler:
return summary
try:
# Pass user_id for strict user isolation where loaders support it.
# Keep backward compatibility with legacy loaders that only accept db.
import inspect
loader_signature = inspect.signature(task_loader)
if "user_id" in loader_signature.parameters:
tasks = task_loader(db, user_id=user_id)
else:
tasks = task_loader(db)
tasks = task_loader(db)
if not tasks:
return summary