Repository navigation
test(chat): finish replacing wall-clock polls in the chat suites - #166373
Conversation
Await send, stream, cache, and recorder progress without wall-clock polling. Restrict formatting cleanup to lines introduced by the six merged test commits. Preserve production code and validate batch, sibling, and saturation filters.
|
🦞👀 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: needs maintainer review before merge. Reviewed October 6, 2026, 9:07 PM ET / October 7, 2026, 01:07 UTC. ClawSweeper reviewWhat this changesThe PR replaces remaining clock-based waits in shared Apple chat tests with task completion, stream barriers, cache arrival signals, and observed recorder state, alongside test formatting cleanup. Merge readiness✅ Ready for maintainer review This remains a useful, focused test-reliability fix: current main retains the affected polling waits, and no introduced correctness defect was found. Likely related people: steipete, supported by prior merged work on these suites. Priority: P2 Review scores
Verification
How this fits togetherOpenClawKit supplies the shared chat behavior used by the Apple apps. These tests feed scripted sends, events, cache responses, and audio-capture results into that behavior and check the resulting messages and UI state. flowchart TD
A[Scripted chat inputs] --> B[Shared Apple chat model]
C[Cache and audio fixtures] --> B
B --> D[Owned task completion]
B --> E[Stream and state signals]
D --> F[Behavior assertions]
E --> F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceOther +122. Total +122 across 9 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep chat assertions synchronized with their existing work owners and transport ordering, without adding production seams or extending timeouts. Do we have a high-confidence way to reproduce the issue? Yes: current main retains 15-second polling deadlines, and the captured body describes base failures under a sustained MainActor backlog. This review verified the mechanism in source but did not execute the saturation probe. Is this the best way to solve the issue? Yes: existing task handles and fixture arrival signals provide narrower, stronger synchronization while preserving behavioral assertions and production code. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c6168a9597e8. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…66373) Await send, stream, cache, and recorder progress without wall-clock polling. Restrict formatting cleanup to lines introduced by the six merged test commits. Preserve production code and validate batch, sibling, and saturation filters.
What Problem This Solves
Fixes:
macos-swift (packages)can fail withTimeout waiting for: …in the remaining chat suites (composer, haptics, stream replay, sidebar previews, voice note recorder) when the full OpenClawKit package runs in parallel on a loaded runner.User Impact
No user-visible change. With this PR, no chat suite in OpenClawKit uses the 15 s wall-clock
waitUntilany more.Why This Change Was Made
This follows #165157, #165170, #165171, #165172, #165178, and #165187, which converted every
ChatViewModel*andNativeConversation*suite. The last 16 chat waits sat in five smaller suites:ChatStreamReplayTests). Itsreplay bootstrapconvergence helper alone timed out 27 times under load. The scripted transport now carries a FIFO barrier:drain()enqueues a marker that resumes only when the view model asks for its next event, which proves that every earlier event was handled. Refreshes those handlers spawn are awaited through the TaskhandleTransportEventreturns, and bootstrap and send await their owners. No step waits on a clock.send()Task from test(chat): await send and run-event owners instead of wall-clock polls #165157, then assert the exact message, draft, and haptic events.The PR also fixes SwiftFormat findings on test lines the merged series introduced, such as the one-line
didSetproperty bodies on the fake transport state and a few wrapped loop bodies. Only lines thatgit blameattributes to those six commits changed. Test-only; no production changes.waitUntilitself stays for now: the gateway node-session suites still use it until the follow-up gateway PR lands and deletes the helper.Evidence
Deterministic saturation probes, the method from #163792 and #165157. A temporary MainActor flood of 16,000 tasks, each spinning 1 ms, held 420 s, puts one hop past 15 s. A cooperative-pool flood on a one-thread pool and an XCTest twin, which floods from the first XCTest case, were also used, because SwiftPM runs XCTest before Swift Testing. Every run used a private HOME, CFFIXED_USER_HOME, OPENCLAW_STATE_DIR, and TMPDIR.
replay bootstrap(27),run failed haptic,quoted send accepted,slash send accepted, andold/new cache read starts. The single voice-note XCTest wait did not time out at base, even under its own flood. It is converted anyway because it uses the same 15 s deadline.Test run with 41 tests in 6 suites passed after 420.0 seconds) and under the pool flood. The voice-note XCTest passes under its own flood.Flake-fix proof bar (writing tests, Flake triage step 4), on this head:
ChatViewModel*andNativeConversation*suite, 20 of 20 clean runs (552 tests each). These also cover the formatting-only edits.macos-swift; the full-packagemacos-swift (packages)shard runs in hourly main CI, which covers this change after merge (maintainer decision, same as the earlier series).Checks.
git diff --checkis clean, and SwiftFormat lint is clean on every changed line. I did not run the full OpenClawKit suite locally, because its keychain fixtures reach the login keychain on this Mac.Related: #165157, #165170, #165171, #165172, #165178, #165187