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

推荐订阅源

Jina AI
Jina AI
S
SegmentFault 最新的问题
D
DataBreaches.Net
H
Help Net Security
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
Martin Fowler
Martin Fowler
IT之家
IT之家
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
罗磊的独立博客
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
云风的 BLOG
云风的 BLOG
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
Vercel News
Vercel News
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
博客园 - 三生石上(FineUI控件)

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): resolve lastRunStatus in cron list/show human ...
ly-wang19 · 2026-06-16 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -4,11 +4,13 @@ import type { CronJob } from "../../cron/types.js";

44

import type { RuntimeEnv } from "../../runtime.js";

55

import {

66

coerceCronDeliveryPreviews,

7+

enrichCronJsonWithStatus,

78

getCronChannelOptions,

89

parseAt,

910

parseCronToolsAllow,

1011

parseDurationMs,

1112

printCronList,

13+

printCronShow,

1214

} from "./shared.js";

1315
1416

const hoisted = vi.hoisted(() => ({

@@ -338,3 +340,36 @@ describe("parseDurationMs", () => {

338340

expect(parseDurationMs(`9${"0".repeat(15)}ms`)).toBe(9_000_000_000_000_000);

339341

});

340342

});

343+
344+

describe("cron status rendering", () => {

345+

beforeEach(() => {

346+

hoisted.listChannelPluginsMock.mockReset();

347+

hoisted.listChannelPluginsMock.mockReturnValue([]);

348+

});

349+
350+

// `lastRunStatus` is the primary execution-status field (`lastStatus` is the

351+

// deprecated alias). The human `cron list`/`cron show` output must resolve it

352+

// the same way the `--json` status field does, instead of showing "idle".

353+

it("renders lastRunStatus (matching the --json status), not idle, when lastStatus is unset", () => {

354+

const now = Date.now();

355+

const job = createBaseJob({

356+

id: "status-job",

357+

sessionTarget: "isolated",

358+

state: { nextRunAtMs: now + 3_600_000, lastRunStatus: "ok" },

359+

});

360+
361+

const show = createRuntimeLogCapture();

362+

printCronShow(job, show.runtime);

363+

expectLogsToInclude(show.logs, "status: ok");

364+

expect(show.logs.join("\n")).not.toContain("status: idle");

365+
366+

const list = createRuntimeLogCapture();

367+

printCronList([job], list.runtime);

368+

const dataLine = list.logs.find((line) => line.includes("status-job")) ?? "";

369+

expect(dataLine).toContain("ok");

370+

expect(dataLine).not.toContain("idle");

371+
372+

// The computed --json status must agree with the human render.

373+

expect(enrichCronJsonWithStatus(job)).toMatchObject({ status: "ok" });

374+

});

375+

});

Original file line numberDiff line numberDiff line change

@@ -182,9 +182,12 @@ export async function warnIfCronSchedulerDisabled(opts: GatewayRpcOpts) {

182182

if (res?.enabled === true) {

183183

return;

184184

}

185-

const store = typeof res?.sqlitePath === "string" ? res.sqlitePath

186-

: typeof res?.storePath === "string" ? res.storePath

187-

: "";

185+

const store =

186+

typeof res?.sqlitePath === "string"

187+

? res.sqlitePath

188+

: typeof res?.storePath === "string"

189+

? res.storePath

190+

: "";

188191

defaultRuntime.error(

189192

[

190193

"warning: cron scheduler is disabled in the Gateway; jobs are saved but will not run automatically.",

@@ -377,17 +380,6 @@ const formatSchedule = (schedule: CronSchedule | undefined) => {

377380

return `${base} (stagger ${formatDurationHuman(staggerMs)})`;

378381

};

379382
380-

const formatStatus = (job: CronJob) => {

381-

if (!job.enabled) {

382-

return "disabled";

383-

}

384-

const state = job.state ?? {};

385-

if (state.runningAtMs) {

386-

return "running";

387-

}

388-

return state.lastStatus ?? "idle";

389-

};

390-
391383

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

392384

const previews =

393385

value && typeof value === "object"

@@ -450,7 +442,7 @@ export function printCronList(

450442

CRON_NEXT_PAD,

451443

);

452444

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

453-

const statusRaw = formatStatus(job);

445+

const statusRaw = computeStatus(job);

454446

const statusLabel = pad(statusRaw, CRON_STATUS_PAD);

455447

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

456448

const deliveryPreview = opts?.deliveryPreviews?.get(job.id);

@@ -528,6 +520,6 @@ export function printCronShow(

528520

runtime.log(`delivery: ${preview.label} (${preview.detail})`);

529521

runtime.log(`next: ${formatRelative(job.state.nextRunAtMs, Date.now())}`);

530522

runtime.log(`last: ${formatRelative(job.state.lastRunAtMs, Date.now())}`);

531-

runtime.log(`status: ${formatStatus(job)}`);

523+

runtime.log(`status: ${computeStatus(job)}`);

532524

runtime.log(`diagnostic: ${job.state.lastDiagnosticSummary ?? "-"}`);

533525

}