Skip to content

Commit ffbd02f

Browse files
committed
fix(agents): preserve null node payloads
1 parent 75bc80b commit ffbd02f

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/agents/tools/nodes-tool-commands.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,5 +179,7 @@ async function invokeNodeCommandPayload(params: {
179179
params: params.commandParams ?? {},
180180
idempotencyKey: crypto.randomUUID(),
181181
});
182-
return raw?.payload ?? {};
182+
return raw && typeof raw === "object" && Object.hasOwn(raw, "payload")
183+
? raw.payload
184+
: {};
183185
}

src/agents/tools/nodes-tool.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,19 @@ describe("createNodesTool screen_record duration guardrails", () => {
462462
});
463463
});
464464

465+
it("preserves explicit null location_get payloads from node.invoke", async () => {
466+
gatewayMocks.callGatewayTool.mockResolvedValue({ payload: null });
467+
const tool = createNodesTool();
468+
469+
const result = await tool.execute("call-location-null", {
470+
action: "location_get",
471+
node: "macbook",
472+
});
473+
474+
expect(result.details).toBeNull();
475+
expect(result.content).toEqual([{ type: "text", text: "null" }]);
476+
});
477+
465478
it("uses operator.pairing plus operator.admin to approve exec-capable node pair requests", async () => {
466479
mockNodePairApproveFlow({
467480
requiredApproveScopes: ["operator.pairing", "operator.admin"],

0 commit comments

Comments
 (0)