diff --git a/CHANGELOG.md b/CHANGELOG.md index c9a60007f..937a477ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ - Onboarding: when OpenAI Codex OAuth is used, default to `openai-codex/gpt-5.2` and warn if the selected model lacks auth. - CLI: auto-migrate legacy config entries on command start (same behavior as gateway startup). - Gateway: add `gateway stop|restart` helpers and surface launchd/systemd/schtasks stop hints when the gateway is already running. +- Cron/Heartbeat: enqueue cron system events in the resolved main session so heartbeats drain the right queue. Thanks @zats for PR #350. - Gateway: honor `agent.timeoutSeconds` for `chat.send` and share timeout defaults across chat/cron/auto-reply. Thanks @MSch for PR #229. - Auth: prioritize OAuth profiles but fall back to API keys when refresh fails; stored profiles now load without explicit auth order. - Auth/CLI: normalize provider ids and Z.AI aliases across auth profile ordering and models list/status. Thanks @mneves75 for PR #303. diff --git a/src/gateway/server.ts b/src/gateway/server.ts index 718f8d62a..d198f999b 100644 --- a/src/gateway/server.ts +++ b/src/gateway/server.ts @@ -32,7 +32,11 @@ import { deriveDefaultBridgePort, deriveDefaultCanvasHostPort, } from "../config/port-defaults.js"; -import { loadSessionStore, resolveStorePath } from "../config/sessions.js"; +import { + loadSessionStore, + resolveMainSessionKey, + resolveStorePath, +} from "../config/sessions.js"; import { runCronIsolatedAgentTurn } from "../cron/isolated-agent.js"; import { appendCronRunLog, resolveCronRunLogPath } from "../cron/run-log.js"; import { CronService } from "../cron/service.js"; @@ -689,7 +693,9 @@ export async function startGatewayServer( const cron = new CronService({ storePath, cronEnabled, - enqueueSystemEvent, + enqueueSystemEvent: (text) => { + enqueueSystemEvent(text, { sessionKey: resolveMainSessionKey(cfg) }); + }, requestHeartbeatNow, runIsolatedAgentJob: async ({ job, message }) => { const runtimeConfig = loadConfig();