fix(gateway): stop stale-socket restarts before first event (#38643)

* fix(gateway): guard stale-socket restarts by event liveness

* fix(gateway): centralize connect-time liveness tracking

* fix(web): apply connected status patch atomically

* fix(gateway): require active socket for stale checks

* fix(gateway): ignore inherited stale event timestamps
This commit is contained in:
Tak Hoffman
2026-03-07 00:58:08 -06:00
committed by GitHub
parent a5c07fa115
commit 8873e13f1e
11 changed files with 157 additions and 26 deletions

View File

@@ -5,6 +5,7 @@ import { DEFAULT_GROUP_HISTORY_LIMIT } from "../../auto-reply/reply/history.js";
import { formatCliCommand } from "../../cli/command-format.js";
import { waitForever } from "../../cli/wait.js";
import { loadConfig } from "../../config/config.js";
import { createConnectedChannelStatusPatch } from "../../gateway/channel-status-patches.js";
import { logVerbose } from "../../globals.js";
import { formatDurationPrecise } from "../../infra/format-time/format-duration.ts";
import { enqueueSystemEvent } from "../../infra/system-events.js";
@@ -210,9 +211,7 @@ export async function monitorWebChannel(
},
});
status.connected = true;
status.lastConnectedAt = Date.now();
status.lastEventAt = status.lastConnectedAt;
Object.assign(status, createConnectedChannelStatusPatch());
status.lastError = null;
emitStatus();