Skip to content

fix: schedule nextWakeAtMs for isolated sessionTarget cron jobs#19541

Merged
Takhoffman merged 2 commits intoopenclaw:mainfrom
guirguispierre:codex/fix-19469-isolated-nextwake
Feb 28, 2026
Merged

fix: schedule nextWakeAtMs for isolated sessionTarget cron jobs#19541
Takhoffman merged 2 commits intoopenclaw:mainfrom
guirguispierre:codex/fix-19469-isolated-nextwake

Conversation

@guirguispierre
Copy link
Contributor

@guirguispierre guirguispierre commented Feb 17, 2026

Summary

  • repair cron scheduling when jobs carry non-finite nextRunAtMs values so the timer can arm and nextWakeAtMs is populated
  • harden every schedule anchor fallback to use nowMs when external registrations omit createdAtMs
  • treat invalid nextRunAtMs as missing during maintenance recompute so isolated jobs self-heal instead of silently stalling
  • add a regression test covering isolated every jobs loaded without createdAtMs

Testing

  • pnpm vitest run src/cron/service.issue-regressions.test.ts src/cron/service.every-jobs-fire.test.ts src/cron/service.issue-16156-list-skips-cron.test.ts src/cron/service.rearm-timer-when-running.test.ts src/cron/service.prevents-duplicate-timers.test.ts --config vitest.unit.config.ts
  • pnpm vitest run src/cron/service/jobs.schedule-error-isolation.test.ts --config vitest.unit.config.ts
  • pnpm vitest run --config vitest.e2e.config.ts src/gateway/server.cron.e2e.test.ts

Fixes #19469

Greptile Summary

Fixed cron scheduling for isolated jobs with non-finite timestamp values

This PR addresses an issue where isolated sessionTarget cron jobs could have invalid (non-finite) nextRunAtMs values, preventing the timer from arming properly and causing jobs to stall silently.

Key Changes:

  • Added isFiniteTimestamp() type guard for consistent finite number validation across the cron service
  • Hardened resolveEveryAnchorMs() to fall back to 0 when both anchorMs and fallbackAnchorMs are non-finite, ensuring every schedules can always compute a valid anchor
  • Modified computeJobNextRunAtMs() to validate all return paths and only return finite timestamps or undefined
  • Added cleanup logic in normalizeJobTickState() to treat non-finite nextRunAtMs as missing during maintenance passes
  • Updated nextWakeAtMs() and armTimer() to filter out jobs with non-finite timestamps
  • Added regression test covering isolated jobs missing createdAtMs that validates self-healing behavior

The fix ensures legacy jobs with invalid timestamps self-heal on next service start and prevents future invalid values from propagating through the scheduling system.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are defensive additions that make the cron scheduler more robust. All modifications add validation guards without changing core scheduling logic. The fix includes comprehensive test coverage for the regression case and the implementation consistently applies Number.isFinite() checks across all relevant code paths.
  • No files require special attention

Last reviewed commit: 052b306

(4/5) You can add custom instructions or style guidelines for the agent here!

@openclaw-barnacle
Copy link

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Feb 28, 2026
@Takhoffman Takhoffman force-pushed the codex/fix-19469-isolated-nextwake branch from b3c64cf to 492397d Compare February 28, 2026 16:45
@Takhoffman Takhoffman merged commit e1c8094 into openclaw:main Feb 28, 2026
26 checks passed
@Takhoffman
Copy link
Contributor

Merged via squash after rebase + verification.

Merge commit: e1c8094
Local gates run on the prepared branch:

  • pnpm build
  • pnpm check

vincentkoc pushed a commit to Sid-Qin/openclaw that referenced this pull request Feb 28, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
vincentkoc pushed a commit to rylena/rylen-openclaw that referenced this pull request Feb 28, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Feb 28, 2026
* 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
  ...
newtontech pushed a commit to newtontech/openclaw-fork that referenced this pull request Feb 28, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
nsd97 pushed a commit to nsd97/openclaw that referenced this pull request Feb 28, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
(cherry picked from commit e1c8094)

# Conflicts:
#	CHANGELOG.md
#	src/cron/service/jobs.ts
#	src/cron/service/timer.ts
zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 1, 2026
…claw#19541)

Cherry-pick from upstream openclaw/openclaw e1c8094.
Adds isFiniteTimestamp guards throughout cron scheduler to handle
NaN/Infinity nextRunAtMs from legacy isolated jobs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ansh pushed a commit to vibecode/openclaw that referenced this pull request Mar 2, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
robertchang-ga pushed a commit to robertchang-ga/openclaw that referenced this pull request Mar 2, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
(cherry picked from commit e1c8094)

# Conflicts:
#	CHANGELOG.md
#	src/cron/service/jobs.ts
#	src/cron/service/timer.ts
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
sachinkundu pushed a commit to sachinkundu/openclaw that referenced this pull request Mar 6, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…claw#19541)

Cherry-pick from upstream openclaw/openclaw e1c8094.
Adds isFiniteTimestamp guards throughout cron scheduler to handle
NaN/Infinity nextRunAtMs from legacy isolated jobs.
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Mateljan1 pushed a commit to Mateljan1/openclaw that referenced this pull request Mar 7, 2026
…claw#19541)

* fix(cron): repair isolated next wake scheduling

* cron: harden isolated next-wake timestamp guards

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cron jobs with sessionTarget "isolated" still never fire on v2026.2.16 (Docker/WSL2) — regression from #10788

2 participants