mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-22 18:31:12 +00:00
Both flakes (CI run 29573675642, macos-swift) were the same mechanism: fixture timestamps anchored to wall clock at test start, raced against the optimistic user-echo timestamp captured later at send time. The pending-run drain (clearPendingRunIfAssistantMessagePresent -> assistantHapticEvent(after:)) only matches assistant rows timestamped at or after the user echo, and the fake transports' default waitForRunCompletion returns .unavailable, so this comparison is the only drain path in both tests. ChatHapticsTests "durable assistant failure fires run failed": the durable failure row was stamped test start + 1000ms. Under CI load a >1s stall between fixture creation and send() left the row permanently older than the user echo, so .runFailed never fired for either parameterized case. Fix: HapticsTestTransport now takes a history closure and the test stamps the failure row at requestHistory time, which is always post-send by event order. ChatStreamReplayTests "reconnect mid-run converges via history refetch": the completed transcript rows were stamped test start + 100/900ms; the scripted payload has no inFlightRun/sessionInfo, so the foreground refetch cannot drain and only the pending-run owner's timestamp comparison can. Bootstrap plus send taking >900ms made the assistant row older than the echo and the run never drained. Fix: anchor the reconnect transcript to a timestamp captured after the send completed. Proof: injecting a 1.5s/1.2s stall before send reproduced both CI failures exactly (timeout after ~16.5s/16.2s, both haptics cases failing); with the fixes the tests pass even with the stalls injected. Full ChatHapticsTests + ChatStreamReplayTests suites green; both fixed tests stressed 10x with zero failures.