fix: scoped bus close() tears down shared bus (P1) #10#11
Merged
four-bytes-robby merged 1 commit intoJun 14, 2026
Merged
Conversation
ScopedBusTui.close() previously called inner.close(), which closed the shared WebSocket connection and broke every other consumer of the same parent bus. A scoped view is a channel-namespace wrapper, not a connection owner — its close() must be a no-op. Also adds an explicit close() override on ScopedBusClient. The base BusClient had no close() method, so ScopedBusClient was inheriting nothing — but that becomes a footgun the moment the base class gains lifecycle management (HTTP keep-alive pooling, binary shutdown). Added a no-op close() on the base BusClient to document the contract and let ScopedBusClient override it cleanly. Regression test in test/scoped-close.test.ts: 3 cases, all pass with the fix and all fail without it (verified via git stash).
|
Caution Review failedThe pull request is closed. Recent review infoRun configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Files ignored due to path filters (5)
Files selected for processing (3)
WalkthroughWalkthrough
ChangesScoped Close Lifecycle Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Finishing TouchesGenerate docstrings
Generate unit tests (beta)
Simplify code
Comment |
This was referenced Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P1 Bug Fix
ScopedBusTui.close()(src/bus-tui.ts) calledthis.inner.close(), which closed the shared WebSocket connection — breaking every other consumer of the same parent bus. A scoped view is a channel-namespace wrapper, not a connection owner; itsclose()must be a no-op.Changes
src/bus-tui.ts —
ScopedBusTui.close(): no longer callsinner.close().src/bus-client.ts —
ScopedBusClienthad noclose()override at all (baseBusClienthad noclose()either). Latent footgun: the momentBusClientgains lifecycle management, the scoped wrapper would inherit and tear down the shared bus. Fix: added an explicit no-opclose()on the baseBusClient(HTTP is stateless, so no-op is correct) andoverride close()onScopedBusClient.test/scoped-close.test.ts — 3 regression tests, all fail without the fix (verified via
git stash):ScopedBusTui.close()does not close the parent busScopedBusClient.close()is a no-op (defense in depth)close()calls are idempotentVerification
Note on integration.test.ts
test/integration.test.tsreferences/home/robby/four-opencode-plugin-bus/bus— a path that doesn't exist (the binary is now~/.local/bin/four-local-busper the wave-1 rename). This is pre-existing test infrastructure rot, out of scope for the P1 fix. The newscoped-close.test.tsis hermetic and self-contained.Closes #10
Summary by cubic
Fixes a P1 bug where closing a scoped bus shut down the shared connection, breaking other consumers.
ScopedBusTui.close()is now a no-op so scoped views never tear down the parent bus.Bug Fixes
ScopedBusTui.close()no longer calls the parent’sclose(); it does nothing.close()toBusClientand an explicit no-op override inScopedBusClientto prevent any future lifecycle teardown from propagating to scoped clients.Tests
test/scoped-close.test.tswith 3 regression cases:ScopedBusTui.close()does not close the parent bus.ScopedBusClient.close()is a no-op.close()calls are idempotent.Written for commit 9503626. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Tests