mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-11 17:21:13 +00:00
fix(auto-reply): remove direct working status updates
This commit is contained in:
@@ -894,96 +894,6 @@ describe("dispatchReplyFromConfig", () => {
|
||||
expect(dispatcher.sendFinalReply).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("emits concise tool-start progress updates for direct sessions", async () => {
|
||||
setNoAbort();
|
||||
const cfg = emptyConfig;
|
||||
const dispatcher = createDispatcher();
|
||||
const ctx = buildTestCtx({
|
||||
Provider: "telegram",
|
||||
ChatType: "direct",
|
||||
});
|
||||
|
||||
const replyResolver = async (
|
||||
_ctx: MsgContext,
|
||||
opts?: GetReplyOptions,
|
||||
_cfg?: OpenClawConfig,
|
||||
) => {
|
||||
await opts?.onToolStart?.({ name: "read", phase: "start" });
|
||||
await opts?.onToolStart?.({ name: "read", phase: "update" });
|
||||
await opts?.onToolStart?.({ name: "grep", phase: "start" });
|
||||
await opts?.onToolStart?.({ name: "exec", phase: "start" });
|
||||
return { text: "done" } satisfies ReplyPayload;
|
||||
};
|
||||
|
||||
await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver });
|
||||
|
||||
expect(dispatcher.sendToolResult).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
expect.objectContaining({ text: "Working: read" }),
|
||||
);
|
||||
expect(dispatcher.sendToolResult).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
expect.objectContaining({ text: "Working: grep" }),
|
||||
);
|
||||
expect(dispatcher.sendToolResult).toHaveBeenCalledTimes(2);
|
||||
expect(dispatcher.sendFinalReply).toHaveBeenCalledWith({ text: "done" });
|
||||
});
|
||||
|
||||
it("prefers item-start progress updates for direct sessions", async () => {
|
||||
setNoAbort();
|
||||
const cfg = emptyConfig;
|
||||
const dispatcher = createDispatcher();
|
||||
const ctx = buildTestCtx({
|
||||
Provider: "telegram",
|
||||
ChatType: "direct",
|
||||
});
|
||||
|
||||
const replyResolver = async (
|
||||
_ctx: MsgContext,
|
||||
opts?: GetReplyOptions,
|
||||
_cfg?: OpenClawConfig,
|
||||
) => {
|
||||
await opts?.onItemEvent?.({
|
||||
itemId: "tool:read-1",
|
||||
kind: "tool",
|
||||
title: "read config",
|
||||
name: "read",
|
||||
phase: "start",
|
||||
status: "running",
|
||||
});
|
||||
await opts?.onItemEvent?.({
|
||||
itemId: "tool:read-1",
|
||||
kind: "tool",
|
||||
title: "read config",
|
||||
name: "read",
|
||||
phase: "end",
|
||||
status: "completed",
|
||||
});
|
||||
await opts?.onItemEvent?.({
|
||||
itemId: "tool:grep-1",
|
||||
kind: "tool",
|
||||
title: "grep",
|
||||
name: "grep",
|
||||
phase: "start",
|
||||
status: "running",
|
||||
});
|
||||
return { text: "done" } satisfies ReplyPayload;
|
||||
};
|
||||
|
||||
await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver });
|
||||
|
||||
expect(dispatcher.sendToolResult).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
expect.objectContaining({ text: "Working: read" }),
|
||||
);
|
||||
expect(dispatcher.sendToolResult).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
expect.objectContaining({ text: "Working: grep" }),
|
||||
);
|
||||
expect(dispatcher.sendToolResult).toHaveBeenCalledTimes(2);
|
||||
expect(dispatcher.sendFinalReply).toHaveBeenCalledWith({ text: "done" });
|
||||
});
|
||||
|
||||
it("renders plain-text plan updates and concise approval progress for direct sessions", async () => {
|
||||
setNoAbort();
|
||||
const cfg = emptyConfig;
|
||||
@@ -1058,7 +968,6 @@ describe("dispatchReplyFromConfig", () => {
|
||||
expect(dispatcher.sendToolResult).toHaveBeenCalledTimes(1);
|
||||
expect(dispatcher.sendFinalReply).toHaveBeenCalledWith({ text: "done" });
|
||||
});
|
||||
|
||||
it("delivers deterministic exec approval tool payloads for native commands", async () => {
|
||||
setNoAbort();
|
||||
const cfg = emptyConfig;
|
||||
|
||||
@@ -779,26 +779,6 @@ export async function dispatchReplyFromConfig(params: {
|
||||
};
|
||||
return run();
|
||||
},
|
||||
onToolStart: ({ name, phase }) => {
|
||||
if (phase !== "start") {
|
||||
return;
|
||||
}
|
||||
if (typeof name !== "string") {
|
||||
return;
|
||||
}
|
||||
return maybeSendWorkingStatus(name);
|
||||
},
|
||||
onItemEvent: ({ phase, name, title, kind }) => {
|
||||
if (phase !== "start") {
|
||||
return;
|
||||
}
|
||||
if (kind === "tool" && typeof name === "string" && name.trim()) {
|
||||
return maybeSendWorkingStatus(name);
|
||||
}
|
||||
if (typeof title === "string") {
|
||||
return maybeSendWorkingStatus(title);
|
||||
}
|
||||
},
|
||||
onPlanUpdate: ({ phase, explanation, steps }) => {
|
||||
if (phase !== "update") {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user