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

推荐订阅源

N
Netflix TechBlog - Medium
G
Google Developers Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
L
LangChain Blog
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
小众软件
小众软件
WordPress大学
WordPress大学
A
About on SuperTechFans
大猫的无限游戏
大猫的无限游戏
C
Check Point Blog
月光博客
月光博客
Stack Overflow Blog
Stack Overflow Blog
美团技术团队
Jina AI
Jina AI
T
Tailwind CSS Blog
Google DeepMind News
Google DeepMind News
D
Docker

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: route tasks json through lean cli path · openclaw/op...
steipete · 2026-04-27 · via Recent Commits to openclaw:main

@@ -7,6 +7,8 @@ const modelsListCommandMock = vi.hoisted(() => vi.fn(async () => {}));

77

const modelsStatusCommandMock = vi.hoisted(() => vi.fn(async () => {}));

88

const runDaemonStatusMock = vi.hoisted(() => vi.fn(async () => {}));

99

const statusJsonCommandMock = vi.hoisted(() => vi.fn(async () => {}));

10+

const tasksListJsonCommandMock = vi.hoisted(() => vi.fn(async () => {}));

11+

const tasksAuditJsonCommandMock = vi.hoisted(() => vi.fn(async () => {}));

1012

const channelsListCommandMock = vi.hoisted(() => vi.fn(async () => {}));

1113

const channelsStatusCommandMock = vi.hoisted(() => vi.fn(async () => {}));

1214

@@ -38,6 +40,15 @@ vi.mock("../../commands/status-json.js", () => ({

3840

statusJsonCommand: statusJsonCommandMock,

3941

}));

404243+

vi.mock("../../commands/tasks-json.js", () => ({

44+

tasksListJsonCommand: tasksListJsonCommandMock,

45+

tasksAuditJsonCommand: tasksAuditJsonCommandMock,

46+

}));

47+48+

vi.mock("../../commands/tasks.js", () => {

49+

throw new Error("routed task JSON commands must not import the full tasks command module");

50+

});

51+4152

vi.mock("../../commands/channels/list.js", () => ({

4253

channelsListCommand: channelsListCommandMock,

4354

}));

@@ -376,4 +387,117 @@ describe("program routes", () => {

376387

expect.any(Object),

377388

);

378389

});

390+391+

it("routes tasks list JSON through the lean task JSON command", async () => {

392+

const rootRoute = expectRoute(["tasks"]);

393+

expect(rootRoute?.loadPlugins).toBeUndefined();

394+

expect(rootRoute?.canRun?.(["node", "openclaw", "tasks"])).toBe(false);

395+

await expect(

396+

rootRoute?.run([

397+

"node",

398+

"openclaw",

399+

"tasks",

400+

"--json",

401+

"--runtime",

402+

"cli",

403+

"--status=running",

404+

]),

405+

).resolves.toBe(true);

406+

expect(tasksListJsonCommandMock).toHaveBeenCalledWith(

407+

{ json: true, runtime: "cli", status: "running" },

408+

expect.any(Object),

409+

);

410+411+

const listRoute = expectRoute(["tasks", "list"]);

412+

expect(listRoute?.loadPlugins).toBeUndefined();

413+

await expect(

414+

listRoute?.run(["node", "openclaw", "tasks", "list", "--json", "--runtime=cron"]),

415+

).resolves.toBe(true);

416+

expect(tasksListJsonCommandMock).toHaveBeenLastCalledWith(

417+

{ json: true, runtime: "cron", status: undefined },

418+

expect.any(Object),

419+

);

420+

});

421+422+

it("routes parent task filter values that command-path discovery sees as positionals", async () => {

423+

const separateValueArgv = [

424+

"node",

425+

"openclaw",

426+

"tasks",

427+

"--json",

428+

"--runtime",

429+

"cli",

430+

"--status",

431+

"running",

432+

];

433+

const separateValueRoute = findRoutedCommand(["tasks", "cli"], separateValueArgv);

434+

expect(separateValueRoute).not.toBeNull();

435+

await expect(separateValueRoute?.run(separateValueArgv)).resolves.toBe(true);

436+

expect(tasksListJsonCommandMock).toHaveBeenCalledWith(

437+

{ json: true, runtime: "cli", status: "running" },

438+

expect.any(Object),

439+

);

440+441+

const parentOptionBeforeSubcommandArgv = [

442+

"node",

443+

"openclaw",

444+

"tasks",

445+

"--runtime",

446+

"cli",

447+

"list",

448+

"--json",

449+

];

450+

const parentOptionBeforeSubcommandRoute = findRoutedCommand(

451+

["tasks", "cli"],

452+

parentOptionBeforeSubcommandArgv,

453+

);

454+

expect(parentOptionBeforeSubcommandRoute).not.toBeNull();

455+

await expect(

456+

parentOptionBeforeSubcommandRoute?.run(parentOptionBeforeSubcommandArgv),

457+

).resolves.toBe(true);

458+

expect(tasksListJsonCommandMock).toHaveBeenLastCalledWith(

459+

{ json: true, runtime: "cli", status: undefined },

460+

expect.any(Object),

461+

);

462+

});

463+464+

it("routes tasks audit JSON through the lean task JSON command", async () => {

465+

const route = expectRoute(["tasks", "audit"]);

466+

expect(route?.loadPlugins).toBeUndefined();

467+

expect(route?.canRun?.(["node", "openclaw", "tasks", "audit"])).toBe(false);

468+

await expect(

469+

route?.run([

470+

"node",

471+

"openclaw",

472+

"tasks",

473+

"audit",

474+

"--json",

475+

"--severity",

476+

"error",

477+

"--code=stale_running",

478+

"--limit",

479+

"5",

480+

]),

481+

).resolves.toBe(true);

482+

expect(tasksAuditJsonCommandMock).toHaveBeenCalledWith(

483+

{ json: true, severity: "error", code: "stale_running", limit: 5 },

484+

expect.any(Object),

485+

);

486+

});

487+488+

it("returns false for task JSON routes when option values are missing or unknown", async () => {

489+

await expectRunFalse(["tasks"], ["node", "openclaw", "tasks", "--json", "--runtime"]);

490+

await expectRunFalse(["tasks", "list"], ["node", "openclaw", "tasks", "list"]);

491+

await expectRunFalse(

492+

["tasks", "audit"],

493+

["node", "openclaw", "tasks", "audit", "--json", "--limit"],

494+

);

495+

await expectRunFalse(

496+

["tasks", "audit"],

497+

["node", "openclaw", "tasks", "audit", "--json", "--unknown"],

498+

);

499+

expect(

500+

findRoutedCommand(["tasks", "cli"], ["node", "openclaw", "tasks", "--runtime", "cli"]),

501+

).toBeNull();

502+

});

379503

});