Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix: Unify the default wake_offset_seconds value to 300

wncbdj2e7e747cd5c3
diff --git a/docs/en/ScheduledTasks.md b/docs/en/ScheduledTasks.md
index 3a3a84edd2..b0ff3c65bd 100644
--- a/docs/en/ScheduledTasks.md
+++ b/docs/en/ScheduledTasks.md
@@ -25,7 +25,7 @@ How to create and manage a simple scheduled job in JiuwenClaw and push results t
- **targets**: `web` and/or `feishu`
- **enabled**: checked (`true`)
- **description**: natural language for what the agent should do at fire time, e.g. a short health reminder in Chinese or English.
- - **wake_offset_seconds** (optional): default `60` to wake the agent one minute early.
+ - **wake_offset_seconds** (optional): default `300` to wake the agent five minutes early.
![](../assets/images/定时任务1.png)
diff --git "a/docs/zh/\345\256\232\346\227\266\344\273\273\345\212\241.md" "b/docs/zh/\345\256\232\346\227\266\344\273\273\345\212\241.md"
index 1e43a59352..aa5942e5d3 100644
--- "a/docs/zh/\345\256\232\346\227\266\344\273\273\345\212\241.md"
+++ "b/docs/zh/\345\256\232\346\227\266\344\273\273\345\212\241.md"
@@ -28,7 +28,7 @@
- **enabled(是否启用)**:勾选(`true`)
- **description(任务内容)**:一句自然语言,描述到点时要让 Agent 做什么,例如:
`生成一段简短的中文文本,说明当前时间点的健康打卡提醒。`
- - **wake_offset_seconds(提前秒数,可选)**:默认 60,表示提前 1 分钟唤醒 Agent 做准备。
+ - **wake_offset_seconds(提前秒数,可选)**:默认 300,表示提前 5 分钟唤醒 Agent 做准备。
![](../assets/images/定时任务1.png)
3. 保存后,任务会写入 `~/.jiuwenclaw/workspace/cron_jobs.json`,调度器自动生效。
diff --git a/jiuwenclaw/gateway/cron/controller.py b/jiuwenclaw/gateway/cron/controller.py
index 0838dd3e71..1e6af8015f 100644
--- a/jiuwenclaw/gateway/cron/controller.py
+++ b/jiuwenclaw/gateway/cron/controller.py
@@ -372,8 +372,8 @@ class CronController:
},
"wake_offset_seconds": {
"type": "integer",
- "description": "Seconds to wake before push. Default 60",
- "default": 60,
+ "description": "Seconds to wake before push. Default 300",
+ "default": 300,
},
},
"required": ["name", "cron_expr", "timezone", "description"],
diff --git a/jiuwenclaw/gateway/cron/cron_json_convert.py b/jiuwenclaw/gateway/cron/cron_json_convert.py
index 0792787115..d3dec463f4 100644
--- a/jiuwenclaw/gateway/cron/cron_json_convert.py
+++ b/jiuwenclaw/gateway/cron/cron_json_convert.py
@@ -12,7 +12,7 @@ CLI 工具:把 cron JSON 在「扁平结构」与「OpenClaw 嵌套结构」
"enabled": true,
"cron_expr": "0 9 * * *",
"timezone": "Asia/Shanghai",
- "wake_offset_seconds": 60,
+ "wake_offset_seconds": 300,
"description": "...",
"targets": "web"
}
@@ -118,7 +118,7 @@ def convert_cron_job_dict_to_flat(data: dict[str, Any]) -> dict[str, Any]:
return data
# 你的偏好:不管 OpenClaw 里 wakeMode 是什么,转换到 jiuwenclaw 时都统一写成 60s
- wake_offset_seconds = 60
+ wake_offset_seconds = 300
desc = str(data.get("description") or data.get("name") or "")
payload = data.get("payload")
diff --git a/jiuwenclaw/gateway/cron/models.py b/jiuwenclaw/gateway/cron/models.py
index 69779a3ab1..a39ce34055 100644
--- a/jiuwenclaw/gateway/cron/models.py
+++ b/jiuwenclaw/gateway/cron/models.py
@@ -142,7 +142,7 @@ class CronJob:
enabled = bool(data.get("enabled", False))
expired = bool(data.get("expired", False))
- wake_offset_seconds_raw = data.get("wake_offset_seconds", 60)
+ wake_offset_seconds_raw = data.get("wake_offset_seconds", 300)
try:
wake_offset_seconds = int(wake_offset_seconds_raw)
except Exception as exc: # noqa: BLE001
diff --git a/jiuwenclaw/gateway/cron/store.py b/jiuwenclaw/gateway/cron/store.py
index 8cccff34ba..4f4c4c7413 100644
--- a/jiuwenclaw/gateway/cron/store.py
+++ b/jiuwenclaw/gateway/cron/store.py
@@ -76,7 +76,7 @@ class CronJobStore:
enabled=bool(enabled),
cron_expr=str(cron_expr or "").strip(),
timezone=str(timezone or "").strip(),
- wake_offset_seconds=int(wake_offset_seconds) if wake_offset_seconds is not None else 60,
+ wake_offset_seconds=int(wake_offset_seconds) if wake_offset_seconds is not None else 300,
description=str(description or ""),
targets=str(targets or "").strip(),
session_id=sid,
diff --git a/jiuwenclaw/web/src/components/CronPanel/index.tsx b/jiuwenclaw/web/src/components/CronPanel/index.tsx
index eaa21cb2d1..0b2cb7f3c2 100644
--- a/jiuwenclaw/web/src/components/CronPanel/index.tsx
+++ b/jiuwenclaw/web/src/components/CronPanel/index.tsx
@@ -76,7 +76,7 @@ function createEmptyJobInput(): CronJobInput {
enabled: true,
cron_expr: '',
timezone: DEFAULT_CRON_TIMEZONE,
- wake_offset_seconds: 60,
+ wake_offset_seconds: 300,
description: '',
targets: DEFAULT_CRON_TARGET,
};
@@ -224,7 +224,7 @@ function normalizeJobForEdit(job: CronJob): UpdateCronJob {
enabled: Boolean(job.enabled),
cron_expr: resolveCronExpr(job),
timezone: resolveTimezone(job),
- wake_offset_seconds: Number.isFinite(job.wake_offset_seconds) ? job.wake_offset_seconds : 0,
+ wake_offset_seconds: Number.isFinite(job.wake_offset_seconds) ? job.wake_offset_seconds : 300,
description: resolveDescription(job),
targets: resolveTargets(job),
created_at: job.created_at,
@@ -674,7 +674,7 @@ export default function CronPanel({ sessionId }: CronPanelProps) {
enabled: true,
cron_expr: '',
timezone: DEFAULT_CRON_TIMEZONE,
- wake_offset_seconds: 0,
+ wake_offset_seconds: 300,
description: '',
targets: DEFAULT_CRON_TARGET,
});