fix(api): emit disconnected directly from didCompleteWithError to trigger auto-retry - #4222
Open
thisisabhash wants to merge 7 commits into
Open
fix(api): emit disconnected directly from didCompleteWithError to trigger auto-retry#4222thisisabhash wants to merge 7 commits into
thisisabhash wants to merge 7 commits into
Conversation
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
had a problem deploying
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Error
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 11, 2026 22:09 — with
GitHub Actions
Inactive
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4222 +/- ##
==========================================
+ Coverage 66.72% 66.87% +0.14%
==========================================
Files 1151 1151
Lines 43817 43796 -21
==========================================
+ Hits 29239 29289 +50
+ Misses 14578 14507 -71
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
thisisabhash
temporarily deployed
to
IntegrationTest
May 19, 2026 20:30 — with
GitHub Actions
Inactive
thisisabhash
temporarily deployed
to
IntegrationTest
May 19, 2026 20:30 — with
GitHub Actions
Inactive
jvh-aws
previously approved these changes
Jun 1, 2026
jvh-aws
left a comment
Contributor
There was a problem hiding this comment.
nit: can we run swiftformat?
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.
Issue #
#4220
Description
fix(api): emit disconnected directly from didCompleteWithError to trigger auto-retry
Summary
Fixes #4220. Resolves GraphQL subscriptions getting permanently stuck in
connectingstate after repeated iOS background/foreground transitions.Problem
When iOS suspends the app process, the kernel defuncts TCP flows bound to the WebSocket connection. On foreground return,
didCompleteWithErrorfires withNSPOSIXErrorDomain Code=53 "Software caused connection abort". The old code handled this by callingnetworkMonitor.updateState(.offline), expectingNWPathMonitorto later fire.onlineto trigger reconnection. ButNWPathMonitoronly fires on path changes — if the network path never actually changed (the socket just died from process suspension), no.onlineevent arrives and the client stays dead permanently.Root Cause
Reconnection after connection abort depends on
NWPathMonitorfiring.online:This pushes
.offlineto the network monitor scan, but reconnection only happens whenNWPathMonitorfires.onlineto produce(.offline, .online). If the network path never changed (process suspension doesn't change the network path), no.onlinearrives and the client is permanently stuck.Fix
File:
WebSocketClient.swiftInstead of going through the network monitor, directly cancel the stale connection and emit
.disconnected(.invalid, nil). This triggers the existing auto-retry mechanism (retryOnCloseCode(.invalid)) which creates a new connection — no dependency onNWPathMonitor.Verification
Unit test —
AWSPluginsCoreTests/WebSocketClientTests(1 new test)testWebSocketClient_whenConnectionAborts_shouldEmitDisconnectedAndReconnect.disconnectedand auto-retry reconnectsTest plan