fix(scheduler): isolate scheduled runs and @mention job creator on WhatsApp

Use a fresh execution session per run while keeping source_session_id for delivery only; filter bot JIDs and default scheduled @mentions to the job creator.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-07-21 14:49:31 +08:00
parent f5cb64a3a4
commit 62ac04c40d
8 changed files with 524 additions and 166 deletions

View file

@ -334,6 +334,7 @@ def _handle_productivity_commands(
session_id=str(session_id or "").strip(),
)
from runtime.scheduler.job_delete import merge_delivery_creator
from runtime.scheduler.whatsapp_mentions import finalize_whatsapp_scheduled_delivery
delivery = merge_delivery_creator(
delivery,
@ -342,6 +343,11 @@ def _handle_productivity_commands(
push_name=str(creator_push_name or ""),
session_id=str(session_id or "").strip(),
)
delivery = finalize_whatsapp_scheduled_delivery(
delivery,
creator_external_user_id=str(creator_external_user_id or ""),
creator_push_name=str(creator_push_name or ""),
)
row = store.scheduled_job_create(
tenant_id=tenant_id,
name=prompt_text[:40] or "定时提醒",