Give a scheduled run's trace to the user who scheduled it

On a shared agent the run's Logs row belongs to the scheduling user, not
the agent owner, so the trace is stored under that user.
This commit is contained in:
arc53-machine committed 2026-09-23 22:09:58 +01:00
1 parent 9f7f0b2f1e
commit 699906a015
3 files changed
+19 -2

No files matched your search

+3 -1
View File
@@ -277,8 +277,10 @@ def execute_scheduled_run_body(run_id: str, celery_task_id: Optional[str]) -> Di
endpoint="schedule",
conversation_id=schedule.get("origin_conversation_id"),
chat_history=chat_history,
# Links the run's execution trace to its Logs row.
# Links the run's execution trace to its Logs row, which belongs
# to the user who scheduled it (not always the agent's owner).
request_id=str(run_id),
trace_user_id=run.get("user_id") or schedule.get("user_id"),
)
except SoftTimeLimitExceeded:
timed_out = True