fix(cron): retire persisted heartbeat/dream jobs when disabled

Disabling gateway.heartbeat (or agents.defaults.dream) only skipped
job registration on startup; the previously persisted system job in
<workspace>/cron/jobs.json kept firing, and remove_job refuses to
touch protected system jobs. Add CronService.remove_system_job for
startup reconciliation and call it from the gateway disabled branches
so the config toggle takes effect after restart.
This commit is contained in:
aiguozhi123456 authored and chengyongru committed 2026-08-22 02:38:47 +08:00
1 parent 1fe36d5dec
commit e5718d4de6
5 files changed
+61

No files matched your search

+5
View File
@@ -785,6 +785,7 @@ def _run_gateway(
console.print(f"[green]✓[/green] Dream: {dream_cfg.describe_schedule()}")
else:
console.print("[yellow]○[/yellow] Dream: disabled")
cron.remove_system_job("dream")
_advance_dream_cursor_if_behind(agent.context.memory)
# Register Heartbeat system job (idempotent on restart)
@@ -799,6 +800,10 @@ def _run_gateway(
),
payload=CronPayload(kind="system_event"),
))
else:
# Retire any previously persisted heartbeat job so that disabling
# gateway.heartbeat in config takes effect after restart.
cron.remove_system_job("heartbeat")
async def _open_browser_when_ready() -> None:
"""Wait for the gateway to bind, then point the user's browser at the webui."""