Stop reporting handled chat-context 4xx as exceptions; upload source maps - #1022
Draft
posthog-eu[bot] wants to merge 2 commits into
Draft
Stop reporting handled chat-context 4xx as exceptions; upload source maps#1022posthog-eu[bot] wants to merge 2 commits into
posthog-eu[bot] wants to merge 2 commits into
Conversation
…maps The chat-context mutation handlers reported every failure to PostHog error tracking, including expected 4xx rejections that already show the user a toast with the server's `detail`. With no source-map upload, minified frames re-fingerprinted on each deploy, so the same handled 400 kept reopening as a new issue and flooded triage. - Add `captureUnexpectedError`: report only 5xx, network, and non-Axios errors. Use it in the add, delete, and clear chat-context handlers. Toast and optimistic rollback are unchanged. - Emit source maps when `POSTHOG_SOURCEMAPS=1`, set by the dashboard deploy workflows. Each workflow injects and uploads maps via @posthog/cli, then strips them from the bundle. Needs the `POSTHOG_CLI_API_KEY` repo secret. Generated-By: PostHog Desktop Task-Id: f39ee2a6-4317-440f-8a9f-b30451fc7b21
Adding the captureUnexpectedError helper shifted the line numbers of the existing `t` calls in conversation/hooks/index.ts, so the lingui source references drifted. Re-run extract and compile so ci-check-i18n-catalogs passes. No msgids changed. Generated-By: PostHog Desktop Task-Id: f39ee2a6-4317-440f-8a9f-b30451fc7b21
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
useAddChatContextMutation.onErrorcallsposthog.captureException(error)as its first line, then rolls back and shows a toast built from the server'sdetail. So expected 400s fromadd_chat_context(already attached, too long, context budget exceeded) file as application exceptions. The delete and clear-context handlers repeat the shape.IJin/assets/index-*.js). The fingerprint churns on every deploy and each handled 400 reopens as a first-seen issue.Changes
captureUnexpectedErrorhelper reports 5xx responses, network errors, and non-Axios errors, and skips handled 4xxAxiosErrors. It replaces the four rawcaptureExceptioncalls in the add, delete, and clear chat-context handlers. Toasts and optimistic rollback are unchanged.vite buildemits maps whenPOSTHOG_SOURCEMAPS=1. The two dashboard deploy workflows set that flag, then inject and upload maps to PostHog with@posthog/cli, then strip the maps from the deployed bundle. Frames symbolicate and fingerprints stay stable across deploys.Deploy setup
POSTHOG_CLI_API_KEYrepository secret: a PostHog personal API key with theerror_tracking:writescope. Without it the upload step is a no-op (continue-on-error: true) and never blocks a deploy.POSTHOG_SOURCEMAPS, so they emit no maps.Testing
tsc --noEmitandbiome checkpass on the changed files.AgenticChatPanel"Recording limit reached") reproduces onmainand is not touched by this change.Agent context
@posthog/rollup-pluginroute (upload duringvite build), but the frontend build runs throughvercel buildand the repo keeps secrets in GitHub Actions, not Vercel env. The CLI-in-CI route keeps the key and project id in the workflow.Created with PostHog Desktop from this inbox report.