fix: preserve legacy cron delivery payloads

maintainer edit: keep existing cron jobs with legacy delivery fields on the legacy execution path, even when they already carry a sessionKey. This preserves deliver=false behavior and channel-specific routing metadata for upgraded jobs.
This commit is contained in:
chengyongru
2026-06-11 22:26:06 +08:00
parent f82ab9f192
commit b4b6c04657
2 changed files with 157 additions and 1 deletions
+12 -1
View File
@@ -1189,6 +1189,17 @@ def _run_gateway(
)
return response
def _is_bound_cron_job(job: CronJob) -> bool:
payload = job.payload
if payload.kind != "agent_turn" or not payload.session_key:
return False
return not (
payload.deliver
or payload.channel
or payload.to
or payload.channel_meta
)
async def _deliver_to_channel(
msg: OutboundMessage, *, record: bool = False, session_key: str | None = None,
) -> None:
@@ -1349,7 +1360,7 @@ def _run_gateway(
logger.info("Heartbeat: silenced by post-run evaluation")
return response
if job.payload.kind == "agent_turn" and job.payload.session_key:
if _is_bound_cron_job(job):
return await _run_bound_cron_job(job)
reminder_note = (