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

推荐订阅源

罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
爱范儿
爱范儿
小众软件
小众软件
MyScale Blog
MyScale Blog
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
V
V2EX
量子位
云风的 BLOG
云风的 BLOG
A
About on SuperTechFans
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
C
Check Point Blog
月光博客
月光博客

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): allow restricted self introspection (#78403) ·...
amknight · 2026-05-06 · via Recent Commits to openclaw:main

@@ -198,14 +198,136 @@ describe("cron tool", () => {

198198

expect(callGatewayMock).not.toHaveBeenCalled();

199199

});

200200201-

it("denies scoped isolated cron runs from using non-remove cron actions", async () => {

201+

it("allows scoped isolated cron runs to read cron scheduler status", async () => {

202+

callGatewayMock.mockResolvedValueOnce({

203+

enabled: true,

204+

storePath: "/home/user/.openclaw/cron/jobs.json",

205+

jobs: 37,

206+

nextWakeAtMs: 1_234,

207+

});

202208

const tool = createTestCronTool({ selfRemoveOnlyJobId: "job-current" });

203209204-

await expect(

205-

tool.execute("call-list", {

206-

action: "list",

207-

}),

208-

).rejects.toThrow("Cron tool is restricted to removing the current cron job.");

210+

const result = await tool.execute("call-status", {

211+

action: "status",

212+

timeoutMs: 10_000,

213+

});

214+215+

const params = expectSingleGatewayCallMethod("cron.status");

216+

expect(params).toEqual({});

217+

expect(result.details).toEqual({ enabled: true });

218+

});

219+220+

it("allows scoped isolated cron runs to list only the current job", async () => {

221+

callGatewayMock.mockResolvedValueOnce({

222+

jobs: [

223+

{ id: "job-current", name: "current" },

224+

{ id: "job-other", name: "other" },

225+

],

226+

total: 2,

227+

offset: 0,

228+

limit: 2,

229+

hasMore: false,

230+

nextOffset: null,

231+

deliveryPreviews: {

232+

"job-current": { label: "current", detail: "self" },

233+

"job-other": { label: "other", detail: "hidden" },

234+

},

235+

});

236+

const tool = createTestCronTool({

237+

agentSessionKey: "agent:agent-123:cron:job-current:run:abc",

238+

selfRemoveOnlyJobId: "job-current",

239+

});

240+241+

const result = await tool.execute("call-list", {

242+

action: "list",

243+

agentId: "other-agent",

244+

includeDisabled: true,

245+

});

246+247+

const params = expectSingleGatewayCallMethod("cron.list");

248+

expect(params).toEqual({ includeDisabled: true, agentId: "agent-123", limit: 200, offset: 0 });

249+

expect(result.details).toEqual({

250+

jobs: [{ id: "job-current", name: "current" }],

251+

total: 1,

252+

offset: 0,

253+

limit: 1,

254+

hasMore: false,

255+

nextOffset: null,

256+

deliveryPreviews: {

257+

"job-current": { label: "current", detail: "self" },

258+

},

259+

});

260+

});

261+262+

it("pages scoped isolated cron list until it finds the current job", async () => {

263+

callGatewayMock

264+

.mockResolvedValueOnce({

265+

jobs: Array.from({ length: 200 }, (_, index) => ({

266+

id: `job-old-${index}`,

267+

name: `old ${index}`,

268+

})),

269+

total: 201,

270+

offset: 0,

271+

limit: 200,

272+

hasMore: true,

273+

nextOffset: 200,

274+

deliveryPreviews: {},

275+

})

276+

.mockResolvedValueOnce({

277+

jobs: [{ id: "job-current", name: "current" }],

278+

total: 201,

279+

offset: 200,

280+

limit: 200,

281+

hasMore: false,

282+

nextOffset: null,

283+

deliveryPreviews: {

284+

"job-current": { label: "current", detail: "self" },

285+

},

286+

});

287+

const tool = createTestCronTool({

288+

agentSessionKey: "agent:agent-123:cron:job-current:run:abc",

289+

selfRemoveOnlyJobId: "job-current",

290+

});

291+292+

const result = await tool.execute("call-list-paged", {

293+

action: "list",

294+

includeDisabled: true,

295+

});

296+297+

expect(callGatewayMock).toHaveBeenCalledTimes(2);

298+

expect(readGatewayCall(0)).toEqual({

299+

method: "cron.list",

300+

params: { includeDisabled: true, agentId: "agent-123", limit: 200, offset: 0 },

301+

});

302+

expect(readGatewayCall(1)).toEqual({

303+

method: "cron.list",

304+

params: { includeDisabled: true, agentId: "agent-123", limit: 200, offset: 200 },

305+

});

306+

expect(result.details).toEqual({

307+

jobs: [{ id: "job-current", name: "current" }],

308+

total: 1,

309+

offset: 0,

310+

limit: 1,

311+

hasMore: false,

312+

nextOffset: null,

313+

deliveryPreviews: {

314+

"job-current": { label: "current", detail: "self" },

315+

},

316+

});

317+

});

318+319+

it.each([

320+

["add", { action: "add", job: buildReminderAgentTurnJob() }],

321+

["update", { action: "update", jobId: "job-current", patch: { enabled: false } }],

322+

["run", { action: "run", jobId: "job-current" }],

323+

["runs", { action: "runs", jobId: "job-current" }],

324+

["wake", { action: "wake", text: "wake up" }],

325+

])("denies scoped isolated cron runs from using %s", async (_action, args) => {

326+

const tool = createTestCronTool({ selfRemoveOnlyJobId: "job-current" });

327+328+

await expect(tool.execute("call-denied", args)).rejects.toThrow(

329+

"Cron tool is restricted to removing the current cron job.",

330+

);

209331210332

expect(callGatewayMock).not.toHaveBeenCalled();

211333

});