fix(webchat): hide reset startup prompt from history

Closes #72369.

Remote validation (Blacksmith Testbox tbx_01kq7874j733m8pxesmgvfz1x1):
- pnpm test src/auto-reply/reply/get-reply-run.media-only.test.ts src/gateway/server-methods/server-methods.test.ts
- node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-ui.config.ts ui/src/ui/controllers/chat.test.ts
- pnpm check:changed

Co-authored-by: haishmg <4529977+haishmg@users.noreply.github.com>
This commit is contained in:
harish ganeshmurthy
2026-04-27 14:41:33 +04:00
committed by GitHub
parent ae86541364
commit fa0f7d1e73
3 changed files with 85 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Memory-core: re-resolve the active runtime config whenever `memory_search` or `memory_get` executes, so provider changes made by `config.patch` stop leaving stale embedding backends behind in existing tool instances. Fixes #61098. Thanks @BradGroux and @Linux2010.
- WebChat: keep bare `/new` and `/reset` startup instructions out of visible chat history while preserving `/reset <note>` as user-visible transcript text. Fixes #72369. Thanks @collynes and @haishmg.
- Channels/setup: treat bundled channel plugins as already bundled during `channels add` and onboarding, enabling them without writing redundant `plugins.load.paths` entries or path install records. Fixes #72740. Thanks @iCodePoet.
- WhatsApp: honor gateway `HTTPS_PROXY` / `HTTP_PROXY` env vars for QR-login WebSocket connections, while respecting `NO_PROXY`, so proxied networks no longer fall back to direct `mmg.whatsapp.net` connections that time out with 408. Fixes #72547; supersedes #72692. Thanks @mebusw and @SymbolStar.
- Bonjour: default mDNS advertisements to the system hostname when it is DNS-safe, avoiding `openclaw.local` probing conflicts and Gateway restart loops on hosts such as `Lobster` or `ubuntu`. Fixes #72355 and #72689; supersedes #72694. Thanks @mscheuerlein-bot, @gcusms, @moyuwuhen601, @pavan987, @zml-0912, @hhq365, and @SymbolStar.

View File

@@ -1017,6 +1017,85 @@ describe("runPreparedReply media-only handling", () => {
expect(call?.transcriptCommandBody).toBe("[OpenClaw heartbeat poll]");
expect(call?.followupRun.transcriptPrompt).toBe("[OpenClaw heartbeat poll]");
});
it("keeps bare reset startup instructions out of visible transcript prompt", async () => {
await runPreparedReply(
baseParams({
ctx: {
Body: "/new",
RawBody: "/new",
CommandBody: "/new",
Provider: "webchat",
Surface: "webchat",
ChatType: "direct",
},
sessionCtx: {
Body: "",
BodyStripped: "",
Provider: "webchat",
Surface: "webchat",
ChatType: "direct",
},
command: {
surface: "webchat",
channel: "webchat",
isAuthorizedSender: true,
abortKey: "session-key",
ownerList: [],
senderIsOwner: true,
rawBodyNormalized: "/new",
commandBodyNormalized: "/new",
} as never,
}),
);
const call = vi.mocked(runReplyAgent).mock.calls.at(-1)?.[0];
expect(call?.commandBody).toContain("A new session was started via /new or /reset.");
expect(call?.followupRun.prompt).toContain("A new session was started via /new or /reset.");
expect(call?.transcriptCommandBody).toBe("");
expect(call?.followupRun.transcriptPrompt).toBe("");
});
it("keeps reset user notes visible while hiding startup instructions", async () => {
await runPreparedReply(
baseParams({
ctx: {
Body: "/reset summarize my workspace",
RawBody: "/reset summarize my workspace",
CommandBody: "/reset summarize my workspace",
Provider: "webchat",
Surface: "webchat",
ChatType: "direct",
},
sessionCtx: {
Body: "",
BodyStripped: "",
Provider: "webchat",
Surface: "webchat",
ChatType: "direct",
},
command: {
surface: "webchat",
channel: "webchat",
isAuthorizedSender: true,
abortKey: "session-key",
ownerList: [],
senderIsOwner: true,
rawBodyNormalized: "/reset summarize my workspace",
commandBodyNormalized: "/reset summarize my workspace",
softResetTriggered: true,
softResetTail: "summarize my workspace",
} as never,
}),
);
const call = vi.mocked(runReplyAgent).mock.calls.at(-1)?.[0];
expect(call?.commandBody).toContain("A new session was started via /new or /reset.");
expect(call?.commandBody).toContain("summarize my workspace");
expect(call?.transcriptCommandBody).toBe("summarize my workspace");
expect(call?.followupRun.transcriptPrompt).toBe("summarize my workspace");
});
it("uses inbound origin channel for run messageProvider", async () => {
await runPreparedReply(
baseParams({

View File

@@ -501,9 +501,11 @@ export async function runPreparedReply(
: [inboundUserContext, "[User sent media without caption]"].filter(Boolean).join("\n\n");
const transcriptBodyBase = isHeartbeat
? HEARTBEAT_TRANSCRIPT_PROMPT
: hasUserBody
? baseBodyFinal
: "[User sent media without caption]";
: isBareSessionReset
? softResetTail
: hasUserBody
? baseBodyFinal
: "[User sent media without caption]";
let prefixedBodyBase = await applySessionHints({
baseBody: effectiveBaseBody,
abortedLastRun,