feat(ENG-12551): add polling mechanism#131
Merged
adefreitas merged 4 commits intoStackOneHQ:mainfrom Apr 15, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a connection-attempt polling flow to the Integration Picker’s OAuth path so the hub can detect completion/cancellation even when popup messaging is unreliable.
Changes:
- Add API helpers for creating/polling/cancelling
connection_attempts. - Update
useIntegrationPickerto create an attempt, poll for status, and expose a cancel action. - Extend loading UI to optionally show a delayed “Cancel and start over” action.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
vite.config.ts |
Adjusts dev server port and adds COOP header configuration. |
src/shared/components/loading.tsx |
Adds optional cancel callback with an 8s delayed cancel prompt. |
src/modules/integration-picker/queries.ts |
Adds create/poll/cancel connection attempt request helpers and types. |
src/modules/integration-picker/hooks/useIntegrationPicker.ts |
Implements connection attempt creation, polling loop, teardown, and cancel handler. |
src/modules/integration-picker/components/views/LoadingView.tsx |
Passes optional onCancel through to Loading. |
src/modules/integration-picker/components/IntegrationPickerContent.tsx |
Wires onCancelOAuth into the loading view. |
src/modules/integration-picker/IntegrationPicker.tsx |
Exposes handleCancelOAuth from the hook down into content. |
dev/main.tsx |
Modifies dev demo integrationId initialization. |
dev/SuspenseMRE.tsx |
Updates hook dependency arrays and adds a React import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…back - Extract startPolling and startPopupWatcher into standalone callbacks - Replace setInterval with self-scheduling setTimeout to prevent overlap - Use debugRef to avoid stale debug closure in all callbacks - Clean up server-side attempt when popup is blocked - Cancel leaked attempt on popup block Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Flatten startPopupWatcher nesting with early returns - Fix SuspenseMRE lint: remove unused React import, remove unnecessary setConnectState deps - Cancel leaked server-side attempt on popup block Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 by cubic
Add server-driven OAuth polling to complete connections in cross-origin embeds where COOP breaks
window.opener. This meets ENG-12551 by removing reliance on cross-origin messaging and improving reliability.New Features
/connect_sessions/connection_attempts; includeconnection_attempt_idin the OAuth URL; poll every 2s and handle authenticated/error/cancelled/expired.Refactors
startPollingandstartPopupWatcher; switch to self-schedulingsetTimeoutto avoid overlap; usedebugRefto prevent stale closures; flatten popup watcher with early returns; clean up and cancel server attempts when the popup is blocked or closed.cross-origin-opener-policy: same-originand change port to 3000.onCancelOAuththroughIntegrationPicker→ content → loading component; remove defaultintegrationIdin dev for cleaner testing.Written for commit 2541138. Summary will update on new commits.