Skip to content

Commit b886594

Browse files
steipetePeter Steinberger
andauthored
fix(gateway): safely defer agent-approved Gateway restarts (#117530)
* fix(gateway): safely defer agent-approved Gateway restarts * fix(gateway): pin approved restarts to the local owner * test(gateway): keep approved restart lifecycle coverage focused * fix(gateway): clear Windows probe lint --------- Co-authored-by: Peter Steinberger <[email protected]>
1 parent a8623b0 commit b886594

10 files changed

Lines changed: 276 additions & 183 deletions

‎.github/workflows/windows-testbox-probe.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ jobs:
298298
if (-not [Environment]::UserInteractive) {
299299
throw "Native Scheduled Task proof requires an interactive Windows runner session."
300300
}
301+
exit 0
301302
302303
- name: Run native Scheduled Task lifecycle proof
303304
id: native_schtasks

‎src/agents/system-prompt.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,9 +853,11 @@ describe("buildAgentSystemPrompt", () => {
853853
});
854854

855855
expect(prompt).toContain(
856-
"Config, channels, plugins, new agents, model/provider, updates: ask `openclaw`.",
856+
"Gateway restart, config, channels, plugins, agents, models/providers, updates: ask `openclaw`.",
857+
);
858+
expect(prompt).toContain(
859+
"Never restart the Gateway through shell commands or write your own config.",
857860
);
858-
expect(prompt).toContain("Never write own config; OpenClaw is system expert.");
859861
expect(prompt).toContain("`visible:true` only web/app user or asked.");
860862
});
861863

@@ -866,6 +868,7 @@ describe("buildAgentSystemPrompt", () => {
866868
});
867869

868870
expect(prompt).not.toContain("ask `openclaw`");
871+
expect(prompt).not.toContain("Gateway restart, config");
869872
});
870873

871874
it("includes skills guidance when skills prompt is present", () => {

‎src/agents/system-prompt.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ export function buildAgentSystemPrompt(params: {
874874
conversations_list: "List exact external conversation addresses",
875875
conversations_send: "Send directly to an external conversation",
876876
conversations_turn: "Send and wait for one correlated external reply",
877-
openclaw: "System setup/config expert; writes need human approval",
877+
openclaw: "Gateway restart/system setup/config; changes need human approval",
878878
gateway: "Read gateway config/schema",
879879
agents_list: acpSpawnRuntimeEnabled
880880
? "List allowed OpenClaw subagent ids; not ACP ids"
@@ -1275,7 +1275,7 @@ export function buildAgentSystemPrompt(params: {
12751275
"Do not invent commands.",
12761276
...(hasOpenClaw
12771277
? [
1278-
"Config, channels, plugins, new agents, model/provider, updates: ask `openclaw`. Never write own config; OpenClaw is system expert.",
1278+
"Gateway restart, config, channels, plugins, agents, models/providers, updates: ask `openclaw`. Never restart the Gateway through shell commands or write your own config.",
12791279
]
12801280
: [
12811281
"Config read: `gateway` (`config.get|config.schema.lookup`). Write/restart unavailable; ask human.",

‎src/agents/tools/openclaw-delegate-tool.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ describe("openclaw delegation tool", () => {
3232
if (!tool) {
3333
throw new Error("expected OpenClaw delegation tool");
3434
}
35+
expect(tool.description).toContain("Gateway restart");
36+
expect(tool.description).toContain("human approval");
3537

3638
const result = await tool.execute("call-1", { message: "Add channel." });
3739

‎src/agents/tools/openclaw-delegate-tool.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function createOpenClawDelegateTool(options?: {
4848
name: "openclaw",
4949
label: "OpenClaw",
5050
description:
51-
"Ask system expert. Config, channels, plugins, agents, models/providers, updates. Writes need human approval.",
51+
"Ask system expert. Gateway restart, config, channels, plugins, agents, models/providers, updates. Changes need human approval.",
5252
parameters: OpenClawDelegateSchema,
5353
outputSchema: OpenClawDelegateOutputSchema,
5454
execute: async (_toolCallId, args) => {

0 commit comments

Comments
 (0)