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

推荐订阅源

Google DeepMind News
Google DeepMind News
I
InfoQ
Engineering at Meta
Engineering at Meta
D
DataBreaches.Net
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Announcements
Recent Announcements
GbyAI
GbyAI
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
美团技术团队
罗磊的独立博客
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
M
MIT News - Artificial intelligence
D
Docker
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs
博客园 - 叶小钗

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): isolate main-session cron wake lanes (#82767) ...
galiniliev · 2026-05-20 · via Recent Commits to openclaw:main

@@ -1,8 +1,9 @@

11

import fs from "node:fs/promises";

2+

import path from "node:path";

23

import { afterEach, describe, expect, it, vi } from "vitest";

34

import { setupCronServiceSuite, writeCronStoreSnapshot } from "../../cron/service.test-harness.js";

45

import { createCronServiceState } from "../../cron/service/state.js";

5-

import { onTimer } from "../../cron/service/timer.js";

6+

import { executeJobCore, onTimer } from "../../cron/service/timer.js";

67

import { loadCronStore, saveCronStore } from "../../cron/store.js";

78

import type { CronJob } from "../../cron/types.js";

89

import * as detachedTaskRuntime from "../../tasks/detached-task-runtime.js";

@@ -49,6 +50,62 @@ afterEach(() => {

4950

});

50515152

describe("cron service timer seam coverage", () => {

53+

it("routes main cron jobs onto a cron run lane derived from the target agent", async () => {

54+

const { storePath } = await makeStorePath();

55+

const now = Date.parse("2026-03-23T12:00:00.000Z");

56+

const enqueueSystemEvent = vi.fn();

57+

const requestHeartbeat = vi.fn();

58+

const runHeartbeatOnce = vi.fn(async () => ({ status: "ran" as const, durationMs: 1 }));

59+

const job = {

60+

...createDueMainJob({ now, wakeMode: "now" }),

61+

sessionKey: "agent:main-pr-router:main",

62+

state: { runningAtMs: now },

63+

};

64+

const cronRunSessionKey = `agent:main-pr-router:cron:main-heartbeat-job:run:${now}`;

65+

const sessionStorePath = path.join(path.dirname(path.dirname(storePath)), "sessions.json");

66+

await fs.writeFile(

67+

sessionStorePath,

68+

JSON.stringify({

69+

"agent:main-pr-router:main": {

70+

lastChannel: "discord",

71+

lastTo: "channel-1",

72+

lastAccountId: "default",

73+

},

74+

}),

75+

"utf8",

76+

);

77+78+

const state = createCronServiceState({

79+

storePath,

80+

cronEnabled: true,

81+

log: logger,

82+

nowMs: () => now,

83+

resolveSessionStorePath: () => sessionStorePath,

84+

enqueueSystemEvent,

85+

requestHeartbeat,

86+

runHeartbeatOnce,

87+

runIsolatedAgentJob: vi.fn(async () => ({ status: "ok" as const })),

88+

});

89+90+

const result = await executeJobCore(state, job);

91+92+

expect(result).toMatchObject({ status: "ok", sessionKey: cronRunSessionKey });

93+

expect(enqueueSystemEvent).toHaveBeenCalledWith("heartbeat seam tick", {

94+

agentId: undefined,

95+

sessionKey: cronRunSessionKey,

96+

contextKey: "cron:main-heartbeat-job",

97+

deliveryContext: { channel: "discord", to: "channel-1", accountId: "default" },

98+

});

99+

expect(runHeartbeatOnce).toHaveBeenCalledWith({

100+

source: "cron",

101+

intent: "immediate",

102+

reason: "cron:main-heartbeat-job",

103+

agentId: undefined,

104+

sessionKey: cronRunSessionKey,

105+

heartbeat: { target: "last" },

106+

});

107+

});

108+52109

it("persists the next schedule and hands off next-heartbeat main jobs", async () => {

53110

const { storePath } = await makeStorePath();

54111

const now = Date.parse("2026-03-23T12:00:00.000Z");

@@ -73,17 +130,18 @@ describe("cron service timer seam coverage", () => {

7313074131

await onTimer(state);

75132133+

const cronRunSessionKey = `agent:main:cron:main-heartbeat-job:run:${now}`;

76134

expect(enqueueSystemEvent).toHaveBeenCalledWith("heartbeat seam tick", {

77135

agentId: undefined,

78-

sessionKey: "agent:main:main",

136+

sessionKey: cronRunSessionKey,

79137

contextKey: "cron:main-heartbeat-job",

80138

});

81139

expect(requestHeartbeat).toHaveBeenCalledWith({

82140

source: "cron",

83141

intent: "event",

84142

reason: "cron:main-heartbeat-job",

85143

agentId: undefined,

86-

sessionKey: "agent:main:main",

144+

sessionKey: cronRunSessionKey,

87145

heartbeat: { target: "last" },

88146

});

89147

@@ -103,7 +161,7 @@ describe("cron service timer seam coverage", () => {

103161

expect(task.sourceId).toBe("main-heartbeat-job");

104162

expect(task.ownerKey).toBe("");

105163

expect(task.scopeKind).toBe("system");

106-

expect(task.childSessionKey).toBe("agent:main:main");

164+

expect(task.childSessionKey).toBe(cronRunSessionKey);

107165

expect(task.runId).toBe(`cron:main-heartbeat-job:${now}`);

108166

expect(task.label).toBe("main heartbeat job");

109167

expect(task.task).toBe("main heartbeat job");

@@ -201,9 +259,10 @@ describe("cron service timer seam coverage", () => {

201259

{ jobId: "main-heartbeat-job", error: ledgerError },

202260

"cron: failed to create task ledger record",

203261

);

262+

const cronRunSessionKey = `agent:main:cron:main-heartbeat-job:run:${now}`;

204263

expect(enqueueSystemEvent).toHaveBeenCalledWith("heartbeat seam tick", {

205264

agentId: undefined,

206-

sessionKey: "agent:main:main",

265+

sessionKey: cronRunSessionKey,

207266

contextKey: "cron:main-heartbeat-job",

208267

});

209268