From b1cce47bb5dfc0740c89330eae1c5586d52bd8b8 Mon Sep 17 00:00:00 2001 From: sidreyas Date: Sat, 7 Nov 2026 03:52:09 +0530 Subject: [PATCH] fix(server): log canceled relay requests at debug level --- .../src/cloud/ManagedEndpointRuntime.test.ts | 15 +++++++++++++++ apps/server/src/cloud/ManagedEndpointRuntime.ts | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/apps/server/src/cloud/ManagedEndpointRuntime.test.ts b/apps/server/src/cloud/ManagedEndpointRuntime.test.ts index d1f95140fa0a6..9dd7ac7087958 100644 --- a/apps/server/src/cloud/ManagedEndpointRuntime.test.ts +++ b/apps/server/src/cloud/ManagedEndpointRuntime.test.ts @@ -178,6 +178,21 @@ describe("CloudManagedEndpointRuntime", () => { expect( ManagedEndpointRuntime.classifyRelayClientOutput("2026-06-17T02:00:00Z PNC runtime panic"), ).toBe("warning"); + for (const prefix of ["", "Request failed "]) { + expect( + ManagedEndpointRuntime.classifyRelayClientOutput( + `2026-06-17T02:00:00Z ERR ${prefix}error="Incoming request ended abruptly: context canceled" connIndex=0`, + ), + ).toBe("debug"); + } + for (const line of [ + '2026-06-17T02:00:00Z ERR error="Incoming request ended abruptly: context deadline exceeded" connIndex=0', + '2026-06-17T02:00:00Z ERR Failed to serve tunnel connection error="context canceled"', + '2026-06-17T02:00:00Z FTL error="Incoming request ended abruptly: context canceled"', + '2026-06-17T02:00:00Z PNC error="Incoming request ended abruptly: context canceled"', + ]) { + expect(ManagedEndpointRuntime.classifyRelayClientOutput(line)).toBe("warning"); + } }); it("classifies connection unregistration apart from registration and routine output", () => { diff --git a/apps/server/src/cloud/ManagedEndpointRuntime.ts b/apps/server/src/cloud/ManagedEndpointRuntime.ts index 66ef48f547730..34c5bb2f678fc 100644 --- a/apps/server/src/cloud/ManagedEndpointRuntime.ts +++ b/apps/server/src/cloud/ManagedEndpointRuntime.ts @@ -158,6 +158,13 @@ export function classifyRelayClientOutput( if (/\bRegistered tunnel connection\b/iu.test(line)) { return "connected"; } + if ( + /\bERR\s+(?:Request failed\s+)?error="Incoming request ended abruptly: context canceled"(?:\s|$)/u.test( + line, + ) + ) { + return "debug"; + } // cloudflared uses zerolog FTL/PNC for fatal/panic; classify them above debug too. if (/\b(?:ERR|WRN|FTL|PNC)\b/u.test(line)) { return "warning";