fix(bluesky): don't disconnect the channel when Bluesky login fails with a 5xx - #2003
Open
giladresisi wants to merge 1 commit into
Open
fix(bluesky): don't disconnect the channel when Bluesky login fails with a 5xx#2003giladresisi wants to merge 1 commit into
giladresisi wants to merge 1 commit into
Conversation
getAgent wrapped every agent.login error as RefreshToken, so a transient 5xx from Bluesky (seen in prod as a 502 UpstreamFailure from its load balancer) flagged the channel as needing reconnection and failed the following posts with "Refresh channel needed". Only a definite 4xx (excluding 429) now does that; other errors propagate and take the existing transient retry paths. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PyDRJpL27E7WCK5UGsUope
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
10 tasks
✅ 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.
What kind of change does this PR introduce?
Bug fix (Bluesky provider).
getAgentin bluesky.provider.ts wrapped everyagent.loginerror asRefreshToken, so any failure to create a session marked the channel as needing reconnection. It now only does that for a definite 4xx (excluding 429): bad password, account taken down. 5xx, 429 and network errors propagate as-is and take the existing transient paths (activity retry in postPending, the prep-failure retry loop in finalizePost). Nothing changes for real credential failures.Why was this change needed?
On 2026-08-26 a customer's Bluesky channel was disconnected because Bluesky's load balancer answered the createSession call with a 502
UpstreamFailure. The channel's credentials were fine, but the next four scheduled posts failed with "Refresh channel needed" until the customer re-entered the credentials. A transient outage on Bluesky's side should not require user action. In production all other Bluesky refresh_token errors in August were genuine 401s (AuthenticationRequired,AccountTakedown), which keep the same behavior.Other information:
Same status-gating pattern the file already uses for the
agent.postcall. Companion fix for the reconnect click on custom-fields channels: #2004.QA
serviceat a local stub that returns 502 for/xrpc/com.atproto.server.createSession, schedule a postrefreshNeeded; the post retries and eventually fails as a normal post error{"error":"AuthenticationRequired"}, schedule another postVerified with a ts-node harness driving
getAgentagainst a local stub for 502, 503, 429, connection refused (all propagate raw) and 401 AuthenticationRequired, 401 AccountTakedown, 400 (all become RefreshToken).Checklist:
Put a "X" in the boxes below to indicate you have followed the checklist;