An OpenClaw heartbeat pings its owner at 3 a.m.; how do you confine it with `activeHours`, and which timezone does that window use?
answer
- a window, not a schedule
- start inclusive, end exclusive
- user timezone, then host
- equal start and end
- event wakes are not windowed
basics
~10 sSet agents.defaults.heartbeat.activeHours with start and end in HH:MM and an optional timezone. Ticks outside the window are skipped, not queued. Without timezone it uses agents.defaults.userTimezone, else the host's timezone.
solid answer
~40 s`activeHours` is an object with `start` (HH:MM, inclusive), `end` (HH:MM, exclusive, `24:00` allowed) and an optional `timezone`. Omitted or `"user"` means `agents.defaults.userTimezone` if set, otherwise the host timezone; `"local"` always means the host; an IANA name is used directly and falls back to the user behaviour if invalid. A tick outside the window is skipped before the model runs and recorded as `quiet-hours`; nothing is saved for the morning, the next tick inside the window just runs. Equal `start` and `end` is a zero-width window that skips every tick. A VPS in UTC with no `userTimezone` is the classic cause of a 3 a.m. ping. Targeted event wakes, such as a background command finishing, are not held by the window in 2026.9.9, so a night ping can also come from those.
code
bash · 3 linesopenclaw config set agents.defaults.userTimezone '"America/New_York"'
openclaw config set agents.defaults.heartbeat.activeHours '{"start":"08:00","end":"22:00"}'
openclaw system heartbeat lastgo deeper
Recall that activeHours takes start and end in HH:MM and that heartbeat ticks outside the window simply do not run.
Explain the timezone chain, explicit timezone, then userTimezone, then host, plus the inclusive start, exclusive end and the zero-width trap.
Diagnose a persisting night ping: a UTC host with no userTimezone, or a targeted event wake that the window does not hold, read from the last heartbeat event.
Decide whether the window belongs in shared defaults or per agent, and set one userTimezone so every time-based feature on the Gateway agrees.
## The problem the setting solves A heartbeat runs every 30 minutes by default, around the clock. Most turns end silently, but the one that finds something worth saying will say it whenever it runs, including at 3 a.m. **`activeHours`** restricts the times at which scheduled heartbeat turns may run at all. It is a filter on the existing cadence, not a second schedule. ## The shape of the setting `activeHours` lives in the heartbeat block, globally under `agents.defaults.heartbeat` or per agent under `agents.entries.<id>.heartbeat`: ```json { "agents": { "defaults": { "userTimezone": "Europe/Berlin", "heartbeat": { "every": "30m", "activeHours": { "start": "08:00", "end": "22:00" } } } } } ``` - **`start`** is `HH:MM` in 24-hour form and **inclusive**; `00:00` means start of day. - **`end`** is `HH:MM` and **exclusive**; `24:00` is allowed to mean end of day. - **`timezone`** is optional (see below). - Config validation rejects malformed times such as `99:99`. ## Which timezone the window uses | `timezone` value | Clock used | | --- | --- | | omitted or `"user"` | `agents.defaults.userTimezone` if set, otherwise the host system timezone | | `"local"` | always the host system timezone | | an IANA name such as `America/New_York` | that zone; if the name is invalid, falls back to the `"user"` behaviour | This table is the usual root cause of the 3 a.m. ping. A Gateway on a VPS often runs with the host clock in UTC. If neither `userTimezone` nor `activeHours.timezone` is set, an `08:00`-`22:00` window is evaluated in UTC, which can be the middle of the night for the owner. The fix is to set `agents.defaults.userTimezone` once (it also feeds message timestamps and the prompt's date context) or to give the window an explicit IANA `timezone`. ## What happens outside the window 1. The scheduler still ticks at the configured cadence. 2. The runner checks the window before preparing the turn. Outside it, the turn is **skipped before any model call** and the skip is recorded with reason `quiet-hours`, which `openclaw system heartbeat last` shows. 3. Nothing is queued. The next tick that lands inside the window runs normally; a heartbeat does not save up the night's checks and replay them at 08:00. Two edge cases matter in practice: - **Equal `start` and `end`** (for example `08:00` to `08:00`) is a **zero-width window**: every scheduled heartbeat is skipped. To run around the clock, omit `activeHours` or use `00:00` to `24:00`. - **A window that crosses midnight** works: in the 2026.9.9 source, when `end` is earlier than `start` (say `22:00` to `06:00`) the window is the hours from `start` through midnight to `end`. ## What the window does not cover `activeHours` governs **scheduled** heartbeat ticks. In 2026.9.9 a **targeted event wake**, such as a background command finishing (`tools.exec.notifyOnExit`, on by default), passes the active-hours check and can still produce a night-time message. If late pings continue after you set the window, check `openclaw system heartbeat last` and the transcript marker to see whether the turn was a scheduled poll or an event, and set `tools.exec.notifyOnExit: false` if completion turns are the source. The window also does not change **where** an alert goes or **whether** it is delivered. Settings such as `target: "none"` or `directPolicy: "block"` still let the turn run, and pay for it, while suppressing delivery, which is the opposite of what you want at night. `activeHours` stops the run itself. ## Practical guidance - Set `agents.defaults.userTimezone` before you set any window, so every time-based feature agrees. - Keep the window to the hours you actually want to be interrupted; a heartbeat that cannot run cannot ping. - Use per-agent `activeHours` when one agent monitors something that does matter at night and another does not. - After changing it, read the next skip reasons rather than waiting for a quiet night to prove it.
- An OpenClaw owner set `activeHours` to 08:00-22:00 but still gets a message at 2 a.m.; what else could wake the agent?In 2026.9.9 targeted event wakes skip the active-hours check. A background command that exits triggers a completion turn by default (`tools.exec.notifyOnExit`), and that turn can deliver a message. Check `openclaw system heartbeat last` and the transcript marker to see whether it was a scheduled poll, and set `tools.exec.notifyOnExit: false` if completion turns are the source.
- How do you run OpenClaw heartbeats around the clock, and what setting looks right but disables them?Omit `activeHours`, or use `start: "00:00"` and `end: "24:00"`. Setting `start` and `end` to the same time, such as `08:00` to `08:00`, is a zero-width window, so every scheduled heartbeat is skipped.
- Ticks skipped at night are queued and all run at the window's start.
- activeHours always uses the host machine's clock.
- Setting start and end to the same time means run all day.
- target none is a cheap way to keep heartbeats quiet overnight.
- Once activeHours is set, nothing can wake the agent outside it.
Assumes OpenClaw 2026.9.9: the quiet-hours skip and the bypass for targeted event wakes are read from that release's heartbeat runner.