Skip to content

Detach disposed tunnel session socket listeners - #8259

Merged
ymichael merged 1 commit into
mainfrom
slopcop/issue-8258
Nov 30, 2026
Merged

ymichael merged 1 commit into
mainfrom
slopcop/issue-8258

Conversation

@bb-slop-cop

@bb-slop-cop bb-slop-cop Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · new-issue-autopilot

Human comments

What was wrong

TunnelSession.dispose() aborted existing streams but left its anonymous socket message listener attached. Frames delivered after disposal still dispatched HTTP or WebSocket work through the retired session's origin resolver. Connect disposes sessions before gracefully closing their transports, and that resolver can reach an invalidated plugin API.

Reproduction and root-cause report: PARTIALLY REPRODUCED, high confidence in the disposal defect. Both real-WebSocket regression cases fail on trusted main and again in a second clean checkout at b0ddaad731565d7e4de68d824120d802fc78f7d5. The reported whole-server restart was not reproduced; this PR fixes the directly demonstrated lifecycle defect, not an independently verified process crash.

What changed

  • Keep stable references to the session-owned socket message and close handlers and detach only those handlers before aborting streams.
  • Add real-WebSocket regressions for late HTTP and WebSocket opening frames after disposal, with a pending stream already present.
  • Use the repository's shared-worker Vitest configuration in the owning package.
  • Three files in the tunnel-client subsystem: 109 additions + 20 deletions = 129 changed text lines, counted with git diff --numstat origin/main.
  • No dependencies, generated files, stored-data changes, wire/protocol changes, public API changes, or CLI behavior changes.

How you verified

  • Before production changes: pnpm exec turbo run test --filter=@bb/tunnel-client -- test/disposal.test.ts fails both cases because the origin resolver runs after disposal. Repeated the same failure in a second clean trusted checkout.
  • After the fix: the same focused command passes both cases.
  • pnpm exec turbo run test lint typecheck --filter=@bb/tunnel-client passes: 29 tests, lint, and typecheck.
  • pnpm exec turbo run test typecheck --filter=bb-plugin-connect passes: 158 tests and typecheck.
  • pnpm exec oxfmt on the three changed files and git diff --check pass. No binary changes.
  • A full monorepo build hits an unrelated unresolved Plugin SDK runtime import in plugin bundling, including after SDK type generation. The report includes the build failure log; no unrelated build changes are included.

Fixes #8258

AGENT GENERATED

@bb-slop-cop bb-slop-cop Bot mentioned this pull request Nov 26, 2026
2 of 3 tasks
alexburlis added a commit to alexburlis/omnyo that referenced this pull request Nov 26, 2026
Record the upstream PRs, revisions, contributors, and Omnyo integration
commits for merge d2a24ac in docs/upstream-credits.md.

Original-PR: get-bb/bb#7663
Original-Commit: get-bb/bb@1737a03
Original-Author: rufi
Original-PR: get-bb/bb#8055
Original-Commit: get-bb/bb@651ae20
Original-Author: Jake Lancaster
Original-PR: get-bb/bb#8075
Original-Commit: get-bb/bb@511e1ed
Original-Author: Jake Lancaster
Original-Co-Author: Michael Yong
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8096
Original-Commit: get-bb/bb@775090b
Original-Author: Michael Yong
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8145
Original-Commit: get-bb/bb@8de6711
Original-Commit: get-bb/bb@0d3db49
Original-Commit: get-bb/bb@92d3a76
Original-Commit: get-bb/bb@6705422
Original-Author: Michael Yong
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8171
Original-Commit: get-bb/bb@b56ed04
Original-Author: Jake Lancaster
Original-PR: get-bb/bb#8238
Original-Commit: get-bb/bb@2a9a142
Original-Author: SawyerHood
Original-PR: get-bb/bb#8247
Original-Commit: get-bb/bb@ba4ae22
Original-Author: Salem
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8259
Original-Commit: get-bb/bb@96f40a9
Original-Author: SawyerHood
Original-PR: get-bb/bb#8263
Original-Commit: get-bb/bb@141e40a
Original-Author: mk
Original-PR: get-bb/bb#8266
Original-Commit: get-bb/bb@84e20e9
Original-Author: ILIA GOLUBEV
@ymichael
ymichael merged commit eaaafcc into main Nov 30, 2026
35 checks passed
@ymichael
ymichael deleted the slopcop/issue-8258 branch November 30, 2026 20:54
scowalt pushed a commit to scowalt/bb that referenced this pull request Dec 1, 2026
🚨 **SLOP COP** 🚨 · `new-issue-autopilot`

## Human comments

## What was wrong

`TunnelSession.dispose()` aborted existing streams but left its
anonymous socket message listener attached. Frames delivered after
disposal still dispatched HTTP or WebSocket work through the retired
session's origin resolver. Connect disposes sessions before gracefully
closing their transports, and that resolver can reach an invalidated
plugin API.

[Reproduction and root-cause
report](https://get-bb.github.io/reports/issues/8258.html): **PARTIALLY
REPRODUCED**, high confidence in the disposal defect. Both
real-WebSocket regression cases fail on trusted main and again in a
second clean checkout at `a8c32288cf24894fbe85cb3a9ca0469c7a997ed6`. The
reported whole-server restart was not reproduced; this PR fixes the
directly demonstrated lifecycle defect, not an independently verified
process crash.

## What changed

- Keep stable references to the session-owned socket message and close
handlers and detach only those handlers before aborting streams.
- Add real-WebSocket regressions for late HTTP and WebSocket opening
frames after disposal, with a pending stream already present.
- Use the repository's shared-worker Vitest configuration in the owning
package.
- Three files in the tunnel-client subsystem: **109 additions + 20
deletions = 129 changed text lines**, counted with `git diff --numstat
origin/main`.
- No dependencies, generated files, stored-data changes, wire/protocol
changes, public API changes, or CLI behavior changes.

## How you verified

- Before production changes: `pnpm exec turbo run test
--filter=@bb/tunnel-client -- test/disposal.test.ts` fails both cases
because the origin resolver runs after disposal. Repeated the same
failure in a second clean trusted checkout.
- After the fix: the same focused command passes both cases.
- `pnpm exec turbo run test lint typecheck --filter=@bb/tunnel-client`
passes: 29 tests, lint, and typecheck.
- `pnpm exec turbo run test typecheck --filter=bb-plugin-connect`
passes: 158 tests and typecheck.
- `pnpm exec oxfmt` on the three changed files and `git diff --check`
pass. No binary changes.
- A full monorepo build hits an unrelated unresolved Plugin SDK runtime
import in plugin bundling, including after SDK type generation. The
report includes the build failure log; no unrelated build changes are
included.

Fixes get-bb#8258

> AGENT GENERATED

<!-- slopcop:rule=new-issue-autopilot run=run_tx70go1tmwxnqfki
sha=issue-8258 kind=summary -->

Co-authored-by: SawyerHood <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught PluginContextStaleError

2 participants