Repository navigation
fix(channels): preserve IRC timing and Teams uploads across clock changes - #188293
Conversation
Co-Authored-By: Claude Code <[email protected]>
Co-Authored-By: Claude Code <[email protected]>
Co-Authored-By: Claude Code <[email protected]>
Co-Authored-By: Claude Code <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Built-Gateway before/after capture, Node 24.22.1, isolated Docker. Baseline Teams used real SDK JWT validation, sender authorization, consent parsing, memory lookup, URL hostname/public-DNS validation and Connector authority middleware. Synthetic identity/JWKS and loopback transport replaced only provider infrastructure. The attachment came from an inbound agent reply through the shipped messenger, not CLI |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR uses monotonic time for IRC reconnect stability, IRC probe latency, and same-process Teams pending-upload expiry. Example: A fresh Teams file-consent request is accepted after Date.now advances by 360,001 ms.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes three source-confirmed clock-change bugs still present on main, with relevant built-Gateway evidence and no actionable correctness findings; current-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe IRC plugin measures connection durations for status probes and reconnect scheduling; the Teams plugin holds reply attachments until an authenticated consent callback uploads or removes them. flowchart LR
A[Gateway channel operations] --> B[IRC probe and monitor]
B --> C[Monotonic duration measurements]
C --> D[Latency and reconnect scheduling]
A --> E[Teams attachment reply]
E --> F[Pending upload owner]
F --> G[Authenticated consent callback]
G --> H[Upload and file card update]
Technical reviewBest possible solution: Use the existing duration owners with monotonic readings while preserving reconnect policy, epoch timestamps, persisted-upload semantics, and cleanup. Do we have a high-confidence way to reproduce the issue? Current-main source directly establishes all three failures, and the supplied built-Gateway baseline/candidate capture demonstrates them with stepped Date.now readings; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is the smallest complete repair: change the duration clock inside existing owners and retain one private deadline where the public epoch timestamp must remain intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 176c9c7496fd. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +14, Tests 0. Total +14 across 7 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 30, 2026, 7:53 AM ET / 11:53 UTC. |
…ock changes (#188452) fix(irc,discord): measure remaining channel durations with a monotonic clock Follow-up to #188293. Three more in-process durations used wall-clock time, so a system clock jump changed their results: - IRC silence detection: a forward jump could drop a healthy connection, and a backward jump could hide real silence. - Discord slow-listener timing, in both the thread listener wrapper and the generic event queue: clock jumps could create false slow-listener warnings or hide a listener that was really slow. These durations now use `performance.now()`. Thresholds, APIs and persisted timestamps are unchanged. Evidence: built Gateway paths in secretless Docker on node:24.22.1, with `Date.now` stepped inside the process only, main twice and candidate twice. On main, IRC dropped healthy connections after forward steps and missed silence after backward steps; with this change it did neither. On main, the Discord thread listener and event queue warned about fast listeners and missed a real listener of about 31 seconds; with this change they did neither. Real silence and slow-listener controls were still detected. Details: #188452 (comment). Includes the fixes from #188411 and #188412, with their commits kept. Co-authored-by: chengzhichao-xydt <[email protected]> Co-authored-by: Claude Code <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…nges (openclaw#188293) fix(irc,msteams): measure in-process durations with a monotonic clock IRC and Microsoft Teams measured some in-process durations with wall-clock time, so a system clock jump changed them: - the IRC probe latency could be wrong; - IRC reconnect backoff reset too early or not at all; - a fresh Teams file-consent upload could expire too early. These durations now use `performance.now()`. Persisted dates and public `createdAt` timestamps are unchanged, and so are the budgets. Evidence: built Gateway, main twice and candidate twice, with `Date.now` stepped inside the process only. Main reproduced the wrong probe latency, the wrong reconnect resets and the early expiry of a fresh Teams upload; the candidate corrected all three. The Teams path ran authenticated consent invokes, exact-byte uploads and the original card update. Controls passed: normal timing and expiry, invalid JWT, conversation mismatch and decline. Details: openclaw#188293 (comment). Includes the fixes from openclaw#188237, openclaw#188238 and openclaw#188239, with their commits kept. Co-authored-by: chengzhichao-xydt <[email protected]> Co-authored-by: Claude Code <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…ock changes (openclaw#188452) fix(irc,discord): measure remaining channel durations with a monotonic clock Follow-up to openclaw#188293. Three more in-process durations used wall-clock time, so a system clock jump changed their results: - IRC silence detection: a forward jump could drop a healthy connection, and a backward jump could hide real silence. - Discord slow-listener timing, in both the thread listener wrapper and the generic event queue: clock jumps could create false slow-listener warnings or hide a listener that was really slow. These durations now use `performance.now()`. Thresholds, APIs and persisted timestamps are unchanged. Evidence: built Gateway paths in secretless Docker on node:24.22.1, with `Date.now` stepped inside the process only, main twice and candidate twice. On main, IRC dropped healthy connections after forward steps and missed silence after backward steps; with this change it did neither. On main, the Discord thread listener and event queue warned about fast listeners and missed a real listener of about 31 seconds; with this change they did neither. Real silence and slow-listener controls were still detected. Details: openclaw#188452 (comment). Includes the fixes from openclaw#188411 and openclaw#188412, with their commits kept. Co-authored-by: chengzhichao-xydt <[email protected]> Co-authored-by: Claude Code <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
IRC reconnect delays and probe latency, and fresh Teams file-consent uploads, become incorrect when the system clock changes.
Related: #188237, #188238, #188239. This combines chengzhichao-xydt's three fixes and retains their commits, including the updated IRC probe consumer fix.
User Impact
IRC reconnects retain their normal backoff and healthy-connection reset policy, probes report elapsed connection time, and Teams users can accept a fresh file upload despite a wall-clock correction. No configuration changes or migration are required.
Why This Change Was Made
Use
performance.now()directly for these process-local durations. Teams keeps its publiccreatedAtepoch unchanged and adds a private monotonic expiry deadline; filesystem-backed, cross-process upload expiry remains unchanged. No SDK API is added.Consolidated the regressions into the existing owner/consumer suites, removed the duplicate probe suite and test allocations, and made the IRC monitor's fake clock include performance. Against the merge base: production +14 lines, tests 0 net lines. The private Teams deadline is needed to preserve the public epoch field without measuring expiry against it.
Evidence
Built main
ac32225fbbbc799eaa43dd1666e81a25bdb54b9dand candidated3a4f387b5e0c1314ad270fd6773fd38045eaab6in secretless Docker on Node 24.22.1. Used the built Gateway, explicit isolated profiles and state/config/database paths. OnlyDate.now()was stepped inside the process; native timers,performance.now(), reconnect jitter and the real 60-second stable window were unchanged.Final head
e7fdbe41f93dbc53f5f1aa0028634e213d8c0439only repairs test cleanup typing and uses complete fake timers in two suites; all production files are identical to the built candidate above, so the runtime evidence is reused unchanged. The three adjusted suites were rerun: 45/45 tests passed. This fixes the initial head'scheck-test-typescleanup callback error andcheck-lintformatting failures rather than rerunning those jobs.Sanitized runtime capture and before/after results.
Two iterations on each revision:
channels.statusprobe, local TCP registration delayed ~300 ms, ±1-hour wall stepsControls passed on both revisions: unstepped IRC probes, increasing short-connection backoff, ordinary reset after 61 seconds; Teams ordinary accepted upload, conversation mismatch rejection followed by a valid accept, decline cleanup, and natural expiry after a real five-minute wait. Invalid-signature and wrong-audience Teams webhooks returned HTTP 401. Candidate recorded six exact-byte upload PUTs with
Content-Range: bytes 0-50/51and six corresponding original-card updates across the stepped accepts and ordinary controls.Teams proof used the normal App/Express authentication and sender/URL guards with synthetic RSA/JWKS identity infrastructure and a loopback Connector/upload transport. Production Connector authority interceptors and middleware remained installed. Temporary observation hooks in both builds recorded the actual messenger store and consent getter with the same Gateway PID; no direct helper invocation, auth bypass or CLI filesystem-backed send was used. A deterministic local Responses provider generated the attachment replies.
Focused checks: 41/41 tests passed across reconnect-backoff, send/probe and pending-upload suites; 19/19 passed across IRC monitor, Teams consent handler and pending-upload lifecycle consumers. The same current owner regressions against main produced 6 failures / 35 passes, covering all three clock defects. Changed-file formatting and lint passed.
Merge danger: two-way door; reverting restores the former duration calculations without changing persisted data or configuration. Blast radius is IRC reconnect/probe timing and same-process Teams pending uploads; filesystem-backed Teams uploads and other channels are untouched.