惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
WordPress大学
WordPress大学
博客园 - 【当耐特】
The Cloudflare Blog
B
Blog
Last Week in AI
Last Week in AI
小众软件
小众软件
量子位
S
SegmentFault 最新的问题
V
Visual Studio Blog
博客园 - 叶小钗
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
A
About on SuperTechFans
雷峰网
雷峰网
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
腾讯CDC
MongoDB | Blog
MongoDB | Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Martin Fowler
Martin Fowler

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(cron): tolerate malformed legacy jobs · openclaw/open...
vincentkoc · 2026-04-25 · via Recent Commits to openclaw:main

@@ -156,7 +156,17 @@ const CRON_DELIVERY_PAD = 64;

156156

const CRON_AGENT_PAD = 10;

157157

const CRON_MODEL_PAD = 20;

158158159-

const pad = (value: string, width: number) => value.padEnd(width);

159+

const stringifyCell = (value: unknown, fallback = "-") => {

160+

if (typeof value === "string") {

161+

return value;

162+

}

163+

if (typeof value === "number" || typeof value === "boolean") {

164+

return String(value);

165+

}

166+

return fallback;

167+

};

168+169+

const pad = (value: unknown, width: number) => stringifyCell(value).padEnd(width);

160170161171

const truncate = (value: string, width: number) => {

162172

if (value.length <= width) {

@@ -200,13 +210,16 @@ const formatRelative = (ms: number | null | undefined, nowMs: number) => {

200210

return delta >= 0 ? `in ${label}` : `${label} ago`;

201211

};

202212203-

const formatSchedule = (schedule: CronSchedule) => {

204-

if (schedule.kind === "at") {

213+

const formatSchedule = (schedule: CronSchedule | undefined) => {

214+

if (schedule?.kind === "at") {

205215

return `at ${formatIsoMinute(schedule.at)}`;

206216

}

207-

if (schedule.kind === "every") {

217+

if (schedule?.kind === "every") {

208218

return `every ${formatDurationHuman(schedule.everyMs)}`;

209219

}

220+

if (schedule?.kind !== "cron") {

221+

return "-";

222+

}

210223

const base = schedule.tz ? `cron ${schedule.expr} @ ${schedule.tz}` : `cron ${schedule.expr}`;

211224

const staggerMs = resolveCronStaggerMs(schedule);

212225

if (staggerMs <= 0) {

@@ -219,10 +232,11 @@ const formatStatus = (job: CronJob) => {

219232

if (!job.enabled) {

220233

return "disabled";

221234

}

222-

if (job.state.runningAtMs) {

235+

const state = job.state ?? {};

236+

if (state.runningAtMs) {

223237

return "running";

224238

}

225-

return job.state.lastStatus ?? "idle";

239+

return state.lastStatus ?? "idle";

226240

};

227241228242

export function coerceCronDeliveryPreviews(value: unknown): Map<string, CronDeliveryPreview> {

@@ -275,17 +289,18 @@ export function printCronList(

275289

const now = Date.now();

276290277291

for (const job of jobs) {

292+

const state = job.state ?? {};

278293

const idLabel = pad(job.id, CRON_ID_PAD);

279-

const nameLabel = pad(truncate(job.name, CRON_NAME_PAD), CRON_NAME_PAD);

294+

const nameLabel = pad(truncate(stringifyCell(job.name), CRON_NAME_PAD), CRON_NAME_PAD);

280295

const scheduleLabel = pad(

281296

truncate(formatSchedule(job.schedule), CRON_SCHEDULE_PAD),

282297

CRON_SCHEDULE_PAD,

283298

);

284299

const nextLabel = pad(

285-

job.enabled ? formatRelative(job.state.nextRunAtMs, now) : "-",

300+

job.enabled ? formatRelative(state.nextRunAtMs, now) : "-",

286301

CRON_NEXT_PAD,

287302

);

288-

const lastLabel = pad(formatRelative(job.state.lastRunAtMs, now), CRON_LAST_PAD);

303+

const lastLabel = pad(formatRelative(state.lastRunAtMs, now), CRON_LAST_PAD);

289304

const statusRaw = formatStatus(job);

290305

const statusLabel = pad(statusRaw, CRON_STATUS_PAD);

291306

const targetLabel = pad(job.sessionTarget ?? "-", CRON_TARGET_PAD);

@@ -297,7 +312,7 @@ export function printCronList(

297312

const agentLabel = pad(truncate(job.agentId ?? "-", CRON_AGENT_PAD), CRON_AGENT_PAD);

298313

const modelLabel = pad(

299314

truncate(

300-

(job.payload.kind === "agentTurn" ? job.payload.model : undefined) ?? "-",

315+

(job.payload?.kind === "agentTurn" ? job.payload.model : undefined) ?? "-",

301316

CRON_MODEL_PAD,

302317

),

303318

CRON_MODEL_PAD,

@@ -339,7 +354,7 @@ export function printCronList(

339354

? colorize(rich, theme.info, deliveryLabel)

340355

: colorize(rich, theme.muted, deliveryLabel),

341356

coloredAgent,

342-

job.payload.kind === "agentTurn" && job.payload.model

357+

job.payload?.kind === "agentTurn" && job.payload.model

343358

? colorize(rich, theme.info, modelLabel)

344359

: colorize(rich, theme.muted, modelLabel),

345360

].join(" ");