fix: batch resolve PostHog production errors (network-transport noise + auto-resolve stale)#351
fix: batch resolve PostHog production errors (network-transport noise + auto-resolve stale)#351JeffOtano wants to merge 2 commits into
Conversation
Treat provider streams that finish with an error reason as provider failures so BYOK handling can finalize the pending message with a safe user-facing error instead of leaving the generic empty-message fallback. Add regression coverage for OpenAI Responses stream failures that do not throw provider exceptions. Co-authored-by: Codex <[email protected]>
Add `Failed to fetch` (Chromium/Safari) and `NetworkError when attempting to fetch resource` (Firefox) to both posthogBeforeSend and sentryBeforeSend suppression lists. These TypeErrors are thrown by the browser's fetch() implementation when it cannot reach the server (offline, DNS, TLS, connection drops) — they originate before any application code runs and Convex transport already auto-reconnects with a UI indicator, so they are not actionable application bugs. Resolves PostHog issues: - 019dfc33 NetworkError when attempting to fetch resource (3 occ) - 019dfa87 Failed to fetch (2 occ) - 019dd58e Failed to fetch (2 occ) - 019d4a22 NetworkError ... chatty-hawk-29.convex.cloud (13 occ) - 019d982a Failed to fetch (1 occ) - 019da185 Failed to fetch (1 occ) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR adds provider response failure detection in streaming contexts and expands error suppression for browser-side transport failures. Provider streaming completions with ChangesProvider Response Failure Detection
Browser Transport Error Suppression
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a981fdda2b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // to fetch resource"; Chromium-based browsers and Safari emit "Failed to | ||
| // fetch". | ||
| "NetworkError when attempting to fetch resource", | ||
| "Failed to fetch", |
There was a problem hiding this comment.
Scope fetch-noise suppression to Convex transport
Avoid dropping every "Failed to fetch" / Firefox network error globally: shouldDropPosthogEvent and shouldDropSentryEvent apply these substrings to all client exceptions, so any real outage (bad API host, CORS/TLS misconfig, backend unreachability) will now be silently filtered out of both PostHog and Sentry instead of being observable. Please gate this suppression to known Convex transport contexts (for example by stack/origin/URL metadata) rather than a blanket message match.
Useful? React with 👍 / 👎.
|
Closing as code-owner triage. The intended network-error suppression is small, but this branch is stale against current main: merge-tree reports an add/add conflict in convex/ai/resilienceStreamFailure.test.ts, and the branch also predates the fast-uri and Gemini thinking fixes that have now landed. Please recreate the network suppression as a clean, focused PR from current main if we still want it. |
Summary
Triaged the top 50 active PostHog issues (last 30 days) for project Roni / 360337. The vast majority were already covered by the deployed
posthogBeforeSendfilter (commit 5b397e7, 2026-05-04) but show up in PostHog because the filter only stops new events; it does not auto-resolve historical issues. The only post-deploy noise still slipping through was unactionable browser-network failures originating from Convex transport on flaky user connections.This PR closes that gap by extending both
posthogBeforeSendandsentryBeforeSendto suppressFailed to fetch(Chromium/Safari) andNetworkError when attempting to fetch resource(Firefox). These TypeErrors are thrown by the browser'sfetch()implementation when it cannot reach the server (offline, DNS, TLS, connection drop) — they originate before any application code runs. Convex transport already auto-reconnects with a UI indicator, so they are not actionable application bugs.Fixes in this PR
src/lib/posthogBeforeSend.ts+src/lib/sentryBeforeSend.tsNetworkError when attempting to fetch resourceto suppression listsFailed to fetchto suppression listsTest plan
npx vitest run src/lib/posthogBeforeSend.test.ts src/lib/sentryBeforeSend.test.ts— 50 passednpm test— 1673 passed / 13 skippednpx tsc --noEmit— cleannpm run lint— cleandrops Firefox NetworkError fetch failures (Convex transport offline)anddrops Chromium/Safari Failed to fetch transport failuresin both filter test files.Auto-resolved by deployed filter (no code change)
The following issues are already suppressed by the existing
posthogBeforeSend/sentryBeforeSendfilters but were never marked resolved. They will be closed in PostHog after merge per the task's Step 9. Theirlast_seentimestamps all predate the filter deploy on 2026-05-04, confirming the deployed filter is working.function call turn comes immediately after,exceeded your current quota[CONVEX A(chat:createThreadWithMessage)] Server ErrorFailed after 3 attempts. ... quota / high demandexceeded your current quota,model is currently experiencing high demandexceeded your current quotamodel is currently experiencing high demandcredits are depletedScript error.runtime.sendMessageInvalid call to runtime.sendMessagen.standardSelectorsn.standardSelectorsResizeObserver loopResizeObserver loop__firefox__.reader/__firefox____firefox__.readerAll of the above are also listed in
sentryBeforeSend.tswith the same suppression strings, so they will not generate further events.Skipped
Server Errorwith no context (019dc294, 019dc297, 019d9197-ad8e) — 3 / 1 / 1 occurrences. Below the auto-skip threshold (<5 occ AND <2 users); diagnosis not actionable without more context.<5 occ AND <2 usersper the task's auto-skip rule.Deferred — needs human input
None.
Dropped after failed verification
None. Single change passed type-check, lint, and full test suite on first run.
Constraints honored
any, no weakened types.--no-verifyor hook bypasses.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests