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

推荐订阅源

P
Proofpoint News Feed
D
DataBreaches.Net
雷峰网
雷峰网
WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Engineering at Meta
Engineering at Meta
月光博客
月光博客
V
Visual Studio Blog
美团技术团队
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
博客园 - 【当耐特】
V
V2EX
Microsoft Azure Blog
Microsoft Azure 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(e2e): preserve null rpc results · openclaw/openclaw@7...
vincentkoc · 2026-06-02 · via Recent Commits to openclaw:main

File tree

    • lib/bundled-plugin-install-uninstall

Original file line numberDiff line numberDiff line change

@@ -404,11 +404,27 @@ function findBalancedJsonObjectEnd(text, startIndex) {

404404

return -1;

405405

}

406406
407-

function unwrapRpcPayload(raw) {

407+

function hasOwnPayloadField(raw, field) {

408+

return (

409+

((typeof raw === "object" && raw !== null) || typeof raw === "function") &&

410+

Object.hasOwn(raw, field)

411+

);

412+

}

413+
414+

export function unwrapRpcPayload(raw) {

408415

if (raw?.ok === false) {

409416

throw new Error(`gateway RPC failed: ${JSON.stringify(raw.error ?? raw)}`);

410417

}

411-

return raw?.result ?? raw?.payload ?? raw?.data ?? raw;

418+

if (hasOwnPayloadField(raw, "result")) {

419+

return raw.result;

420+

}

421+

if (hasOwnPayloadField(raw, "payload")) {

422+

return raw.payload;

423+

}

424+

if (hasOwnPayloadField(raw, "data")) {

425+

return raw.data;

426+

}

427+

return raw;

412428

}

413429
414430

async function rpcCall(method, params, options) {

Original file line numberDiff line numberDiff line change

@@ -830,11 +830,27 @@ function parseJsonOutput(stdout) {

830830

}

831831

}

832832
833-

function unwrapRpcPayload(raw) {

833+

function hasOwnPayloadField(raw, field) {

834+

return (

835+

((typeof raw === "object" && raw !== null) || typeof raw === "function") &&

836+

Object.hasOwn(raw, field)

837+

);

838+

}

839+
840+

export function unwrapRpcPayload(raw) {

834841

if (raw?.ok === false) {

835842

throw new Error(`gateway RPC failed: ${JSON.stringify(raw.error ?? raw)}`);

836843

}

837-

return raw?.result ?? raw?.payload ?? raw?.data ?? raw;

844+

if (hasOwnPayloadField(raw, "result")) {

845+

return raw.result;

846+

}

847+

if (hasOwnPayloadField(raw, "payload")) {

848+

return raw.payload;

849+

}

850+

if (hasOwnPayloadField(raw, "data")) {

851+

return raw.data;

852+

}

853+

return raw;

838854

}

839855
840856

async function smokePlugin(pluginId, pluginDir, requiresConfig, pluginIndex, pluginRoot) {

Original file line numberDiff line numberDiff line change

@@ -220,6 +220,14 @@ describe("bundled plugin install/uninstall probe", () => {

220220

expect(second).toEqual({ text: "fghij", truncatedChars: 5 });

221221

});

222222
223+

it("preserves explicit nullish runtime RPC result fields", async () => {

224+

const runtimeSmoke = await import(pathToFileURL(runtimeSmokePath).href);

225+
226+

expect(runtimeSmoke.unwrapRpcPayload({ jsonrpc: "2.0", result: null })).toBeNull();

227+

expect(runtimeSmoke.unwrapRpcPayload({ jsonrpc: "2.0", result: undefined })).toBeUndefined();

228+

expect(runtimeSmoke.unwrapRpcPayload({ payload: null, data: { stale: true } })).toBeNull();

229+

});

230+
223231

it("caps noisy runtime gateway logs", async () => {

224232

const runtimeSmoke = await importRuntimeSmokeWithEnv({

225233

OPENCLAW_BUNDLED_PLUGIN_RUNTIME_GATEWAY_LOG_BYTES: "64",

Original file line numberDiff line numberDiff line change

@@ -32,6 +32,7 @@ import {

3232

stopGateway,

3333

summarizeProcessSamples,

3434

tailFile,

35+

unwrapRpcPayload,

3536

usesBuiltOpenClawEntry,

3637

waitForGatewayReady,

3738

} from "../../scripts/e2e/kitchen-sink-rpc-walk.mjs";

@@ -447,6 +448,19 @@ describe("kitchen-sink RPC caller loading", () => {

447448

});

448449

});

449450
451+

describe("kitchen-sink RPC payload unwrapping", () => {

452+

it("preserves explicit nullish JSON-RPC result fields", () => {

453+

expect(unwrapRpcPayload({ jsonrpc: "2.0", result: null })).toBeNull();

454+

expect(unwrapRpcPayload({ jsonrpc: "2.0", result: undefined })).toBeUndefined();

455+

});

456+
457+

it("prefers result before legacy payload and data envelopes", () => {

458+

expect(unwrapRpcPayload({ result: false, payload: { stale: true } })).toBe(false);

459+

expect(unwrapRpcPayload({ payload: null, data: { stale: true } })).toBeNull();

460+

expect(unwrapRpcPayload({ data: 0 })).toBe(0);

461+

});

462+

});

463+
450464

describe("kitchen-sink RPC command catalog assertions", () => {

451465

it("keeps plugin commands and deduplicates aliases", () => {

452466

expect(