Repository navigation
Conversation
Keep graceful close for one-shot sessions, then terminate after a one-second unrefed grace if the peer leaves the connection open. Preserve retained-pool immediate disposal and completed-session reuse. Cover timer ownership, failure paths, idempotency and native Bun physical teardown with an injected stalled close operation. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
Explicitly widen the fresh readyState read after close(), which can mutate it synchronously despite TypeScript retaining the pre-close narrowing. Preserve the early-close timer cleanup behavior. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
Refresh with dev and preserve private one-second close grace while avoiding an observer and timer when native terminate is unavailable. Exercise real peers that withhold Close replies for dispose and completed release, and document private versus retained teardown in the owning Structure contract. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
…rk772-dev-bd5-20261024
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
…ws-close-grace # Conflicts: # tests/claude-integration/claude-picker-upload.test.ts
|
Release triage for v2.93.0: carried and merged. Your change landed on The source change is byte-identical to this PR's dev-relative diff; only the base moved. The carried head passed exact-head PR CI and a cross-platform |
Summary
Bound the closing handshake for a WebSocket that will not be reused. Detach the logical session and its existing listeners before starting a graceful close; if a native socket remains open after the one-second grace timer, terminate that specific socket.
Keep retained-session disposal immediate and successful pooled release reusable. Clean up the close timer/listener on early close, timeout and exceptions. A fake without native termination receives only a close attempt, avoiding a leftover listener/timer. The timer is not a real-time upper bound under event-loop stalls.
Update the owning wire contract and add native loopback stalled-peer regressions plus receipt, cancellation and ownership checks.
Verification
Candidate
90ad57a2a23e4a490426e8330c06189c9bccb688normally mergesdev@0aeaf0cb6b0a7c2f117d8c75f8fa396cf2ea6e39and shared #7627 (f011a94be1b468b7b785cb54976d4cb4a9b6a563). Runtime andtestRunnerBunare both pinned to 1.4.4. The PR remains based ondev.Current candidate validation: Official native Windows Bun 1.4.4,
CI=true bun test --isolate --timeout 60000, fresh processes for the six focused WebSocket files: 215 passed / 0 failed / 1 existing conditional skip / 1,418 assertions. Reference TypeScript, official Structure and skill-surface checks, and all 14 changed-file privacy/size/diff checks passed. All ten units returned native exit 0 and complete child output, with no dependency reinstall. This focused result does not settle the earlier broad-run failures described below.All three change-owned blobs remain unchanged; the 11-file Bun baseline is shared with #7627.
Previously reported at
91c871e514a7b97f18645c49bcf3b8eedc8a612e: official Bun 1.4.4 on Windows passed 215 tests / 1 conditional skip / 0 failures / 1,418 assertions across handshake validation, dispatch receipts, upstream reuse, pool contention, handshake and upstream tests. Native fixtures used loopback; external URLs used fake WebSocket/fetch paths. Proxy variables were removed only from the test process, with repository preload, home guard and shared queue retained.Earlier TypeScript, Structure, diff and changed-file privacy/size checks passed; unrelated sparse-absent paths were not evaluated. The source reviewer subsequently ran the Windows checks, so this was not a second independent review. Earlier Linux focused results on Bun 1.4.3/1.4.4 and the corrected
534d5f9efake-socket pre-send receipt-refusal failure remain historical evidence.Broader validation remains incomplete
The earlier Bun 1.4.3
test:changedrun selected 693 files and reported 16,538 passed / 37 skipped / 269 failed / 22 errors. Reported categories included inherited-proxy ingress, HTTP-only mocks reaching WebSocket paths, discovery expectations and timeout cascades. An eight-case follow-up changed dependencies/environment and did not establish one common cause.Those failures remain unresolved. Focused Windows results or hosted shard success do not classify them as environmental or establish macOS/full-suite success. Escaped-mock raw output is not republished. Focused checks used the shared-worktree resource exception; broader classification and final-head validation remain pending. Keep Draft; this is not merge or deployment approval.
Checklist
Co-authored-by: luvs01 27862058+luvs01@users.noreply.github.com