fix(viewer): silence sh's monitor-thread crash report on webview exit - #3011
Merged
Conversation
- Pass _bg_exc=False when spawning AnthiasViewer: sh's default re-raises the exit error (e.g. SignalException_SIGABRT on a Qt init crash, or SIGTERM from our own teardown) inside its daemon monitor thread, where nothing can catch it - Sentry reported these as unhandled errors even though the handshake watch already detects the death and load_browser() already retries - The handle is only used via is_alive()/process.stdout/terminate(), never .wait(), so no exception is silently deferred - Lock the kwargs in with a regression assertion in test_load_browser Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
There was a problem hiding this comment.
Pull request overview
This PR prevents sh from re-raising AnthiasViewer child-process exit errors inside sh’s own background monitor thread (which Sentry reports as unhandled) by disabling background exception propagation for the webview spawn, while keeping existing failure detection in the D-Bus handshake/poll loop.
Changes:
- Pass
_bg_exc=Falsewhen spawningAnthiasViewerviash.Command(...)(..., _bg=True, ...)to avoid unhandled monitor-thread exceptions on crash/teardown. - Add a regression assertion in
test_load_browserto lock in_bg_exc=False(and_bg=True) for the spawn call.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/anthias_viewer/__init__.py |
Spawns AnthiasViewer with sh background exceptions disabled to avoid unhandled monitor-thread crash reports. |
tests/test_viewer.py |
Adds an assertion that the webview spawn uses _bg_exc=False (and remains a background process). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.



Issues Fixed
Sentry event
0c37023f9c8541a6a8ec6bc7b3cbf092(release 2026.6.2): every AnthiasViewer crash — and even our own SIGTERM during teardown — surfaced as an unhandledSignalException_SIGABRTfromsh's daemon monitor thread, despite the failure already being detected and retried byload_browser().Description
sh's default_bg_exc=Truere-raises the child's exit error inside the library's own background thread, where nothing can catch it; Sentry's threading integration then reports it ashandled: no. The spawn in_spawn_webview_oncenow passes_bg_exc=False— safe because the handle is only used viais_alive()/process.stdout/terminate(), never.wait(), so failure detection stays with the existing D-Bus handshake watch and retry loop.Verified at runtime: with
_bg_exc=Falsea SIGABRT'd child produces zero unhandled thread exceptions whileis_alive()still flips toFalse. A regression assertion intest_load_browserlocks the kwargs in.Checklist
🤖 Generated with Claude Code