feat(FN-4295): complete Step 1 — update reports stale threshold multiplier

Fusion-Task-Id: FN-4295
Fusion-Task-Lineage: e2a47487-33f5-4077-8031-c7bb14882121
This commit is contained in:
Fusion
2026-05-13 08:40:59 -07:00
committed by gsxdsm
parent 4627dfc2fc
commit 2437aae418

View File

@@ -161,10 +161,12 @@ interface TrackedAgent {
}
/**
* Grace multiplier applied to each direct report's configured heartbeat
* interval before flagging it stale in reports-health summaries.
* A direct report is flagged stale only when its last heartbeat is older than
* 1.5 × its configured `heartbeatIntervalMs`. This matches the human CEO's
* manual rule (see FN-4295) and avoids false positives for long-cadence
* reports (e.g. 180-minute PM/CTO agents).
*/
const HEARTBEAT_GRACE_MULTIPLIER = 4;
const REPORTS_STALE_INTERVAL_MULTIPLIER = 1.5;
/**
* Minimum staleness threshold floor for very short heartbeat intervals.
@@ -2648,7 +2650,7 @@ export class HeartbeatMonitor {
const rows = reports.map((report) => {
const { pollIntervalMs, heartbeatTimeoutMs } = this.resolveAgentConfig(report.id);
const staleThresholdMs = Math.max(
pollIntervalMs * HEARTBEAT_GRACE_MULTIPLIER,
pollIntervalMs * REPORTS_STALE_INTERVAL_MULTIPLIER,
MIN_HEARTBEAT_STALENESS_MS,
);
const lastHeartbeatTs = report.lastHeartbeatAt ? Date.parse(report.lastHeartbeatAt) : NaN;