Skip to content

Commit f1add90

Browse files
arhxamclaude
andcommitted
fix(server): surface cloudflared FTL/PNC relay logs as warnings, not debug
`classifyRelayClientOutput` routes relay-connector (cloudflared) output to "connected" / "warning" / "debug" log severities, treating only `ERR` and `WRN` zerolog level tokens as warnings. cloudflared also emits `FTL` (fatal) and `PNC` (panic) — both strictly more severe than `ERR` — and those fell through to "debug", so a fatal connector failure (e.g. a bad origin certificate path or a runtime panic that takes T3 Connect down) was logged at the quietest level and effectively hidden while diagnosing an outage. Add `FTL` and `PNC` to the warning set so the most severe relay failures surface at least as loudly as ordinary errors. Extended the existing classifier test. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1 parent e259dd2 commit f1add90

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎apps/server/src/cloud/ManagedEndpointRuntime.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ describe("CloudManagedEndpointRuntime", () => {
9696
"2026-06-17T02:00:00Z INF Starting metrics server",
9797
),
9898
).toBe("debug");
99+
// FTL (fatal) and PNC (panic) are more severe than ERR and must surface.
100+
expect(
101+
ManagedEndpointRuntime.classifyRelayClientOutput(
102+
"2026-06-17T02:00:00Z FTL Cannot determine default origin certificate path",
103+
),
104+
).toBe("warning");
105+
expect(
106+
ManagedEndpointRuntime.classifyRelayClientOutput("2026-06-17T02:00:00Z PNC runtime panic"),
107+
).toBe("warning");
99108
});
100109

101110
it.effect("starts, deduplicates, rotates, and stops the Cloudflare connector", () =>

‎apps/server/src/cloud/ManagedEndpointRuntime.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ export function classifyRelayClientOutput(line: string): "connected" | "warning"
7272
if (/\bRegistered tunnel connection\b/iu.test(line)) {
7373
return "connected";
7474
}
75-
return /\b(?:ERR|WRN)\b/u.test(line) ? "warning" : "debug";
75+
// cloudflared uses zerolog level tokens. FTL (fatal) and PNC (panic) are more
76+
// severe than ERR, so they must surface at least as loudly — without them a
77+
// fatal connector failure would be logged at debug and hidden.
78+
return /\b(?:ERR|WRN|FTL|PNC)\b/u.test(line) ? "warning" : "debug";
7679
}
7780

7881
function runtimeConfigKey(config: RelayManagedEndpointRuntimeConfig): string {

0 commit comments

Comments
 (0)