fix: stop draft action failures from spamming Sentry as console errors#5082
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix: stop draft action failures from spamming Sentry as console errors#5082cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Sentry issue #7516014716 (publish failed: 500) was triggered by the
agent sidebar's draft action widget. When a Publish/Discard request to
/api/v1/canvases/{canvas}/versions/{version}/publish came back with a
non-2xx response (e.g., a transient backend 500), the widget logged the
status and body via console.error. The Sentry React SDK is configured
with captureConsoleIntegration({ levels: ['warn', 'error'] }), so each
console.error became a server-side error event titled
'publish failed: 500 {"code":13,"message":"internal error","details":[]}'
even though the user already had nothing actionable on the page.
The widget also bypassed the React Query SDK hooks the rest of the
canvas page uses, so successful publishes/discards from the agent
sidebar didn't invalidate canvas/version caches.
Switch the widget over to the existing usePublishCanvasVersion and
useDeleteCanvasVersion mutations, surface errors via showErrorToast
with getApiErrorMessage (so the user sees a real message instead of
nothing), and stop emitting console.error so transient backend failures
no longer pollute Sentry. Add unit tests covering both success and
failure paths to lock in the new behavior.
|
👋 Commands for maintainers:
|
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
Sentry issue #7516014716 reports the error
publish failed: 500 {"code":13,"message":"internal error","details":[]}fromhttps://app.superplane.com/{org}/canvases/{canvas}.The error originates in
web_src/src/components/AgentSidebar/widgets/DraftActionsWidget.tsx. When the agent sidebar's draft bar tries to Publish/Discard a draft version, it called the API with rawfetchand on any non-2xx response logged the status + body throughconsole.error:Our Sentry init wires up
captureConsoleIntegration({ levels: ["warn", "error"] }), so everyconsole.erroris converted into a Sentryerror-level event. Withaction === "publish"the captured message is exactly:That is the title we see in Sentry.
Beyond the noise, the widget had two related problems:
usePublishCanvasVersion,useDeleteCanvasVersion), so successful agent-driven publishes/discards never invalidated canvas/version caches the rest of the canvas page relies on.Fix
DraftActionsWidgetto use the existingusePublishCanvasVersion/useDeleteCanvasVersionmutations so caches are invalidated consistently and error handling matcheshandlePublishVersioninpages/workflowv2/index.tsx.showErrorToast(getApiErrorMessage(...))instead ofconsole.error, giving the user an actionable message and keeping transient backend errors out of Sentry.DraftActionsWidget.spec.tsxcovering the four code paths: publish success/failure and discard success/failure, and asserting that failures show a toast and do not callconsole.error.This is the same class of fix as #5053 / #4936, which removed Sentry noise from auto-save and browser-extension error paths.
Tests
npx vitest run src/components/AgentSidebar/widgets/DraftActionsWidget.spec.tsx— 4 passed.make check.build.ui— clean.make format.js— no changes.