Skip to content

fix(ui): silence noisy auto-save Sentry events for transient HTTP failures#4936

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/agent-4d6e3603
Draft

fix(ui): silence noisy auto-save Sentry events for transient HTTP failures#4936
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/agent-4d6e3603

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 21, 2026

Summary

Fixes the Sentry issue "Failed to auto-save <!DOCTYPE html>" (issue 7370830183).

Canvas auto-save runs silently in the background after node position drags. When the request failed (auth redirect, proxy/load balancer returning an HTML error page, offline blip, 5xx gateway), the catch block logged:

} catch (error) {
  console.error("Failed to auto-save", error);
}

That console call was forwarded to Sentry via captureConsoleIntegration. Because @hey-api/client-fetch (configured with throwOnError: true) throws the raw response body when the body is not JSON, the thrown value for an HTML error page is the response text itself. Sentry concatenated the two console.error arguments into the issue title, producing entries like:

Failed to auto-save <!DOCTYPE html>

The HTML body also varies between environments (Cloudflare 502 page, login redirect, etc.), so Sentry grouped them poorly and created one noisy issue per unique response.

What changed

  • New reportAutoSaveFailure helper in web_src/src/pages/workflowv2/index.tsx:
    • Drops transient failures (HTML responses, browser network errors, HTTP {0, 401, 403, 408, 429, 502, 503, 504}). These are expected for a silent background save and will be retried on the next auto-save tick.
    • Forwards genuine failures to Sentry with Sentry.captureException, attaching a sanitized errorSummary extra, an auto_save.scope tag, and a stable canvas-auto-save-failure fingerprint so they group cleanly.
  • New reusable helpers in @/lib/errors:
    • isTransientHttpError(error) — detects HTML response bodies, TypeError("Failed to fetch")/AbortError, and known transient HTTP statuses.
    • summarizeError(error, maxLength?) — short, telemetry-safe rendering that never returns an HTML body and truncates long messages.

Testing

  • npx vitest run src/lib/errors.spec.ts — 16 tests pass (12 existing + 4 new for the helpers).
  • npx eslint src/pages/workflowv2/index.tsx — same 50 problems (10 errors, 40 warnings) as baseline; no new lint issues introduced.
  • npm run lint:budget — within budget (654/654).
  • npx prettier --check on the touched files — clean.

Full npm run build / make check.build.ui was skipped because the cloud agent VM has no Docker available to generate src/api-client/** from the OpenAPI spec; the changes only add code that uses already-imported types and the existing Sentry namespace.

Effect on Sentry

  • Expected transient infrastructure failures stop creating issues entirely.
  • The remaining (rare, real) failures land in a single grouped issue titled by the error message — never by the response body.
Open in Web Open in Cursor 

…lures

Canvas auto-save runs silently in the background after node position
drags. When the request failed (auth redirect, proxy/load balancer
returning an HTML error page, offline blip, 5xx gateway), the catch
block logged `console.error("Failed to auto-save", error)` which was
forwarded to Sentry via captureConsoleIntegration. Because the thrown
value from @hey-api/client-fetch contains the raw response body, Sentry
issue titles ended up looking like "Failed to auto-save <!DOCTYPE html>"
and grouped poorly, producing one noisy issue per unique HTML response.

Replace the unconditional console.error with a small reporter that:

- Treats HTML responses, browser network errors, and transient HTTP
  statuses (0, 401, 403, 408, 429, 502, 503, 504) as expected and drops
  them — they will be retried on the next auto-save tick.
- Forwards real failures to Sentry with `captureException`, a clean
  `errorSummary`, and a stable fingerprint so the issues group together
  instead of fragmenting on response-body contents.

Add reusable helpers `isTransientHttpError` and `summarizeError` in
`@/lib/errors` with unit tests covering HTML payloads, browser network
failures, transient status codes, and value truncation.
@superplanehq-integration
Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant