Fix OBS icons stuck on error after OBS restart#38
Open
f1nalspace wants to merge 1 commit into
Open
Conversation
When OBS is closed and reopened, the action icons stayed on the error triangle and never recovered. Three combined defects: 1. backend.py: an empty websocket response (OBS closed) caused KeyError on status.datain[...] which crashed the action tick. Add build_status_dict() which returns None on a missing/empty response and marks the connection as lost (no crash). 2. OBSController.py: the obs-websocket "connected" flag was not a reliable disconnect signal (on_disconnect did not always fire), so reconnection never triggered. Disable the library's competing auto-reconnect (authreconnect=0) and add teardown_existing_connection() for a clean reconnect. 3. OBSActionBase.py + actions: drive a throttled reconnect from the tick loop (try_reconnect_if_disconnected), and call hide_error() in each status success path so the persistent error overlay is cleared once OBS is reachable again (only ToggleStream did this before, which is why recording/others stayed stuck). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
When OBS is closed and reopened, the action icons (Record, Stream, etc.)
stay stuck on the error triangle and never recover. The error is shown
correctly while OBS is gone, but the icon does not return to normal once
OBS is reachable again — the page has to be reloaded to recover.
Root cause
Three combined defects (found via logging the connection state across the
frontend and the separate backend process):
Tick crash on empty response — when OBS closes, a websocket request
returns an empty
datain, sostatus.datain["outputActive"]raisedKeyError, crashing the action tick instead of showing the error cleanly.Unreliable disconnect signal —
OBSController.connectedstayedTruebecause
on_disconnectdoes not reliably fire on a hard OBS shutdown, soreconnection was never triggered. The library's own
authreconnectalsocompeted with the plugin and left the connection in an inconsistent state.
Error overlay never cleared —
show_error()sets a persistent overlaythat is only removed by
hide_error(). OnlyToggleStreamcalledhide_error(); every other action left the triangle on top of the normalicon even after the connection recovered.
Changes
backend/backend.py: newbuild_status_dict()— returnsNoneon amissing/empty response and marks the connection as lost (no more
KeyError).backend/OBSController.py: disable the library auto-reconnect(
authreconnect=0) and addteardown_existing_connection()for cleanreconnects.
OBSActionBase.py: throttledtry_reconnect_if_disconnected()driven fromthe tick loop.
hide_error()in the success path so the erroroverlay clears once OBS is reachable again.
Testing
Verified live: closing OBS shows the error icon; reopening OBS recovers the
correct status icon automatically within a few seconds, no page reload needed.