Skip to content

Fix GitHub device flow failing when app returns from background#103

Merged
mcintyre94 merged 1 commit intomainfrom
fix-github-poll-network-error
Mar 17, 2026
Merged

Fix GitHub device flow failing when app returns from background#103
mcintyre94 merged 1 commit intomainfrom
fix-github-poll-network-error

Conversation

@mcintyre94
Copy link
Copy Markdown
Owner

@mcintyre94 mcintyre94 commented Mar 17, 2026

Summary

  • When the user switches to Safari to authorize on GitHub and returns to the app, iOS drops the URLSession TCP connection during suspension
  • This caused the polling loop to throw URLError.networkConnectionLost (-1005), which was surfaced as "The network connection was lost" and killed the flow
  • Fix: catch transient URLErrors (.networkConnectionLost, .notConnectedToInternet, .timedOut) inside the polling loop and continue to the next interval instead of throwing

Test plan

  • Start GitHub device flow (Settings → Connect GitHub)
  • Tap "Copy Code & Open GitHub" to leave the app
  • Authorize on GitHub in Safari
  • Switch back to Wisp — connection should complete successfully with no error

🤖 Generated with Claude Code

URLSession raises networkConnectionLost when a request fires immediately
after app resume. Catch transient URLErrors (networkConnectionLost,
notConnectedToInternet, timedOut) in the polling loop and retry rather
than surfacing them as fatal errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mcintyre94 mcintyre94 enabled auto-merge March 17, 2026 19:48
@mcintyre94 mcintyre94 merged commit 8ce1cba into main Mar 17, 2026
2 checks passed
@mcintyre94 mcintyre94 deleted the fix-github-poll-network-error branch March 17, 2026 19:53
@claude
Copy link
Copy Markdown

claude bot commented Mar 17, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant