René's URL Explorer Experiment


Title: fix(mship): return the chat connect flow to the tab that started it by j15z · Pull Request #6403 · simstudioai/sim · GitHub

Open Graph Title: fix(mship): return the chat connect flow to the tab that started it by j15z · Pull Request #6403 · simstudioai/sim

X Title: fix(mship): return the chat connect flow to the tab that started it by j15z · Pull Request #6403 · simstudioai/sim

Description: Summary Chat credential connects now run in a popup that returns through a new self-closing /oauth/chat-complete page, so the chat tab updates in place instead of the flow landing on a duplicate copy of the app in a new tab The connect verdict now comes from the server routing the flow to its success callback, not from diffing the workspace credential list — that diff reported failure whenever you re-authorized an account you had already linked, since that path updates the account row and creates no new credential The row's connected lock is stricter than its label: a swallowed credential-draft failure leaves the row retryable instead of latching it shut with nothing behind it The popup is named per attempt, so sibling credential rows can't renavigate each other's window A cross-origin connect URL stays on the anchor (keeping rel="noopener") instead of taking the popup path The focus verifier reads the attempt after its refetch, so a verdict published mid-flight isn't overwritten, and it treats a popup parked on /oauth-error or the workspace error exit as finished rather than waiting on it Desktop Unaffected — the desktop app never reaches the popup path. Desktop can't run OAuth in an embedded window: Better Auth binds the flow's state to the initiating browser's cookies, the Sim browser panel's partition isn't signed in to Sim, and Google/Microsoft reject embedded user agents outright. So the chip hands the whole flow to the system browser through the desktop bridge (beginOAuthConnect), which opens /desktop/connect, runs the authorize route there, and bounces /desktop/connect/complete to the app's 127.0.0.1 loopback. The app refocuses itself and refreshes credentials off that push. Why this PR can't touch it: onConnectClick takes the bridge branch and returns before buildOAuthChatCompleteAuthorizeUrl or window.open is ever called, so popupRef is never set on desktop. Every guard added here keys off that ref — isPopupStillOpen(null) exits on its first line — which makes the terminal-path check and the per-attempt popup naming unreachable. Completion still arrives through useDesktopOAuthConnectListener in use-oauth-return.ts, untouched by this PR, and desktop keeps its own attempt correlation via setActiveDesktopOAuthChatAttempt / resolveDesktopOAuthChatAttempt. Type of Change Bug fix Testing Tested manually. bun run lint, check:audits (22 audits), check:api-validation, and type-check all pass. 173 test files / 1800 tests green, including new coverage for the close-refused redirect and its cross-origin returnTo rejection, the per-attempt popup name, the terminal-page settle, and the retryable-lock behavior. Not verified in a real browser: whether COOP: same-origin on /oauth/chat-complete ever refuses window.close(). It closed fine in manual testing; the 400ms redirect is the fallback if it doesn't. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary Chat credential connects now run in a popup that returns through a new self-closing /oauth/chat-complete page, so the chat tab updates in place instead of the flow landing on a duplicate c...

X Description: Summary Chat credential connects now run in a popup that returns through a new self-closing /oauth/chat-complete page, so the chat tab updates in place instead of the flow landing on a duplicate c...

Opengraph URL: https://github.com/simstudioai/sim/pull/6403

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:48329d67-dc7f-f995-8802-ec4cf6964c55
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE460:7D93E:971040:CF4FC8:6AFB4C03
html-safe-nonce09d8a201c96dd8a79a514a1d056db61405eec20f3041153b42816d447aad952c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDYwOjdEOTNFOjk3MTA0MDpDRjRGQzg6NkFGQjRDMDMiLCJ2aXNpdG9yX2lkIjoiNDc1NTM0OTUxNTE3NzUxMTkzOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac0d2fa2eca7a5dd2e9255170bd8b3101dd8e99e6b6ff58e49d509c5c3eb5137c7
hovercard-subject-tagpull_request:4233134711
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6403/files
twitter:imagehttps://avatars.githubusercontent.com/u/96924014?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/96924014?s=400&v=4
og:image:altSummary Chat credential connects now run in a popup that returns through a new self-closing /oauth/chat-complete page, so the chat tab updates in place instead of the flow landing on a duplicate c...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneacf7616d06cc051644705b379878c9bb13dc5e70ecf4ffd9b34140f8ac01d7e1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release26504db649b58525278f77a52b80ba5f10d5f4de
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/6403/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6403%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6403%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/6403/files
Reloadhttps://github.com/simstudioai/sim/pull/6403/files
Reloadhttps://github.com/simstudioai/sim/pull/6403/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
fix/mship-return-to-same-tabhttps://github.com/simstudioai/sim/tree/fix/mship-return-to-same-tab
Conversation 39 https://github.com/simstudioai/sim/pull/6403
Commits 10 https://github.com/simstudioai/sim/pull/6403/commits
Checks 30 https://github.com/simstudioai/sim/pull/6403/checks
Files changed https://github.com/simstudioai/sim/pull/6403/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6403/files
fix(mship): return the chat connect flow to the tab that started it https://github.com/simstudioai/sim/pull/6403/files#top
Show all changes 10 commits https://github.com/simstudioai/sim/pull/6403/files
e625525 fix(mship): return the chat connect flow to the tab that started it j15z Aug 8, 2026 https://github.com/simstudioai/sim/pull/6403/commits/e625525e241ddd80365d550ba8bd654324a960e3
58f5e88 fix(mship): settle the connect row from the popup, not from focus alone waleedlatif1 Aug 8, 2026 https://github.com/simstudioai/sim/pull/6403/commits/58f5e88eac4fef590fe21c31d7219e62388c0ec9
d173a31 fix(mship): never read a disowned popup handle as a finished flow waleedlatif1 Aug 8, 2026 https://github.com/simstudioai/sim/pull/6403/commits/d173a316c5c4220f37ccbf7c75d85f6e42ce0046
10bd7b7 fix(oauth): keep the chat connect return leg in its opener's browsing… waleedlatif1 Aug 8, 2026 https://github.com/simstudioai/sim/pull/6403/commits/10bd7b7afb9d35f85bb9b648a64d13ab84d2d73c
86b57e3 fix(oauth): keep every page an OAuth popup lands on observable to its… waleedlatif1 Aug 8, 2026 https://github.com/simstudioai/sim/pull/6403/commits/86b57e372fd07ab824eaa1b8443f54425d8423d4
656c7ba test(mship): cover the announcement surviving an early popup release waleedlatif1 Aug 8, 2026 https://github.com/simstudioai/sim/pull/6403/commits/656c7badf174eefce2da51f993b932f12b2e4a8c
5b6bfde fix(mship): bound the wait on a popup whose outcome became unobservable waleedlatif1 Aug 8, 2026 https://github.com/simstudioai/sim/pull/6403/commits/5b6bfde821967c7e2489cc6b08d0a70327a6180f
f0c87ed fix(mship): survive a remount while an attempt is still pending waleedlatif1 Aug 8, 2026 https://github.com/simstudioai/sim/pull/6403/commits/f0c87ede86a2f6343afcdabff7eb5e903a772f73
8d3c519 fix(mship): bind a settle to its own attempt and keep the deadline armed waleedlatif1 Aug 8, 2026 https://github.com/simstudioai/sim/pull/6403/commits/8d3c51905c5eabac94b3db71b7ee5a43eb6644b3
f41e66c chore(mship): tighten the comments on the OAuth popup flow waleedlatif1 Aug 8, 2026 https://github.com/simstudioai/sim/pull/6403/commits/f41e66c131e26eb6d8bdca4e21eca5094b53031a
Clear filters https://github.com/simstudioai/sim/pull/6403/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6403/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6403/files
chat-complete-handoff.test.tsx https://github.com/simstudioai/sim/pull/6403/files#diff-9eb46c2427dc7128f57ece29ddd8d2c734dc8d62980effd6b55cf3a22a55d786
chat-complete-handoff.tsx https://github.com/simstudioai/sim/pull/6403/files#diff-d76de26226da7918f4d9897e934fb71e5c5d25d59bf5a46011f861e374539663
page.tsx https://github.com/simstudioai/sim/pull/6403/files#diff-cff67bc888012a8b0bedafbb27af848b8f050e046610ca04035e566f83e5e201
special-tags.test.tsx https://github.com/simstudioai/sim/pull/6403/files#diff-a3ca9d106c042fc4fd1eedd41dbd23d27de6824293b99e0143abaf9fb96c6473
use-oauth-chip-connection.ts https://github.com/simstudioai/sim/pull/6403/files#diff-40eed2f5b4a15a7c59666188b8340e67fb2ab11e245421807d3fbe7402c46293
oauth-chat-attempt.test.ts https://github.com/simstudioai/sim/pull/6403/files#diff-4baf784cb9dfd51b094693d436dbecafb1082ce8bbce3f5be662dacfe3c8ec93
oauth-chat-attempt.ts https://github.com/simstudioai/sim/pull/6403/files#diff-c723f5984436895302c9f9d95f007ba8f4f71478d57c73843e78c70121556b8b
next.config.ts https://github.com/simstudioai/sim/pull/6403/files#diff-a2e0d564b8bf660a492f7abe431643db390b0f5696809465afc46475f552f15f
apps/sim/app/oauth/chat-complete/chat-complete-handoff.test.tsxhttps://github.com/simstudioai/sim/pull/6403/files#diff-9eb46c2427dc7128f57ece29ddd8d2c734dc8d62980effd6b55cf3a22a55d786
View file https://github.com/simstudioai/sim/blob/f41e66c131e26eb6d8bdca4e21eca5094b53031a/apps/sim/app/oauth/chat-complete/chat-complete-handoff.test.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6403/{{ revealButtonHref }}
apps/sim/app/oauth/chat-complete/chat-complete-handoff.tsxhttps://github.com/simstudioai/sim/pull/6403/files#diff-d76de26226da7918f4d9897e934fb71e5c5d25d59bf5a46011f861e374539663
View file https://github.com/simstudioai/sim/blob/f41e66c131e26eb6d8bdca4e21eca5094b53031a/apps/sim/app/oauth/chat-complete/chat-complete-handoff.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6403/{{ revealButtonHref }}
apps/sim/app/oauth/chat-complete/page.tsxhttps://github.com/simstudioai/sim/pull/6403/files#diff-cff67bc888012a8b0bedafbb27af848b8f050e046610ca04035e566f83e5e201
View file https://github.com/simstudioai/sim/blob/f41e66c131e26eb6d8bdca4e21eca5094b53031a/apps/sim/app/oauth/chat-complete/page.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6403/{{ revealButtonHref }}
Please reload this pagehttps://github.com/simstudioai/sim/pull/6403/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6403/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.