Repository navigation
Conversation
Route every unhandled error through a new pixelmap.error_reporting module so that it can no longer crash a session or the server: - Panel callbacks: create_app installs a per-session exception_handler that logs the traceback, shows an error toast and posts to the webhook. Returning instead of re-raising also keeps Bokeh from discarding the document writes the callback already made. - Raw Bokeh on_change callbacks (electrode selection, tool state), which Panel's handler does not see, are wrapped with `guarded`. - A failing session build renders an error alert instead of a blank page. - Background threads, the asyncio loop and sys.excepthook report to the webhook (no toast, as no session is attached). The webhook is opt-in via PIXELMAP_ERROR_WEBHOOK_URL (http(s) only), with optional _TOKEN (bearer auth), _TIMEOUT and _DEDUPE_SECONDS. Payloads carry Slack/Discord-compatible `text`/`content` summaries plus a structured `event`. Delivery runs on a daemon thread with a bounded queue, so a slow or dead endpoint cannot block the event loop or grow memory. Assisted-by: ClaudeCode:claude-opus-5-5
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.
🤖 Human guided, AI assisted PR (using this skill). AI text below. 🤖
Summary
Unhandled errors can no longer crash a session or the server. Each one is logged with its traceback, shown to the affected user as an error toast, and optionally POSTed to a webhook that the deployer configures.
All of this lives in the new
pixelmap/error_reporting.py:create_appinstalls a per-sessionexception_handler. It has to be per session for the same reason asnotifications=True: Panel keysconfigon the current document. Because the handler returns instead of re-raising, Bokeh no longer discards the document writes the callback made before it failed.on_changecallbacks: Panel's handler doesn't see these. The two ingui.py(electrode selection and tool state) are now wrapped withguarded(...), and a test enforces that.sys.excepthook: these are reported to the webhook but not toasted, since no session is attached.Webhook configuration
PIXELMAP_ERROR_WEBHOOK_URLPIXELMAP_ERROR_WEBHOOK_TOKENAuthorization: Bearer <token>PIXELMAP_ERROR_WEBHOOK_TIMEOUTPIXELMAP_ERROR_WEBHOOK_DEDUPE_SECONDS0sends every oneThe payload has a one-line
text/contentsummary, so Slack, Mattermost and Discord incoming webhooks work as-is. It also has aneventobject with the type, message, traceback, session id, host and version. Sends run on a single daemon thread with a bounded queue. A slow or dead endpoint therefore can't block the Bokeh event loop or grow memory: excess reports are dropped, and failed sends are only logged. The settings are documented indocs/getting-started.md,env.templateanddocker-compose.yml.Testing
tests/test_error_reporting.pyadds 54 tests, written before the implementation. They cover blank and invalid settings, non-http URLs, timeout values of 0, negative, NaN and infinity, errors whose message can't be printed, a missing or broken toast area, a sender that raises, duplicate suppression, a full queue, and real delivery to a local HTTP server.Notes
Assisted-by: ClaudeCode:claude-opus-5-5