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

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
博客园 - 【当耐特】
量子位
有赞技术团队
有赞技术团队
Jina AI
Jina AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
C
Check Point Blog
B
Blog RSS Feed
M
MIT News - Artificial intelligence
H
Help Net Security
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
腾讯CDC

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 node approval scope requests (#84392) · openclaw/open...
joshavant · 2026-05-20 · via Recent Commits to openclaw:main

@@ -8,8 +8,11 @@ installBaseProgramMocks();

88

let registerNodesCli: typeof import("./nodes-cli.js").registerNodesCli;

991010

type GatewayCallRequest = {

11+

clientName?: string;

1112

method?: string;

13+

mode?: string;

1214

params?: unknown;

15+

scopes?: unknown;

1316

};

14171518

function formatRuntimeLogCallArg(value: unknown): string {

@@ -434,19 +437,103 @@ describe("cli program (nodes basics)", () => {

434437435438

expectGatewayRequest("node.list", {});

436439

expectGatewayRequest("node.describe", { nodeId: "ios-node" });

440+

const describeRequest = gatewayRequests().find(

441+

(candidate) => candidate.method === "node.describe",

442+

);

443+

expect(describeRequest?.clientName).toBe("cli");

444+

expect(describeRequest?.mode).toBe("cli");

437445438446

const out = getRuntimeOutput();

439447

expect(out).toContain("Commands");

440448

expect(out).toContain("canvas.eval");

441449

});

442450443-

it("runs nodes approve and calls node.pair.approve", async () => {

444-

callGateway.mockResolvedValue({

445-

requestId: "r1",

446-

node: { nodeId: "n1", token: "t1" },

451+

it("runs nodes approve with the pending request approval scopes", async () => {

452+

callGateway.mockImplementation(async (...args: unknown[]) => {

453+

const opts = (args[0] ?? {}) as { method?: string };

454+

if (opts.method === "node.pair.list") {

455+

return {

456+

pending: [

457+

{

458+

requestId: "r1",

459+

nodeId: "n1",

460+

ts: Date.now(),

461+

requiredApproveScopes: ["operator.pairing", "operator.admin"],

462+

},

463+

],

464+

paired: [],

465+

};

466+

}

467+

if (opts.method === "node.pair.approve") {

468+

return {

469+

requestId: "r1",

470+

node: { nodeId: "n1", token: "t1" },

471+

};

472+

}

473+

return { ok: true };

447474

});

475+448476

await runProgram(["nodes", "approve", "r1"]);

477+

expectGatewayRequest("node.pair.list", {});

449478

expectGatewayRequest("node.pair.approve", { requestId: "r1" });

479+

const listRequest = gatewayRequests().find(

480+

(candidate) => candidate.method === "node.pair.list",

481+

);

482+

const approveRequest = gatewayRequests().find(

483+

(candidate) => candidate.method === "node.pair.approve",

484+

);

485+

expect(listRequest?.clientName).toBe("gateway-client");

486+

expect(listRequest?.mode).toBe("backend");

487+

expect(approveRequest?.scopes).toEqual(["operator.pairing", "operator.admin"]);

488+

expect(approveRequest?.clientName).toBe("gateway-client");

489+

expect(approveRequest?.mode).toBe("backend");

490+

});

491+492+

it("falls back to command-derived nodes approve scopes", async () => {

493+

callGateway.mockImplementation(async (...args: unknown[]) => {

494+

const opts = (args[0] ?? {}) as { method?: string };

495+

if (opts.method === "node.pair.list") {

496+

return {

497+

pending: [

498+

{

499+

requestId: "r1",

500+

nodeId: "n1",

501+

ts: Date.now(),

502+

commands: ["system.run"],

503+

},

504+

],

505+

paired: [],

506+

};

507+

}

508+

if (opts.method === "node.pair.approve") {

509+

return {

510+

requestId: "r1",

511+

node: { nodeId: "n1", token: "t1" },

512+

};

513+

}

514+

return { ok: true };

515+

});

516+517+

await runProgram(["nodes", "approve", "r1"]);

518+519+

const approveRequest = gatewayRequests().find(

520+

(candidate) => candidate.method === "node.pair.approve",

521+

);

522+

expect(approveRequest?.scopes).toEqual(["operator.pairing", "operator.admin"]);

523+

});

524+525+

it("rejects unsupported node approval backend methods at runtime", async () => {

526+

const { callNodePairApprovalGatewayCliRuntime } = await import("./nodes-cli/rpc.runtime.js");

527+528+

await expect(

529+

callNodePairApprovalGatewayCliRuntime(

530+

"node.invoke" as never,

531+

{ json: true },

532+

{},

533+

{ scopes: ["operator.admin"] },

534+

),

535+

).rejects.toThrow("unsupported node pair approval gateway method: node.invoke");

536+

expect(callGateway).not.toHaveBeenCalled();

450537

});

451538452539

it("runs nodes remove and calls node.pair.remove", async () => {

@@ -500,5 +587,8 @@ describe("cli program (nodes basics)", () => {

500587

timeoutMs: 15000,

501588

idempotencyKey: "idem-test",

502589

});

590+

const invokeRequest = gatewayRequests().find((candidate) => candidate.method === "node.invoke");

591+

expect(invokeRequest?.clientName).toBe("cli");

592+

expect(invokeRequest?.mode).toBe("cli");

503593

});

504594

});