mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 12:26:38 -06:00
fix(cli): mark in-flight agent runs unsuccessful (#125757)
This commit is contained in:
committed by
GitHub
parent
ee2027a927
commit
0a4e81e97d
@@ -2136,18 +2136,23 @@ describe("agentCliCommand", () => {
|
||||
|
||||
it("surfaces duplicate in-flight gateway runs without pretending a reply arrived", async () => {
|
||||
await withTempStore(async () => {
|
||||
const signals = createSignalProcess();
|
||||
callGateway.mockResolvedValue({
|
||||
runId: "idem-1",
|
||||
status: "in_flight",
|
||||
sessionKey: "agent:main:main",
|
||||
});
|
||||
|
||||
await agentCliCommand({ message: "hi", to: "+1555", runId: "idem-1" }, runtime);
|
||||
await agentCliCommand({ message: "hi", to: "+1555", runId: "idem-1" }, runtime, {
|
||||
process: signals.processLike,
|
||||
});
|
||||
|
||||
expect(runtime.error).toHaveBeenCalledWith(
|
||||
"Agent run idem-1 is already in flight; not starting a duplicate run.",
|
||||
);
|
||||
expect(runtime.log).not.toHaveBeenCalledWith("No reply from agent.");
|
||||
expect(runtime.exit).not.toHaveBeenCalled();
|
||||
expect(signals.processLike.exitCode).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1170,10 +1170,10 @@ async function agentViaGatewayCommand(
|
||||
if (!response) {
|
||||
throw new Error("gateway agent call did not return a response");
|
||||
}
|
||||
markAgentRunExitCode(response.status, signalBridge);
|
||||
|
||||
if (opts.json) {
|
||||
writeRuntimeJson(runtime, buildGatewayJsonResponse(response));
|
||||
markAgentRunExitCode(response.status, signalBridge);
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -1189,7 +1189,6 @@ async function agentViaGatewayCommand(
|
||||
if (response?.status !== "ok") {
|
||||
runtime.log(response?.summary ? response.summary : "No reply from agent.");
|
||||
}
|
||||
markAgentRunExitCode(response.status, signalBridge);
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -1200,8 +1199,6 @@ async function agentViaGatewayCommand(
|
||||
}
|
||||
}
|
||||
|
||||
markAgentRunExitCode(response.status, signalBridge);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user