fix(ENG-12551): fix popup close not resetting state without COOP#133
Merged
adefreitas merged 2 commits intoStackOneHQ:mainfrom Apr 16, 2026
Merged
Conversation
Without COOP, closing the OAuth popup should reset to the form. Previously, active polling prevented this. Now we detect COOP by checking if the popup appears closed immediately after opening (browsers sever the window reference under same-origin COOP). Only defer to polling when COOP is actually detected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the OAuth popup lifecycle handling in the Integration Picker to avoid getting stuck in a loading state after popup close in non-COOP environments, while preserving the polling fallback behavior for COOP scenarios.
Changes:
- Add COOP detection (
coopDetectedRef) based on the popup appearing closed immediately afterwindow.open. - Update the popup-close watcher to only “ignore close” when COOP is detected and polling is active; otherwise teardown + reset state.
- Expand debug logging around popup-close handling to include COOP detection.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Requires human review: This PR modifies core business logic in the OAuth connection flow, specifically handling popup state and connection cancellation, which is a critical path requiring human review.
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.
Summary
window.open(browsers sever the reference underCross-Origin-Opener-Policy: same-origin)Context
After merging the polling mechanism (#131), closing the OAuth popup without COOP left the Hub stuck in a loading state because active polling prevented the popup-close handler from resetting. This fix restores the original behavior for non-COOP environments while preserving the polling fallback for COOP.
Test plan
🤖 Generated with Claude Code
Summary by cubic
Fixes OAuth popup close behavior by detecting COOP and only using server-side polling when COOP is active. Without COOP, closing the popup now cancels the attempt and resets the Hub to the form (per ENG-12551).
window.open.attemptIdbeforeteardownOAuthclears the ref to ensure cancellation always fires.coopDetectedRefand related logs to help debug popup and polling state.Written for commit 21fecd6. Summary will update on new commits.