test: avoid cross-OS socket close event race#99642
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 3, 2026, 4:17 PM ET / 20:17 UTC. Summary PR surface: Tests +3. Total +3 across 1 file. Reproducibility: yes. for source-level reproduction: current main awaits server shutdown before registering the client close listener, and the PR body links a Linux Node 24 CI failure. This read-only review did not rerun the flaky test locally. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow test-only listener-ordering fix after required CI finishes, keeping production static server behavior unchanged. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main awaits server shutdown before registering the client close listener, and the PR body links a Linux Node 24 CI failure. This read-only review did not rerun the flaky test locally. Is this the best way to solve the issue? Yes. Creating the close promise before AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5361e5a0b455. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Tests +3. Total +3 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
What Problem This Solves
The cross-OS release-check test could fail after the static artifact server had already shut down successfully. In CI run 28639846548, job 84933576981, the test awaited
server.close()and only then registered the client socket's one-shotcloselistener, allowing Linux/Node 24 to emit the event before the listener existed and hit the fixed one-second test timeout.Why This Change Was Made
Register the client socket close promise before starting server shutdown, then keep the existing server-close and socket-close timeout assertions. This fixes the observation race without increasing a timeout or changing production behavior; the server already tracks and destroys active sockets during shutdown.
User Impact
No user-visible behavior changes. Release-check CI no longer depends on OS-specific ordering between the server close callback and the client socket's one-shot close event.
Evidence
socket close timed out).node scripts/run-vitest.mjs test/scripts/openclaw-cross-os-release-checks.test.ts --reporter=verbose.exitCode=0, Testboxtbx_01kwmse0xrzdpm35tth1gb36gx, hydration run https://github.com/openclaw/openclaw/actions/runs/28681253566.pnpm check:changedpassed; Crabbox wrapperexitCode=0, Testboxtbx_01kwmsndr0x48dq5tweaqv0mj1, hydration run https://github.com/openclaw/openclaw/actions/runs/28681396353.