Skip to content

test: avoid cross-OS socket close event race#99642

Merged
RomneyDa merged 1 commit into
mainfrom
dallin/fix-cross-os-socket-close-flake
Jul 3, 2026
Merged

test: avoid cross-OS socket close event race#99642
RomneyDa merged 1 commit into
mainfrom
dallin/fix-cross-os-socket-close-flake

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Jul 3, 2026

Copy link
Copy Markdown
Member

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-shot close listener, 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

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Jul 3, 2026
@clawsweeper

clawsweeper Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 3, 2026, 4:17 PM ET / 20:17 UTC.

Summary
The PR changes one cross-OS release-check test to create the client socket close promise before starting static server shutdown.

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: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • Several broad CI jobs were still in progress in the live PR status during review, so landing should wait for the repository's normal required checks.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow test-only listener-ordering fix after required CI finishes, keeping production static server behavior unchanged.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No ClawSweeper repair job is needed; the patch is narrow and should proceed through normal maintainer PR landing once CI is complete.

Security
Cleared: The diff only changes a Vitest test listener ordering and adds no dependency, workflow, script execution, permission, or secret-handling surface.

Review details

Best 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 server.close() is the narrowest maintainable fix, matches a sibling socket-cleanup test pattern, and avoids increasing timeouts or changing production code.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5361e5a0b455.

Label changes

Label changes:

  • add P3: This is a low-risk test/CI flake fix with no user-facing runtime behavior change.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer-labeled PR, and the body still includes local, Linux Node 24 Testbox, stress, and changed-gate terminal evidence.

Label justifications:

  • P3: This is a low-risk test/CI flake fix with no user-facing runtime behavior change.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer-labeled PR, and the body still includes local, Linux Node 24 Testbox, stress, and changed-gate terminal evidence.
Evidence reviewed

PR surface:

Tests +3. Total +3 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 6 3 +3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 6 3 +3

What I checked:

Likely related people:

  • onutc: Authored and merged the native cross-OS release validation PR that added the central script and test files. (role: introduced behavior; confidence: high; commits: 900e291f31fd, f89437825361; files: scripts/openclaw-cross-os-release-checks.ts, test/scripts/openclaw-cross-os-release-checks.test.ts)
  • vincentkoc: Recently merged release-smoke changes touching the same cross-OS release-check script and test file. (role: recent area contributor; confidence: medium; commits: 3a8ab36310fd; files: scripts/openclaw-cross-os-release-checks.ts, test/scripts/openclaw-cross-os-release-checks.test.ts)
  • RomneyDa: Besides authoring this PR, previously authored merged release workflow matrix work in the same release-validation area. (role: adjacent release CI contributor; confidence: medium; commits: bc965c03c06b, 039beec125d8; files: .github/workflows/openclaw-live-and-e2e-checks-reusable.yml, test/scripts/openclaw-cross-os-release-checks.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 3, 2026
@RomneyDa
RomneyDa merged commit 010b617 into main Jul 3, 2026
110 of 116 checks passed
@RomneyDa
RomneyDa deleted the dallin/fix-cross-os-socket-close-flake branch July 3, 2026 20:23
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant