The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(shared): grant the late-tick probe only for a one-off stall
Teknium1abb78e871ea
diff --git a/apps/shared/src/json-rpc-channel.ts b/apps/shared/src/json-rpc-channel.tsindex 3e045f0b1e1..4fc0a78094b 100644--- a/apps/shared/src/json-rpc-channel.ts+++ b/apps/shared/src/json-rpc-channel.ts@@ -567,9 +567,12 @@ export class JsonRpcRequestChannel {// a deadline on its age alone dropped every idle hidden socket.let lastPingAt = 0let lastTickAt = Date.now()- // One probe per silence episode: a tick that ran late cannot tell local- // suspension from a dead peer, so it re-probes once instead of dropping a- // socket whose pong is still queued behind the stall.+ let previousTickLate = false+ // One probe per silence episode: a one-off late tick (an on-time tick, then+ // a stall) cannot tell local suspension from a dead peer, so it re-probes+ // once instead of dropping a socket whose pong is still queued behind the+ // stall. Steady throttling makes every tick late; that is not a stall, and+ // its dead-socket detection stays two throttled ticks.let graceProbeSent = falsethis.heartbeatTimer = setInterval(() => {@@ -579,8 +582,10 @@ export class JsonRpcRequestChannel {const now = Date.now()const late = now - lastTickAt >= this.options.heartbeatIntervalMs * LATE_TICK_INTERVALS+ const stalled = late && !previousTickLatelastTickAt = now+ previousTickLate = lateconst unanswered = lastPingAt > this.lastLivenessAt@@ -589,7 +594,7 @@ export class JsonRpcRequestChannel {}if (unanswered && now - this.lastLivenessAt >= this.options.heartbeatDeadlineMs) {- if (!late || graceProbeSent) {+ if (!stalled || graceProbeSent) {this.failHeartbeat(new Error('WebSocket heartbeat acknowledgement timed out'))return