← Back to PRs

#20025: Fix Matrix messages silently dropped due to zero startup grace

by Clawborn open 2026-02-18 12:06 View on GitHub →
channel: matrix size: XS trusted-contributor
Fixes #19843 `startupGraceMs` was hardcoded to 0, causing every incoming message to be dropped when the Matrix homeserver clock is even slightly behind the OpenClaw host. This is common in multi-machine setups (e.g. Pi running OpenClaw + separate Synapse server). Changes: - Bump grace period from 0 to 5 seconds to tolerate typical NTP skew - Add debug-level logging when events are filtered, so operators can diagnose message delivery issues without patching the source <!-- greptile_comment --> <h3>Greptile Summary</h3> Fixes silent message dropping in the Matrix extension caused by a hardcoded `startupGraceMs = 0`. When the Matrix homeserver clock is even slightly behind the OpenClaw host (common in multi-machine setups like Pi + separate Synapse), every incoming message was filtered out. The grace period is now 5 seconds, and debug-level logging is added to the two event-filtering branches for easier diagnosis. - `startupGraceMs` bumped from `0` to `5_000` in `extensions/matrix/src/matrix/monitor/index.ts` - Debug log statements added to both pre-startup and stale-event filters in `extensions/matrix/src/matrix/monitor/handler.ts` <h3>Confidence Score: 5/5</h3> - This PR is safe to merge — it's a minimal, targeted fix with no risk of regression. - The change is extremely small and well-scoped: a single constant change from 0 to 5000 and two debug log additions. The fix addresses a clear bug (zero grace period causing silent message drops). The 5-second grace period is a reasonable default for NTP skew. The debug logging is non-intrusive and aids future troubleshooting. No behavioral changes beyond the intended fix. - No files require special attention. <sub>Last reviewed commit: b4ada1c</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs