mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 11:20:43 +00:00
fix(exec): skip node approval prepare in yolo mode
This commit is contained in:
@@ -238,6 +238,13 @@ describe("executeNodeHostCommand", () => {
|
||||
});
|
||||
|
||||
it("forwards prepared systemRunPlan on async node invoke after approval", async () => {
|
||||
resolveExecHostApprovalContextMock.mockReturnValue({
|
||||
approvals: { allowlist: [], file: { version: 1, agents: {} } },
|
||||
hostSecurity: "full",
|
||||
hostAsk: "always",
|
||||
askFallback: "deny",
|
||||
});
|
||||
|
||||
const result = await executeNodeHostCommand({
|
||||
command: "bun ./script.ts",
|
||||
workdir: "/tmp/work",
|
||||
@@ -259,11 +266,11 @@ describe("executeNodeHostCommand", () => {
|
||||
);
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(callGatewayToolMock).toHaveBeenCalledTimes(2);
|
||||
expect(callGatewayToolMock).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
|
||||
expect(callGatewayToolMock).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
3,
|
||||
"node.invoke",
|
||||
expect.anything(),
|
||||
expect.objectContaining({
|
||||
@@ -277,9 +284,7 @@ describe("executeNodeHostCommand", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("suppresses node completion events when notifyOnExit is disabled", async () => {
|
||||
requiresExecApprovalMock.mockReturnValue(false);
|
||||
|
||||
it("skips approval prepare in full/off mode", async () => {
|
||||
await executeNodeHostCommand({
|
||||
command: "bun ./script.ts",
|
||||
workdir: "/tmp/work",
|
||||
@@ -294,17 +299,28 @@ describe("executeNodeHostCommand", () => {
|
||||
notifyOnExit: false,
|
||||
});
|
||||
|
||||
expect(callGatewayToolMock).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
expect(callGatewayToolMock).toHaveBeenCalledTimes(1);
|
||||
expect(callGatewayToolMock).toHaveBeenCalledWith(
|
||||
"node.invoke",
|
||||
expect.anything(),
|
||||
expect.objectContaining({
|
||||
command: "system.run",
|
||||
params: expect.objectContaining({
|
||||
command: ["bash", "-lc", "bun ./script.ts"],
|
||||
rawCommand: "bun ./script.ts",
|
||||
suppressNotifyOnExit: true,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
expect(callGatewayToolMock).toHaveBeenCalledWith(
|
||||
"node.invoke",
|
||||
expect.anything(),
|
||||
expect.objectContaining({
|
||||
params: expect.not.objectContaining({
|
||||
systemRunPlan: expect.anything(),
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("denies timed-out inline-eval requests instead of invoking the node", async () => {
|
||||
|
||||
Reference in New Issue
Block a user