fix(gateway): avoid false stuck restarts with fresh events#41030
fix(gateway): avoid false stuck restarts with fresh events#41030Narcooo wants to merge 1 commit into
Conversation
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 Health monitor restart suppression for stuck busy channels via fresh inbound events (availability/DoS risk)
Description
Impact:
Vulnerable logic: if (runActivityAge < BUSY_ACTIVITY_STALE_THRESHOLD_MS) {
return { healthy: true, reason: "busy" };
}
if (hasFreshCurrentLifecycleEvent(snapshot, policy, lastStartAt)) {
return { healthy: true, reason: "healthy" };
}
return { healthy: false, reason: "stuck" };Note: RecommendationAvoid allowing fresh inbound events to override stuck-run recovery, or at minimum require additional signals. Options:
if (runActivityAge < BUSY_ACTIVITY_STALE_THRESHOLD_MS) {
return { healthy: true, reason: "busy" };
}
return { healthy: false, reason: "stuck" };
if (hasFreshCurrentLifecycleEvent(snapshot, policy, lastStartAt)) {
return { healthy: false, reason: "stuck" }; // or "stuck-with-events" handled separately
}
Also consider emitting metrics/logging when Analyzed PR: #41030 at commit Last updated on: 2026-03-09T13:40:19Z |
Greptile SummaryThis PR fixes a false-positive restart bug in the gateway channel health monitor. Connected busy channels were being restarted as "stuck" as soon as Changes:
Confidence Score: 5/5
Last reviewed commit: b55127e |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing this as duplicate or superseded after Codex automated review. PR #41030 is superseded by the merged and shipped transport-liveness fix in #69833/v2026.4.22. Current main solves the linked #39096 quiet-channel false-positive problem by separating app-level inbound events from provider-proven transport activity, while still treating stale busy run activity as a true stuck-run recovery signal. The PR's Best possible solution: Close PR #41030 as superseded by #69833/v2026.4.22. Keep the current transport-liveness plus run-heartbeat design; any future tuning of stale active-run restarts should be a new focused issue using a non-user-controlled progress signal or an explicit hard-timeout policy. What I checked:
So I’m closing this here and keeping the remaining discussion on the canonical linked item. Codex Review notes: model gpt-5.5, reasoning high; reviewed against 46b9044c3f9d; fix evidence: release v2026.4.22, commit 38c35c48cb12. |
Summary
lastEventAtvalues so clock skew cannot suppress real stuck recoveryFixes #39096
Root cause
The busy-channel branch returned
stuckas soon aslastRunActivityAtwent stale. That bypassed the existing event-liveness signal, so Discord channels that were still receiving fresh gateway events could be restarted anyway.What changed
Verification
/Users/majunxian/Desktop/PyProject/openclaw/node_modules/.bin/vitest run src/gateway/channel-health-policy.test.ts src/gateway/channel-health-monitor.test.ts/Users/majunxian/Desktop/PyProject/openclaw/node_modules/.bin/oxfmt --check src/gateway/channel-health-policy.ts src/gateway/channel-health-policy.test.ts src/gateway/channel-health-monitor.test.ts/Users/majunxian/Desktop/PyProject/openclaw/node_modules/.bin/oxlint src/gateway/channel-health-policy.ts src/gateway/channel-health-policy.test.ts src/gateway/channel-health-monitor.test.ts