Skip to content

Commit 95cee64

Browse files
steipetePeter Steinbergervincentkoc
authored
fix(cli): keep empty agent replies silent
* fix(cli): keep empty agent replies silent * fix(commands): preserve empty gateway status summaries --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
1 parent c7bbb3f commit 95cee64

6 files changed

Lines changed: 65 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Docs: https://docs.openclaw.ai
2020
### Fixes
2121

2222
- Agents/sessions: keep delayed `sessions_send` A2A replies alive after soft wait-window timeouts, while preserving terminal run timeouts and avoiding stale target replies in requester sessions. Fixes #76443. Thanks @ryswork1993 and @vincentkoc.
23+
- CLI/sessions: keep intentional empty agent replies silent after tool-delivered channel output, instead of surfacing a misleading "No reply from agent." fallback. Thanks @vincentkoc.
2324
- Config/doctor: cap `.clobbered.*` forensic snapshots per config path and serialize snapshot writes so repeated `doctor --fix` recovery loops cannot flood the config directory. Fixes #76454; carries forward #65649. Thanks @JUSTICEESSIELP, @rsnow, and @vincentkoc.
2425
- Feishu: suppress duplicate text when replies send native voice media while preserving captions for ordinary audio files and falling back to text plus attachment links when voice uploads fail.
2526
- Feishu: keep packaged Feishu startup from bundling the Lark SDK's ESM `__dirname` path by loading the SDK as a plugin-local runtime dependency. Fixes #76291 and #76494. (#76392) Thanks @zqchris.

‎src/agents/command/delivery.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ export async function deliverAgentCommandResult(params: {
350350
}
351351

352352
if (!payloads || payloads.length === 0) {
353-
runtime.log("No reply from agent.");
354353
return { payloads: [], meta: resultMeta };
355354
}
356355

‎src/commands/agent-via-gateway.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,42 @@ describe("agentCliCommand", () => {
147147
});
148148
});
149149

150+
it("stays silent when the gateway returns an intentional empty reply", async () => {
151+
await withTempStore(async () => {
152+
callGateway.mockResolvedValue({
153+
runId: "idem-1",
154+
status: "ok",
155+
summary: "completed",
156+
result: {
157+
payloads: [],
158+
meta: { stub: true },
159+
},
160+
});
161+
162+
await agentCliCommand({ message: "hi", to: "+1555" }, runtime);
163+
164+
expect(runtime.log).not.toHaveBeenCalled();
165+
});
166+
});
167+
168+
it("logs non-ok gateway summaries when payloads are empty", async () => {
169+
await withTempStore(async () => {
170+
callGateway.mockResolvedValue({
171+
runId: "idem-1",
172+
status: "timeout",
173+
summary: "aborted",
174+
result: {
175+
payloads: [],
176+
meta: { aborted: true },
177+
},
178+
});
179+
180+
await agentCliCommand({ message: "hi", to: "+1555" }, runtime);
181+
182+
expect(runtime.log).toHaveBeenCalledWith("aborted");
183+
});
184+
});
185+
150186
it("passes model overrides through gateway requests", async () => {
151187
await withTempStore(async () => {
152188
mockGatewaySuccessReply();

‎src/commands/agent-via-gateway.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ async function agentViaGatewayCommand(opts: AgentCliOpts, runtime: RuntimeEnv) {
201201
const payloads = result?.payloads ?? [];
202202

203203
if (payloads.length === 0) {
204-
runtime.log(response?.summary ? response.summary : "No reply from agent.");
204+
if (response?.status !== "ok") {
205+
runtime.log(response?.summary ? response.summary : "No reply from agent.");
206+
}
205207
return response;
206208
}
207209

‎src/commands/agent.acp.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,16 @@ describe("agentCommand ACP runtime routing", () => {
378378
});
379379
});
380380

381+
it("keeps no-reply ACP turns silent", async () => {
382+
await withAcpSessionEnv(async () => {
383+
const { assistantEvents, logLines } = await runAcpTurnWithAssistantEvents(["NO_REPLY"]);
384+
385+
expect(assistantEvents.map((event) => event.text).filter(Boolean)).toEqual([]);
386+
expect(logLines.some((line) => line.includes("NO_REPLY"))).toBe(false);
387+
expect(logLines).toEqual([]);
388+
});
389+
});
390+
381391
it("fails closed for ACP-shaped session keys missing ACP metadata", async () => {
382392
await withTempHome(async (home) => {
383393
const storePath = path.join(home, "sessions.json");

‎src/commands/agent.delivery.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,21 @@ describe("deliverAgentCommandResult", () => {
200200
);
201201
});
202202

203+
it("stays silent for intentional empty payloads", async () => {
204+
const runtime = createRuntime();
205+
206+
await runDelivery({
207+
opts: {
208+
message: "hello",
209+
},
210+
runtime,
211+
payloads: [],
212+
});
213+
214+
expect(runtime.log).not.toHaveBeenCalled();
215+
expect(mocks.deliverOutboundPayloads).not.toHaveBeenCalled();
216+
});
217+
203218
it("uses runContext turn source over stale session last route", async () => {
204219
await runDelivery({
205220
opts: {

0 commit comments

Comments
 (0)