Skip to content

Commit d6b2e14

Browse files
authored
feat(cron): enable automation triggers by default (#125025)
* feat(cron): enable automation triggers by default Condition watchers, script payloads, and stream schedules were gated behind cron.triggers.enabled=false, so the capability shipped dark and the automations tool told the model to call it unsupported. The gate did not buy what its warning implied. cronJobUsesToolRuntime treats agentTurn, script, and trigger.script identically for tool policy, and jobs are capped to the creating agent's allowlist via creatorToolAllowlist -- but an agentTurn cron job was never gated, so unattended recurring exec with that same creator-capped authority was already reachable. The gated paths are strictly tighter: a condition gate gets 30s, 5 tool calls, 16KB state and a 30s minimum interval, where an agentTurn has no such budget. Sandboxing already applies to trigger scripts, which resolve sandbox context and redirect the workspace when access is not rw. Absent config now means enabled; an explicit cron.triggers.enabled: false still disables every surface it disabled before, and the error text names the opt-out instead of telling operators to turn something on. No new config key, no migration. Docs: reword the trigger warning for default-on while keeping the unattended execution note, and record the new default in the configuration reference. * test(cron): refresh prompt snapshots for default-on triggers Trigger, stream-schedule, and script-payload surfaces are now advertised in the automations tool description by default, so the committed fixtures drift. This also records the cost: dynamicToolsJson grows 49,477 -> 52,541 chars and the snapshot total 76,861 -> 79,925 (~766 rough tokens per prompt). That is the price of no longer dark-shipping the capability. * test(mcp): expect trigger surfaces by default in the tools bridge The MCP tools bridge mirrors the scheduler gate, so an absent cron.triggers config now advertises the trigger surface. Explicit false still narrows it and explicit true still widens it; both assertions are unchanged.
1 parent 57e3ee6 commit d6b2e14

27 files changed

Lines changed: 190 additions & 89 deletions

‎docs/automation/cron-jobs.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Heartbeat scratch is now monitor prose only. Runtime heartbeats do not parse `ta
8989

9090
### Stream sources
9191

92-
A stream schedule keeps an operator-authored argv command running under the Gateway and fires the job from its stdout and stderr lines. Stream schedules are event-driven, never time-due, and require `cron.triggers.enabled: true` because the long-lived command has the same unattended trust class as trigger scripts. Disabling or removing the job stops the process; Gateway shutdown waits for process-tree teardown. Fast failures restart with the scheduler's built-in error backoff. Five consecutive runs shorter than 60 seconds leave the job in an error state and use the normal failure-alert path; manually re-enable the job to clear the restart cap.
92+
A stream schedule keeps an operator-authored argv command running under the Gateway and fires the job from its stdout and stderr lines. Stream schedules are event-driven, never time-due, and are available by default. Set `cron.triggers.enabled: false` to disable them together with condition-trigger scripts and script payloads. Disabling or removing the job stops the process; Gateway shutdown waits for process-tree teardown. Fast failures restart with the scheduler's built-in error backoff. Five consecutive runs shorter than 60 seconds leave the job in an error state and use the normal failure-alert path; manually re-enable the job to clear the restart cap.
9393

9494
```bash
9595
openclaw automations add \
@@ -155,7 +155,7 @@ The script must return `{ fire, message?, state? }`. The previous JSON state is
155155
Author watchers around **actionable state**, not only success: a watcher that goes quiet when its check fails or times out looks healthy while broken. Compare the observation with `trigger.state` and return fresh state to deduplicate; do not rely on model or process memory. When firing, make `message` self-contained because it becomes the fired run's complete event context.
156156

157157
<Warning>
158-
Enabling `cron.triggers.enabled` permits both condition-trigger scripts and `script` payloads to run headlessly with the owning agent's **full tool policy, including `exec`**. Treat this as unattended code execution with that agent's permissions; leave it disabled unless every agent allowed to create automation jobs is trusted accordingly.
158+
Condition-trigger scripts and `script` payloads run unattended by default with the owning agent's **full tool policy, including `exec`**. Stream schedules also keep operator-authored commands running unattended. Treat these surfaces as unattended code execution with that agent's permissions. Operators who need a hard stop can set `cron.triggers.enabled: false`; remove it or set it to `true` to re-enable them.
159159
</Warning>
160160

161161
Create a watcher from a local script file (`-` reads the script from stdin):
@@ -264,7 +264,7 @@ Delivered text is derived from process output: non-empty stdout wins; if stdout
264264

265265
### Script payloads
266266

267-
Script payloads run headlessly in the same code-mode executor as trigger scripts, without starting a conversational agent turn. Enable `cron.triggers.enabled` before creating or running them; this dangerous-automation gate covers both trigger scripts and script payloads. Script jobs support only `main` and `isolated` session targets.
267+
Script payloads run headlessly in the same code-mode executor as trigger scripts, without starting a conversational agent turn. They are available by default; setting `cron.triggers.enabled: false` disables creation and execution of script payloads together with condition-trigger scripts and stream schedules. Script jobs support only `main` and `isolated` session targets.
268268

269269
```bash
270270
openclaw automations create "0 * * * *" \

‎docs/gateway/configuration-reference.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,7 @@ Current builds no longer include the TCP bridge. Nodes connect over the Gateway
16441644
```
16451645

16461646
- `enabled`: execute stored automation jobs (default: `true`). Set `false` to pause all automation execution without deleting jobs.
1647-
- `triggers.enabled`: also run event-driven automation triggers (default: `false`).
1647+
- `triggers.enabled`: run event-driven automation triggers (default: `true`). Set `false` to disable condition triggers, script payloads, and stream schedules.
16481648
- `sessionRetention`: how long to keep completed isolated automation run sessions before pruning SQLite session rows. Also controls cleanup of archived deleted automation transcripts. Default: `24h`; set `false` or a zero duration such as `"0h"` to disable (negative durations are invalid).
16491649
- Run history automatically keeps the newest 2000 terminal rows per job. Lost rows retain their 24-hour cleanup window.
16501650
- `webhookToken`: bearer token used for automation webhook POST delivery (`delivery.mode = "webhook"`), if omitted no auth header is sent.

‎docs/gateway/security/index.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,11 @@ Set per channel or per room/conversation - see [Groups](/channels/groups#context
226226

227227
## Prompt injection
228228

229-
An attacker crafts a message that manipulates the model into unsafe action ("ignore your instructions", "dump your filesystem", "follow this link and run commands"). Prompt injection is **not solved** by system prompt guardrails alone - those are soft guidance; hard enforcement comes from tool policy, exec approvals, sandboxing, and channel allowlists (which operators can still disable by design).
229+
An attacker crafts a message that manipulates the model into unsafe action ("ignore your instructions", "dump your filesystem", "follow this link and run commands").
230+
231+
Model choice now carries real weight here. Frontier models have become substantially more resistant: in a 2026 crowdsourced arena of 272K attacks across 41 agent scenarios - scored only when the agent both executed the harmful action **and** hid it from the user - success rates were 0.5% for Claude Opus 4.5, 1.0% for Sonnet 4.5, 1.3% for Haiku 4.5, and 8.5% for Gemini 2.5 Pro. Robustness tracked capability within a model family, so the models we recommend are a meaningful mitigation in their own right, not just a soft guardrail.
232+
233+
Two caveats keep this from being a solved problem. Adaptive human attackers still break models that score well on static benchmarks, with published success rates above 80% against state-of-the-art defenses once the attacker adapts. And smaller or older models remain markedly easier to steer. So treat model choice as your first and cheapest layer, then keep hard enforcement - tool policy, exec approvals, sandboxing, and channel allowlists - for anything whose blast radius you would not accept on a bad day.
230234

231235
Prompt injection does not require public DMs: even if only you can message the bot, any **untrusted content** it reads (web search/fetch results, browser pages, emails, docs, attachments, pasted logs/code) can carry adversarial instructions. The content itself is a threat surface, not just the sender.
232236

@@ -239,7 +243,7 @@ Red flags to treat as untrusted:
239243

240244
What helps in practice:
241245

242-
- Keep inbound DMs locked down (pairing/allowlists); prefer mention gating in groups; avoid always-on bots in public rooms.
246+
- Keep inbound DMs locked down (pairing/allowlists). Groups are a supported deployment, not a last resort: use mention gating and `contextVisibility` so the agent reads what it needs and no more. Reserve extra caution for genuinely public rooms, where anyone can post untrusted content.
243247
- Treat links, attachments, and pasted instructions as hostile by default.
244248
- Run sensitive tool execution in a sandbox; keep secrets out of the agent's reachable filesystem. Sandboxing is opt-in: if sandbox mode is off, implicit `host=auto` resolves to the gateway host, while explicit `host=sandbox` still fails closed (no sandbox runtime available). Set `host=gateway` to make that behavior explicit in config.
245249
- Limit high-risk tools (`exec`, `browser`, `web_fetch`, `web_search`) to trusted agents or explicit allowlists.
@@ -840,7 +844,7 @@ Details: [Logging](/gateway/logging)
840844
}
841845
```
842846

843-
Keeps the Gateway private, requires DM pairing, and avoids always-on group bots. For safer tool execution too, add a sandbox + deny dangerous tools for any non-owner agent (see "Per-agent access profiles" above).
847+
Keeps the Gateway private, requires DM pairing, and gates group replies behind a mention. Groups are fully supported - sender identity is threaded through to the agent, and per-group settings let one room run different defaults than another - so the goal here is scoping the agent's attention, not avoiding groups. For safer tool execution too, add a sandbox + deny dangerous tools for any non-owner agent (see "Per-agent access profiles" above).
844848

845849
### Separate numbers (WhatsApp, Signal, Telegram)
846850

‎docs/security/THREAT-MODEL-ATLAS.md‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -183,27 +183,27 @@ Out-of-scope reports and false-positive patterns (public internet exposure, prom
183183

184184
#### T-EXEC-001: Direct prompt injection
185185

186-
| Attribute | Value |
187-
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
188-
| **ATLAS ID** | AML.T0051.000 - LLM Prompt Injection: Direct |
189-
| **Description** | Attacker sends crafted prompts to manipulate agent behavior |
190-
| **Attack vector** | Channel messages containing adversarial instructions |
191-
| **Affected components** | Agent LLM, all input surfaces |
192-
| **Current mitigations** | Pattern detection, external content wrapping; treated as out-of-scope for vulnerability reports absent a boundary bypass (see `SECURITY.md`) |
193-
| **Residual risk** | Critical - detection only, no blocking; sophisticated attacks bypass |
194-
| **Recommendations** | Output validation and user confirmation for sensitive actions, layered on top of existing detection |
186+
| Attribute | Value |
187+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
188+
| **ATLAS ID** | AML.T0051.000 - LLM Prompt Injection: Direct |
189+
| **Description** | Attacker sends crafted prompts to manipulate agent behavior |
190+
| **Attack vector** | Channel messages containing adversarial instructions |
191+
| **Affected components** | Agent LLM, all input surfaces |
192+
| **Current mitigations** | Pattern detection, external content wrapping, and frontier-model robustness (2026 crowdsourced arena: 0.5% ASR on Claude Opus 4.5, 8.5% on Gemini 2.5 Pro, scored on execution plus concealment); treated as out-of-scope for vulnerability reports absent a boundary bypass (see `SECURITY.md`) |
193+
| **Residual risk** | Model-tier dependent - low single-digit ASR against organic attacks on recommended frontier models, but adaptive attackers still exceed 80% against state-of-the-art defenses, and smaller/older models remain markedly easier to steer |
194+
| **Recommendations** | Output validation and user confirmation for sensitive actions, layered on top of existing detection |
195195

196196
#### T-EXEC-002: Indirect prompt injection
197197

198-
| Attribute | Value |
199-
| ----------------------- | --------------------------------------------------------------------------------------------------------------------- |
200-
| **ATLAS ID** | AML.T0051.001 - LLM Prompt Injection: Indirect |
201-
| **Description** | Attacker embeds malicious instructions in fetched content |
202-
| **Attack vector** | Malicious URLs, poisoned emails, compromised webhooks |
203-
| **Affected components** | `web_fetch`, email ingestion, external data sources |
204-
| **Current mitigations** | Content wrapping with random-boundary XML-style markers, homoglyph/special-token normalization, and a security notice |
205-
| **Residual risk** | High - LLM may still ignore wrapper instructions |
206-
| **Recommendations** | Separate execution contexts for wrapped content |
198+
| Attribute | Value |
199+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
200+
| **ATLAS ID** | AML.T0051.001 - LLM Prompt Injection: Indirect |
201+
| **Description** | Attacker embeds malicious instructions in fetched content |
202+
| **Attack vector** | Malicious URLs, poisoned emails, compromised webhooks |
203+
| **Affected components** | `web_fetch`, email ingestion, external data sources |
204+
| **Current mitigations** | Content wrapping with random-boundary XML-style markers, homoglyph/special-token normalization, a security notice, and frontier-model robustness (see T-EXEC-001) |
205+
| **Residual risk** | Model-tier dependent - recommended frontier models largely hold the wrapper boundary, but it remains soft guidance an adaptive attacker can erode; scope tool policy and sandboxing to the blast radius you accept |
206+
| **Recommendations** | Separate execution contexts for wrapped content |
207207

208208
#### T-EXEC-003: Tool argument injection
209209

‎src/agents/tools/cron-tool-schema.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const CRON_ACTIONS = [
3535
] as const;
3636

3737
const CRON_SCHEDULE_KINDS = ["at", "every", "cron", "stream"] as const;
38-
// Stream schedules, script payloads, and condition triggers all require
39-
// cron.triggers.enabled; when it is off the scheduler rejects them, so the
38+
// When cron.triggers.enabled is explicitly false, the scheduler rejects
39+
// stream schedules, script payloads, and condition triggers, so the
4040
// model-facing schema must not advertise them.
4141
const CRON_SCHEDULE_KINDS_TRIGGERS_DISABLED = ["at", "every", "cron"] as const;
4242
const CRON_WAKE_MODES = ["now", "next-heartbeat"] as const;
@@ -106,7 +106,7 @@ function createCronScheduleSchema(params: { triggersEnabled: boolean }): TSchema
106106
Type.Array(Type.String({ minLength: 1 }), {
107107
minItems: 1,
108108
description:
109-
"Supervised source argv (kind=stream; requires cron.triggers.enabled)",
109+
"Supervised source argv (kind=stream; disabled when cron.triggers.enabled=false)",
110110
}),
111111
),
112112
cwd: Type.Optional(Type.String({ description: "Working directory (kind=stream)" })),

‎src/agents/tools/cron-tool.schema.test.ts‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,16 +519,12 @@ describe("createCronToolSchema with cron triggers disabled", () => {
519519
expect(propertyAt(configlessSchema, "job.schedule.kind")?.enum).toContain("stream");
520520
});
521521

522-
it("gates the surface when config omits cron.triggers entirely (disabled default)", () => {
522+
it("keeps the full surface when config omits cron.triggers (enabled default)", () => {
523523
const defaultPostureSchema = createCronTool({
524524
config: { cron: { enabled: true } } as OpenClawConfig,
525525
}).parameters as unknown as Record<string, unknown>;
526-
expect(keysAt(defaultPostureSchema, "job")).not.toContain("trigger");
527-
expect(propertyAt(defaultPostureSchema, "job.schedule.kind")?.enum).toEqual([
528-
"at",
529-
"every",
530-
"cron",
531-
]);
526+
expect(keysAt(defaultPostureSchema, "job")).toContain("trigger");
527+
expect(propertyAt(defaultPostureSchema, "job.schedule.kind")?.enum).toContain("stream");
532528
});
533529

534530
it("still validates a plain reminder add call", () => {

‎src/agents/tools/cron-tool.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ describe("cron tool", () => {
939939
const tool = createTestCronTool();
940940

941941
expect(tool.description).toContain(
942-
"needs cron.triggers.enabled — if off, say so; never model-poll instead",
942+
"available unless cron.triggers.enabled=false — if off, say so; never model-poll instead",
943943
);
944944
expect(tool.description).toContain("Quiet headless check, no model");
945945
expect(tool.description).toContain("trigger.state");

0 commit comments

Comments
 (0)