mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 14:38:25 +00:00
fix(cron): pass agentId to runHeartbeatOnce for main-session jobs (#14140)
* fix(cron): pass agentId to runHeartbeatOnce for main-session jobs Main-session cron jobs with agentId always ran the heartbeat under the default agent, ignoring the job's agent binding. enqueueSystemEvent correctly routed the system event to the bound agent's session, but runHeartbeatOnce was called without agentId, so the heartbeat ran under the default agent and never picked up the event. Thread agentId from job.agentId through the CronServiceDeps type, timer execution, and the gateway wrapper so heartbeat-runner uses the correct agent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * cron: add heartbeat agentId propagation regression test (#14140) (thanks @ishikawa-pro) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -69,9 +69,11 @@ export function buildGatewayCronService(params: {
|
||||
requestHeartbeatNow,
|
||||
runHeartbeatOnce: async (opts) => {
|
||||
const runtimeConfig = loadConfig();
|
||||
const agentId = opts?.agentId ? resolveCronAgent(opts.agentId).agentId : undefined;
|
||||
return await runHeartbeatOnce({
|
||||
cfg: runtimeConfig,
|
||||
reason: opts?.reason,
|
||||
agentId,
|
||||
deps: { ...params.deps, runtime: defaultRuntime },
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user