fix(cli): mark in-flight agent runs unsuccessful (#125757)

This commit is contained in:
Peter Steinberger
2026-08-18 03:39:40 -07:00
committed by GitHub
parent ee2027a927
commit 0a4e81e97d
2 changed files with 7 additions and 5 deletions
+6 -1
View File
@@ -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);
});
});
+1 -4
View File
@@ -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;
}