fix(cron): force main-target system events onto main session#28898
Conversation
Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
Greptile SummaryForces main-target cron system events to always route through the main session by setting the session parameter to undefined during execution. This prevents persisted session identifiers from overriding main-session routing after upgrades. The fix is applied consistently across all main-target execution paths: Confidence Score: 5/5
Last reviewed commit: 2e07144 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e07144904
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| // main-target cron jobs should always resolve via the agent's main session. | ||
| // Avoid forwarding persisted channel session keys from legacy records. | ||
| const targetMainSessionKey = undefined; |
There was a problem hiding this comment.
Pass explicit main session key to heartbeat wake calls
Setting targetMainSessionKey to undefined does not actually force heartbeat execution onto the main session; it only removes the forced session override. In runHeartbeatOnce, forcedSessionKey is optional, and when absent the runner can pick heartbeat.session instead of main (src/infra/heartbeat-runner.ts:275-307), while the cron event was enqueued to main in the gateway path (src/gateway/server-cron.ts). For users with heartbeat.session configured to a non-main session, main-target cron events can be queued in main but the wake/run reads a different session, so the cron message is effectively missed.
Useful? React with 👍 / 👎.
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
* main: (31 commits) fix(browser): resolve correct targetId in navigate response after renderer swap (openclaw#25326) fix: sed escaping and UID mismatch in Podman Quadlet setup (openclaw#26414) fix(cron): pass heartbeat target=last for main-session cron jobs (openclaw#28508) (openclaw#28583) fix(cron): disable messaging tool when delivery.mode is none (openclaw#21808) (openclaw#21896) fix: clear delivery routing state when creating isolated cron sessions (openclaw#27778) fix(cron): avoid marking queued announce paths as delivered (openclaw#29716) fix(cron): enable completion direct send for text-only announce delivery (openclaw#29151) fix(cron): force main-target system events onto main session (openclaw#28898) fix(cron): condition requireExplicitMessageTarget on resolved delivery (openclaw#28017) feat(cron): add --account flag for multi-account delivery routing (openclaw#26284) fix: schedule nextWakeAtMs for isolated sessionTarget cron jobs (openclaw#19541) fix: sandbox browser docker no-sandbox rollout (openclaw#29879) (thanks @Lukavyi) GitHub: add regression bug issue template and routing (openclaw#29864) thanks @Takhoffman feat(feishu): add chat info/member tool (openclaw#14674) feat(feishu): add markdown tables, positional insert, color_text, and table ops (openclaw#29411) feat(feishu): add parent/root inbound context for quote support (openclaw#18529) fix: land android onboarding and voice reliability updates (openclaw#29796) fix(android-voice): rotate playback token per assistant reply fix(android-voice): retry talk config after transient failures fix(android-voice): cancel in-flight speech when speaker muted ...
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
…w#28898) Ignore persisted sessionKey overrides for sessionTarget=main jobs so cron system events consistently route to the agent main session after upgrades. Closes openclaw#28770
Summary
sessionTarget: "main"+payload.kind: "systemEvent", persistedsessionKeycould override main-session routing and create/send to unintended Telegram sessions after upgrades.src/cron/service/timer.tsto ignore persistedjob.sessionKeywhensessionTargetismain, and always resolve through main-session path (sessionKey: undefinedin enqueue/wake calls); updated regression expectations insrc/cron/service.runs-one-shot-main-job-disables-it.test.ts.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
sessionTarget: "main"+payload.kind: "systemEvent"create new Telegram chat session instead of delivering to existing main session after upgrade to 2026.2.26 #28770User-visible / Behavior Changes
Security Impact (required)
NoNoNoNoNoRepro + Verification
Environment
Steps
sessionTarget: "main",payload.kind: "systemEvent", and a persisted channel-likesessionKey.wakeMode: now) and observe routing arguments.Expected
Actual
sessionKeycould be forwarded and misroute events.sessionKeyand uses main-session resolution.Evidence
src/cron/service.runs-one-shot-main-job-disables-it.test.tspnpm --dir /Users/sidqin/Desktop/openclaw-contrib exec vitest src/cron/service.runs-one-shot-main-job-disables-it.test.tsHuman Verification (required)
agentIduses main-session resolution path.Compatibility / Migration
YesNoNoFailure Recovery (if this breaks)
src/cron/service/timer.ts, test expectation file.Risks and Mitigations
sessionKeyoverrides for main-target jobs may observe changed behavior.sessionTarget: "main"semantics are now strictly enforced and covered by regression test expectations.