fix(daemon): surface probe close reasons (#56282)

Merged via squash.

Prepared head SHA: c356980aa4
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
This commit is contained in:
Mariano
2026-03-28 10:04:56 +01:00
committed by GitHub
parent a68bef42eb
commit 0afd73c975
5 changed files with 80 additions and 4 deletions

View File

@@ -92,6 +92,26 @@ describe("probeGatewayStatus", () => {
});
});
it("prefers the close reason over a generic timeout when both are present", async () => {
callGatewayMock.mockReset();
probeGatewayMock.mockReset();
probeGatewayMock.mockResolvedValueOnce({
ok: false,
error: "timeout",
close: { code: 1008, reason: "pairing required" },
});
const result = await probeGatewayStatus({
url: "ws://127.0.0.1:19191",
timeoutMs: 5_000,
});
expect(result).toEqual({
ok: false,
error: "gateway closed (1008): pairing required",
});
});
it("surfaces status RPC errors when requireRpc is enabled", async () => {
callGatewayMock.mockReset();
probeGatewayMock.mockReset();