Repository navigation
fix(test): control heartbeat typing intervals during dispatch - #159980
Conversation
Virtualize only interval scheduling around the heartbeat operation so real storage and dispatch latency cannot trigger an unrelated keepalive in the exactly-once assertions. Keep setup, cleanup, Date and timeouts real, and retain separate cadence coverage. Twenty standalone runs, three original shards, siblings, selected checks and independent review passed.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 27, 2026, 10:57 PM ET / September 28, 2026, 02:57 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR prevents interval refreshes from firing during two heartbeat typing tests so their start and cleanup assertions do not depend on dispatch speed. Merge readiness⛔ Blocked before merge - 2 items remain Keep open for human review. Current main still has the timing-sensitive tests, and I found no introduced correctness defect. Exact-head CI passed, but the author's stop command paused automerge. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's heartbeat runner selects a chat delivery target and starts its typing indicator while an agent reply is dispatched. The shared typing controller refreshes that indicator on an interval and stops it during cleanup. flowchart LR
A[Heartbeat trigger] --> B[Delivery target]
B --> C[Heartbeat runner]
C --> D[Typing controller]
D --> E[Channel typing signal]
C --> F[Reply dispatch]
F --> G[Typing cleanup]
Decision needed
Why: The author explicitly stopped automerge, and the live human-review label leaves merge authorization to a person. Before merge
Agent review detailsSecurityNone. PR surfaceTests +10. Total +10 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep runner start and cleanup coverage separate from the six-second cadence test, then land the scoped fix through the requested human-review lane. Do we have a high-confidence way to reproduce the issue? Yes, at the source level: a dispatch lasting beyond the six-second refresh can produce a second typing call before current main's once-only assertion. Two linked CI runs failed the affected shard; this read-only review did not run the test. Is this the best way to solve the issue? Yes. Limiting fake timers to interval scheduling during these two assertions addresses the timing assumption while separate coverage still checks the refresh cadence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7526f600cf10. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
@clawsweeper automerge |
|
🦞🧹
Draft PRs stay fix-only until GitHub marks them ready for review. Pause with Automerge progress:
Re-review progress:
|
|
@clawsweeper stop |
|
🦞✅ I added |
Main's #159980 already wraps the heartbeat run in fake setInterval and restores real timers in its finally block. Merging it with this branch's file-level fake timers left a post-run clock advance running after real timers were restored, which failed CI. Keep the merged helper as the only timer lifecycle, drop the file-level fakes and the post-run advance, and keep the added coverage: the configured typingIntervalSeconds refreshes typing once while the reply is in flight, and the run clears typing exactly once.
…nfig (#160229) * test(infra): drive heartbeat typing keepalive from the test clock The runner typing test used real timers while runHeartbeatOnce starts the heartbeat typing keepalive (6 s default interval). Any run slower than one interval correctly refreshed typing a second time and failed toHaveBeenCalledOnce on loaded CI runners; the failed-run case shared the same wall-clock assumption. Fake only setInterval/clearInterval for the file so keepalive ticks follow the test clock, configure typingIntervalSeconds, and assert the contract explicitly: typing starts before the reply, refreshes once per interval while the reply is in flight, clears once, and stops after the run. * test(infra): share one fake-interval lifecycle for heartbeat typing Main's #159980 already wraps the heartbeat run in fake setInterval and restores real timers in its finally block. Merging it with this branch's file-level fake timers left a post-run clock advance running after real timers were restored, which failed CI. Keep the merged helper as the only timer lifecycle, drop the file-level fakes and the post-run advance, and keep the added coverage: the configured typingIntervalSeconds refreshes typing once while the reply is in flight, and the run clears typing exactly once.
…aw#159980) Virtualize only interval scheduling around the heartbeat operation so real storage and dispatch latency cannot trigger an unrelated keepalive in the exactly-once assertions. Keep setup, cleanup, Date and timeouts real, and retain separate cadence coverage. Twenty standalone runs, three original shards, siblings, selected checks and independent review passed.
…nfig (openclaw#160229) * test(infra): drive heartbeat typing keepalive from the test clock The runner typing test used real timers while runHeartbeatOnce starts the heartbeat typing keepalive (6 s default interval). Any run slower than one interval correctly refreshed typing a second time and failed toHaveBeenCalledOnce on loaded CI runners; the failed-run case shared the same wall-clock assumption. Fake only setInterval/clearInterval for the file so keepalive ticks follow the test clock, configure typingIntervalSeconds, and assert the contract explicitly: typing starts before the reply, refreshes once per interval while the reply is in flight, clears once, and stops after the run. * test(infra): share one fake-interval lifecycle for heartbeat typing Main's openclaw#159980 already wraps the heartbeat run in fake setInterval and restores real timers in its finally block. Merging it with this branch's file-level fake timers left a post-run clock advance running after real timers were restored, which failed CI. Keep the merged helper as the only timer lifecycle, drop the file-level fakes and the post-run advance, and keep the added coverage: the configured typingIntervalSeconds refreshes typing once while the reply is in flight, and the run clears typing exactly once.
What Problem This Solves
Fixes intermittent heartbeat typing-test failures when slow storage or dispatch work crosses the intentional six-second typing refresh interval.
User Impact
CI checks the initial typing and cleanup behavior independently of worker speed. Runtime typing behavior is unchanged.
Why This Change Was Made
The two affected tests now control only
setIntervalandclearIntervalwhile the heartbeat operation runs, restoring them infinally. Fixture preparation and cleanup,Date, and timeouts remain real. Existing typing-cadence tests continue to verify the six-second refresh behavior.Evidence