diff --git a/docs/automation/cron-jobs.md b/docs/automation/cron-jobs.md index 7f549ee7e9f..92559675856 100644 --- a/docs/automation/cron-jobs.md +++ b/docs/automation/cron-jobs.md @@ -86,6 +86,8 @@ This fires ~5–6 times per month instead of 0–1 times per month. OpenClaw use **Main session** jobs enqueue a system event and optionally wake the heartbeat (`--wake now` or `--wake next-heartbeat`). **Isolated** jobs run a dedicated agent turn with a fresh session. **Custom sessions** (`session:xxx`) persist context across runs, enabling workflows like daily standups that build on previous summaries. +For isolated jobs, “fresh session” means a new transcript/session id for each run. OpenClaw may carry safe preferences such as thinking/fast/verbose settings, labels, and explicit user-selected model/auth overrides, but it does not inherit ambient conversation context from an older cron row: channel/group routing, send or queue policy, elevation, origin, or ACP runtime binding. Use `current` or `session:` when a recurring job should deliberately build on the same conversation context. + For isolated jobs, runtime teardown now includes best-effort browser cleanup for that cron session. Cleanup failures are ignored so the actual cron result still wins. Isolated cron runs also dispose any bundled MCP runtime instances created for the job through the shared runtime-cleanup path. This matches how main-session and custom-session MCP clients are torn down, so isolated cron jobs do not leak stdio child processes or long-lived MCP connections across runs. @@ -116,7 +118,7 @@ Model-selection precedence for isolated jobs is: 1. Gmail hook model override (when the run came from Gmail and that override is allowed) 2. Per-job payload `model` -3. Stored cron session model override +3. User-selected stored cron session model override 4. Agent/default model selection Fast mode follows the resolved live selection too. If the selected model config @@ -124,10 +126,11 @@ has `params.fastMode`, isolated cron uses that by default. A stored session `fastMode` override still wins over config in either direction. If an isolated run hits a live model-switch handoff, cron retries with the -switched provider/model and persists that live selection before retrying. When -the switch also carries a new auth profile, cron persists that auth profile -override too. Retries are bounded: after the initial attempt plus 2 switch -retries, cron aborts instead of looping forever. +switched provider/model and persists that live selection for the active run +before retrying. When the switch also carries a new auth profile, cron persists +that auth profile override for the active run too. Retries are bounded: after +the initial attempt plus 2 switch retries, cron aborts instead of looping +forever. ## Delivery and output diff --git a/docs/cli/cron.md b/docs/cli/cron.md index d2bcb45b1d9..b2acd31321f 100644 --- a/docs/cli/cron.md +++ b/docs/cli/cron.md @@ -33,6 +33,11 @@ Note: `--session` supports `main`, `isolated`, `current`, and `session:`. Use `current` to bind to the active session at creation time, or `session:` for an explicit persistent session key. +Note: `--session isolated` creates a fresh transcript/session id for each run. +Safe preferences and explicit user-selected model/auth overrides can carry, but +ambient conversation context does not: channel/group routing, send/queue policy, +elevation, origin, and ACP runtime binding are reset for the new isolated run. + Note: for one-shot CLI jobs, offset-less `--at` datetimes are treated as UTC unless you also pass `--tz `, which interprets that local wall-clock time in the given timezone. @@ -59,17 +64,17 @@ model override with no explicit per-job fallback list no longer appends the agent primary as a hidden extra retry target. Note: isolated cron model precedence is Gmail-hook override first, then per-job -`--model`, then any stored cron-session model override, then the normal -agent/default selection. +`--model`, then any user-selected stored cron-session model override, then the +normal agent/default selection. Note: isolated cron fast mode follows the resolved live model selection. Model config `params.fastMode` applies by default, but a stored session `fastMode` override still wins over config. Note: if an isolated run throws `LiveSessionModelSwitchError`, cron persists the -switched provider/model (and switched auth profile override when present) before -retrying. The outer retry loop is bounded to 2 switch retries after the initial -attempt, then aborts instead of looping forever. +switched provider/model (and switched auth profile override when present) for +the active run before retrying. The outer retry loop is bounded to 2 switch +retries after the initial attempt, then aborts instead of looping forever. Note: failure notifications use `delivery.failureDestination` first, then global `cron.failureDestination`, and finally fall back to the job's primary diff --git a/docs/reference/session-management-compaction.md b/docs/reference/session-management-compaction.md index 196942c4334..016adf2ab86 100644 --- a/docs/reference/session-management-compaction.md +++ b/docs/reference/session-management-compaction.md @@ -101,6 +101,14 @@ Isolated cron runs also create session entries/transcripts, and they have dedica - `cron.sessionRetention` (default `24h`) prunes old isolated cron run sessions from the session store (`false` disables). - `cron.runLog.maxBytes` + `cron.runLog.keepLines` prune `~/.openclaw/cron/runs/.jsonl` files (defaults: `2_000_000` bytes and `2000` lines). +When cron force-creates a new isolated run session, it sanitizes the previous +`cron:` session entry before writing the new row. It carries safe +preferences such as thinking/fast/verbose settings, labels, and explicit +user-selected model/auth overrides. It drops ambient conversation context such +as channel/group routing, send or queue policy, elevation, origin, and ACP +runtime binding so a fresh isolated run cannot inherit stale delivery or +runtime authority from an older run. + --- ## Session keys (`sessionKey`)