mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 04:47:03 -06:00
fix(agents): preserve null node payloads
This commit is contained in:
@@ -179,5 +179,7 @@ async function invokeNodeCommandPayload(params: {
|
||||
params: params.commandParams ?? {},
|
||||
idempotencyKey: crypto.randomUUID(),
|
||||
});
|
||||
return raw?.payload ?? {};
|
||||
return raw && typeof raw === "object" && Object.hasOwn(raw, "payload")
|
||||
? raw.payload
|
||||
: {};
|
||||
}
|
||||
|
||||
@@ -462,6 +462,19 @@ describe("createNodesTool screen_record duration guardrails", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves explicit null location_get payloads from node.invoke", async () => {
|
||||
gatewayMocks.callGatewayTool.mockResolvedValue({ payload: null });
|
||||
const tool = createNodesTool();
|
||||
|
||||
const result = await tool.execute("call-location-null", {
|
||||
action: "location_get",
|
||||
node: "macbook",
|
||||
});
|
||||
|
||||
expect(result.details).toBeNull();
|
||||
expect(result.content).toEqual([{ type: "text", text: "null" }]);
|
||||
});
|
||||
|
||||
it("uses operator.pairing plus operator.admin to approve exec-capable node pair requests", async () => {
|
||||
mockNodePairApproveFlow({
|
||||
requiredApproveScopes: ["operator.pairing", "operator.admin"],
|
||||
|
||||
Reference in New Issue
Block a user