fix(conversations): back off support widget polling to stop starving … - #4704
Merged
veryayskiy merged 5 commits intoSep 1, 2026
Merged
Conversation
Contributor
Replay incident risk checkThis diff touches code involved in past incidents. This is a heads-up, not a verdict: read the matched sections of INCIDENTS.md and answer their review questions before merging. For a judgment on whether this diff has the same failure mode, run the |
Contributor
Prompt To Fix All With AI### Issue 1
packages/browser/src/extensions/conversations/external/index.tsx:172-175
**Online reset retains backoff timer**
When a 429 schedules a long timeout and the browser subsequently emits `online`, `_onOnline` clears the failure streak without replacing the pending timeout, causing messages and unread state to remain stale for up to the remainder of the one-minute delay.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(conversations): back off support wid..." | Re-trigger Greptile |
Contributor
posthog-js Compliance ReportDate: 2026-09-01 07:54:02 UTC ✅ All Tests Passed!26/26 tests passed Capture Tests✅ 26/26 tests passed View Details
|
Contributor
Contributor
|
Size Change: +804 B (0%) Total Size: 20.7 MB 📦 View Changed
ℹ️ View Unchanged
|
dustinbyrne
approved these changes
Aug 31, 2026
…o-stop-starving-sends Co-authored-by: Cursor <cursoragent@cursor.com>
veryayskiy
enabled auto-merge (squash)
September 1, 2026 07:43
veryayskiy
deleted the
veryayskiy/back-off-support-widget-polling-to-stop-starving-sends
branch
September 1, 2026 07:52
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
Visitors writing in the support widget can hit "Too many requests" (429) and the message never sends. Idle widgets poll the ticket/message endpoints every 5s regardless of whether anyone opened a conversation, and those polls compete with everyone else's for the shared team budget — so page views exhaust it before a visitor can send.
This is the client-side companion to PostHog/posthog#91627, which split the server budget so polls and sends no longer share one cap. Here we cut the polling load the widget generates in the first place.
Changes
Reworked the conversations poll loop (
packages/browser/src/extensions/conversations/external/index.tsx) from a fixed 5ssetIntervalinto a self-scheduling loop whose cadence adapts:onlineevent. (We don't readRetry-After— the browser request layer doesn't surface response headers; this is a self-contained backoff.)A generation counter guards the loop so a stop-then-start (e.g. rapid open/close) while a poll is in flight can never leave two loops running, and a stray poll error can't wedge it.
Note: keeping
widget_session_idon identity requests was intentionally left out of this PR.Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
pnpm changesetto generate a changeset file