fix(integrations): send a single notification when a token refresh fails#1678
Open
giladresisi wants to merge 1 commit into
Open
fix(integrations): send a single notification when a token refresh fails#1678giladresisi wants to merge 1 commit into
giladresisi wants to merge 1 commit into
Conversation
When a token refresh fails, refreshProcess sent the refresh-error notification (with the failure cause) and then called disconnectChannel, which sends the same notification again without the cause. Every failed refresh therefore emailed the user twice: once titled "Could not refresh your <provider> channel <cause>" and once "Could not refresh your <provider> channel". Drop the disconnectChannel call from the failure branch: the refreshNeeded call two lines earlier already sets the same flag disconnectChannel would, so the only thing it added was the duplicate email. disconnectChannel itself is unchanged for its other callers. Reproduced by triggering a post on an Instagram channel holding an invalid token (refresh fails since the provider cannot refresh) — two emails arrived for the single failure. After the fix, the same scenario produces exactly one email (the one including the failure cause), and the channel is still flagged as needing reconnection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Contribution-checker quality warning Heuristics that flagged:
If this is a genuine contribution, please add detail to your PR description and tighten the diff scope before reviewers look at it. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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
Every failed token refresh notifies (in-app + email) the user twice:
refreshProcess(refresh.integration.service.ts) callsinformAboutRefreshErrorwith the failure cause — email titledCould not refresh your <provider> channel <cause>.integrationService.disconnectChannel, which internally callsinformAboutRefreshErroragain, without the cause — a second email titledCould not refresh your <provider> channel.The
disconnectChannelcall contributes nothing else in this path: therefreshNeededcall two lines earlier already sets the exact samerefreshNeeded: trueflag thatdisconnectChannel's repository call sets.Fix
Remove the
disconnectChannelcall fromrefreshProcess's failure branch. The user still gets exactly one notification — the informative one that includes the failure cause — and the channel is still flagged as needing reconnection.disconnectChannelitself is untouched, so its other callers (analytics token-expiry path, public API, chat tool) keep their existing notify-on-disconnect behavior.Repro & validation
🤖 Generated with Claude Code