Skip to content

Commit ea2a701

Browse files
author
Baudbot
committed
fix: report unhealthy when session alias symlink is unreadable
The catch block in checkSessions silently reported ok:true when readlinkSync threw (EINVAL, EACCES, etc.), masking broken sessions. Now reports ok:false with the error message so failures surface in the heartbeat alert.
1 parent 799b63d commit ea2a701

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

pi/extensions/heartbeat.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,15 @@ function checkSessions(): CheckResult[] {
103103
} else {
104104
results.push({ name: `session:${alias}`, ok: true });
105105
}
106-
} catch {
107-
// Can't read symlink — just check alias existence (already confirmed above)
108-
results.push({ name: `session:${alias}`, ok: true });
106+
} catch (err: unknown) {
107+
// readlinkSync failed — alias exists but isn't a valid symlink,
108+
// or we lack permissions. Report as unhealthy rather than masking.
109+
const msg = err instanceof Error ? err.message : String(err);
110+
results.push({
111+
name: `session:${alias}`,
112+
ok: false,
113+
detail: `Session "${alias}" alias exists but symlink unreadable: ${msg}`,
114+
});
109115
}
110116
}
111117

0 commit comments

Comments
 (0)