Repository navigation
refactor: reuse deferred owners in Gateway and infra fixtures - #146809
Conversation
|
🦞👀 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 13, 2026, 7:59 AM ET / 11:59 UTC (Revision 5). ClawSweeper reviewWhat this changesReplaces repeated Promise resolver setup in Gateway and infrastructure tests with existing deferred helpers while preserving test scenarios and settlement ordering. Merge readiness⛔ Blocked before merge - 2 items remain No actionable correctness findings. This useful cleanup remains absent from current main, and the updated body records completion of the previous validation follow-up. The maintainer-authored PR should remain open for normal landing. Priority: P3 Review scores
Verification
How this fits togetherGateway and infrastructure fixtures pause asynchronous operations so tests can check cancellation, ordering, and cleanup. The shared deferred helper supplies the Promise and its completion callbacks. flowchart LR
A[Test scenario] --> B[Shared deferred helper]
B --> C[Pending Promise]
C --> D[Gateway or infrastructure operation]
A --> E[Resolve or reject callback]
E --> C
D --> F[Ordering and cleanup assertions]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep asynchronous test synchronization on the existing shared deferred owner while preserving effectful and mutable captures at their current sites. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR removes repeated fixture construction rather than fixing a reported runtime defect. Is this the best way to solve the issue? Yes: using the existing native-Promise helper removes repetition without adding an owner or changing the tested control flow. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 970992db26c8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
a621648 to
750b873
Compare
750b873 to
ecdbed3
Compare
|
Merged via squash.
|
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
Block: heartbeat wake test-reset residue and the moved lifecycle suite. - resetHeartbeatWakeStateForTests / resetSessionEventWakeStateForTests were deleted upstream in d1684f4 (openclaw#106019); 2273ef6/5a6971fc3a revived them. Removed both production exports; no continuation test needs them (the existing afterEach drain with a disabled handler empties the queue). - heartbeat-wake.test.ts restored to upstream b51feb9 bytes. This brings back the six lifecycle tests verbatim, including the createDeferred owner from a67f462 (openclaw#146809), and drops the lifecycle-file copy of "executes distinct targeted wakes ...", deleted upstream in 2bdf870 (openclaw#158725), plus its four byte-duplicate tests. - heartbeat-wake.lifecycle.test.ts deleted. The six continuation routing tests (trusted/untrusted slot separation, parentRunId forwarding) moved unchanged into heartbeat-wake.continuation-routing.test.ts so the upstream file stays within its line cap. Home: restored to upstream (drift residue). Stayed: continuation routing tests in their own sibling file. Refs #1418 Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
Gateway and infrastructure tests repeat deferred-Promise construction and resolver capture setup across unrelated scenarios.
User Impact
No user-visible change. Test cases, assertions, payloads, settlement behavior, and cleanup ordering are preserved.
Why This Change Was Made
Reuse the existing deferred helpers for 210 adjacent Promise capture pairs. This removes 534 code lines across 95 tests and five test-support files, without introducing a helper or changing production code. Effectful or mutable capture patterns remain at their existing owners.
Evidence
git diff --checkpass.CI Recovery and Final Proof
The old-head fallback run 34752495033 did not pass. Its UI run checked out source with the stale “Close Review” selector, already repaired on main by #146810. It also recorded a website “Service details” timeout and an SDK-report renderer OOM at its 6-GiB heap limit. These failures remain recorded. The SDK input audit followed 153 public roots and 11,950 source/declaration paths: none of the 100 changed files was reached, and consulted versioned inputs were unchanged. This supports existing renderer resource-failure attribution, not a passing API report or a reproduced base OOM.
The final branch includes #146810. Exact-head ordinary CI 34754652988 passed with 78 successful jobs, 16 skips, and no failures, including the required CI gate. Current selected CodeQL checks also pass.
The complete chat-file-links and dashboard-website suites passed all nine cases on the exact candidate in focused Linux proof 34754727114. Source identity and clean status were verified before and after; the lease is stopped. Testbox used Chromium 144/Node 24.19, while the failed hosted shard used Chromium 152/Node 24.20 and a broader workload. The website timeout did not recur, but its cause remains unresolved; this is not equivalent reproduction or a claimed race fix. Assertions, timeouts, memory caps, production behavior, and the SDK reporting script remain unchanged.