Skip to content

Commit 2c39cd0

Browse files
xingsy97obviyus
andauthored
fix(agents): rephrase session reset prompt to avoid Azure content filter (#43403)
* fix(agents): rephrase session reset prompt to avoid Azure content filter Azure OpenAI's content filter flags the phrase 'Execute your Session Startup sequence now' as potentially harmful, causing /new and /reset to return 400 for all Azure-hosted deployments. Replace 'Execute ... now' with 'Run your Session Startup sequence' in session-reset-prompt.ts and post-compaction-context.ts. The semantics are identical but the softer phrasing avoids the false-positive. Closes #42769 * ci: retrigger checks (windows shard timeout) * fix: add changelog for Azure startup prompt fix (#43403) (thanks @xingsy97) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
1 parent b28a225 commit 2c39cd0

File tree

8 files changed

+9
-8
lines changed

8 files changed

+9
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Docs: https://docs.openclaw.ai
1818
- Gateway/session reset: preserve `lastAccountId` and `lastThreadId` across gateway session resets so replies keep routing back to the same account and thread after `/reset`. (#44773) Thanks @Lanfei.
1919
- Agents/memory bootstrap: load only one root memory file, preferring `MEMORY.md` and using `memory.md` as a fallback, so case-insensitive Docker mounts no longer inject duplicate memory context. (#26054) Thanks @Lanfei.
2020
- Agents/OpenAI-compatible compat overrides: respect explicit user `models[].compat` opt-ins for non-native `openai-completions` endpoints so usage-in-streaming capability overrides no longer get forced off when the endpoint actually supports them. (#44432) Thanks @cheapestinference.
21+
- Agents/Azure OpenAI startup prompts: rephrase the built-in `/new`, `/reset`, and post-compaction startup instruction so Azure OpenAI deployments no longer hit HTTP 400 false positives from the content filter. (#43403) Thanks @xingsy97.
2122

2223
## 2026.3.12
2324

src/auto-reply/reply.triggers.trigger-handling.test-harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ export async function runGreetingPromptForBareNewOrReset(params: {
363363
expect(runEmbeddedPiAgentMock).toHaveBeenCalledOnce();
364364
const prompt = runEmbeddedPiAgentMock.mock.calls.at(-1)?.[0]?.prompt ?? "";
365365
expect(prompt).toContain("A new session was started via /new or /reset");
366-
expect(prompt).toContain("Execute your Session Startup sequence now");
366+
expect(prompt).toContain("Run your Session Startup sequence");
367367
}
368368

369369
export function installTriggerHandlingE2eTestHooks() {

src/auto-reply/reply/post-compaction-context.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ Read WORKFLOW.md on startup.
332332
fs.writeFileSync(path.join(tmpDir, "AGENTS.md"), content);
333333
const result = await readPostCompactionContext(tmpDir);
334334
expect(result).not.toBeNull();
335-
expect(result).toContain("Execute your Session Startup sequence now");
335+
expect(result).toContain("Run your Session Startup sequence");
336336
});
337337

338338
it("falls back to legacy sections when defaults are explicitly configured", async () => {
@@ -368,7 +368,7 @@ Read WORKFLOW.md on startup.
368368
expect(result).not.toBeNull();
369369
expect(result).toContain("Do startup things");
370370
expect(result).toContain("Be safe");
371-
expect(result).toContain("Execute your Session Startup sequence now");
371+
expect(result).toContain("Run your Session Startup sequence");
372372
});
373373

374374
it("custom section names are matched case-insensitively", async () => {

src/auto-reply/reply/post-compaction-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export async function readPostCompactionContext(
136136
// would be misleading for deployments that use different section names.
137137
const prose = isDefaultSections
138138
? "Session was just compacted. The conversation summary above is a hint, NOT a substitute for your startup sequence. " +
139-
"Execute your Session Startup sequence now — read the required files before responding to the user."
139+
"Run your Session Startup sequence — read the required files before responding to the user."
140140
: `Session was just compacted. The conversation summary above is a hint, NOT a substitute for your full startup sequence. ` +
141141
`Re-read the sections injected below (${displayNames.join(", ")}) and follow your configured startup procedure before responding to the user.`;
142142

src/auto-reply/reply/session-reset-prompt.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { buildBareSessionResetPrompt } from "./session-reset-prompt.js";
55
describe("buildBareSessionResetPrompt", () => {
66
it("includes the core session startup instruction", () => {
77
const prompt = buildBareSessionResetPrompt();
8-
expect(prompt).toContain("Execute your Session Startup sequence now");
8+
expect(prompt).toContain("Run your Session Startup sequence");
99
expect(prompt).toContain("read the required files before responding to the user");
1010
});
1111

src/auto-reply/reply/session-reset-prompt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { appendCronStyleCurrentTimeLine } from "../../agents/current-time.js";
22
import type { OpenClawConfig } from "../../config/config.js";
33

44
const BARE_SESSION_RESET_PROMPT_BASE =
5-
"A new session was started via /new or /reset. Execute your Session Startup sequence now - read the required files before responding to the user. Then greet the user in your configured persona, if one is provided. Be yourself - use your defined voice, mannerisms, and mood. Keep it to 1-3 sentences and ask what they want to do. If the runtime model differs from default_model in the system prompt, mention the default model. Do not mention internal steps, files, tools, or reasoning.";
5+
"A new session was started via /new or /reset. Run your Session Startup sequence - read the required files before responding to the user. Then greet the user in your configured persona, if one is provided. Be yourself - use your defined voice, mannerisms, and mood. Keep it to 1-3 sentences and ask what they want to do. If the runtime model differs from default_model in the system prompt, mention the default model. Do not mention internal steps, files, tools, or reasoning.";
66

77
/**
88
* Build the bare session reset prompt, appending the current date/time so agents

src/gateway/server-methods/agent.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ describe("gateway agent handler", () => {
582582
expect(mocks.performGatewaySessionReset).toHaveBeenCalledTimes(1);
583583
const call = readLastAgentCommandCall();
584584
// Message is now dynamically built with current date — check key substrings
585-
expect(call?.message).toContain("Execute your Session Startup sequence now");
585+
expect(call?.message).toContain("Run your Session Startup sequence");
586586
expect(call?.message).toContain("Current time:");
587587
expect(call?.message).not.toBe(BARE_SESSION_RESET_PROMPT);
588588
expect(call?.sessionId).toBe("reset-session-id");

src/gateway/server.agent.gateway-server-agent-b.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ describe("gateway server agent", () => {
287287
await vi.waitFor(() => expect(calls.length).toBeGreaterThan(callsBefore));
288288
const call = (calls.at(-1)?.[0] ?? {}) as Record<string, unknown>;
289289
expect(call.message).toBeTypeOf("string");
290-
expect(call.message).toContain("Execute your Session Startup sequence now");
290+
expect(call.message).toContain("Run your Session Startup sequence");
291291
expect(call.message).toContain("Current time:");
292292
expect(typeof call.sessionId).toBe("string");
293293
expect(call.sessionId).not.toBe("sess-main-before-reset");

0 commit comments

Comments
 (0)