Skip to content

fix(mobile): surface failed browser launches in the PR review connect gate - #6360

Draft
iscekic wants to merge 3 commits into
mainfrom
kwf/explorer-github-connect-browser-the-github-connect-browse-6703f-d9bc
Draft

iscekic wants to merge 3 commits into
mainfrom
kwf/explorer-github-connect-browser-the-github-connect-browse-6703f-d9bc

Conversation

@iscekic

@iscekic iscekic commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Changelog for users

  • Tapping a connect control when the device cannot open a browser now shows a retryable "Could not open browser. Please try again." message.
  • The connect control stays on the gate and becomes tappable again after a failed launch, so the user can retry.
  • The same behavior applies to the GitHub, GitLab, and Bitbucket connect controls.

Changelog for maintainers

  • Both PR-review connect-gate arms now launch through launchConnectGateBrowser in apps/mobile/src/lib/pr-review/connect-gate-platform.ts, which owns the launch-sentinel lifecycle.
  • A rejected launch clears the sentinel and calls onOpenFailure instead of returning silently; each arm toasts the retryable authErrors.couldNotOpenBrowser copy and re-enables the CTA.
  • iOS sheet-close clears the sentinel and runs the caller's refetch; Android success leaves the sentinel armed for the AppState foreground refetch.
  • The helper never rejects on a launch failure, so onSheetClose errors are the only rejections that reach the caller.
  • The change reuses the existing authErrors.couldNotOpenBrowser key; the English catalog is unchanged and check:i18n is unaffected.
  • Review first the sentinel lifecycle: Android success must stay armed, every failure path must clear it, and iOS sheet-close must refetch.
  • Tests cover the three launch outcomes in connect-gate-platform.test.ts and the failed-launch toast from the rendered Connect button in pr-review-connect-gate-view.test.ts.
  • The captured blank view was the browser failing to open; this change reports that failure and does not add browser UI.

E2E proof

Owner request

Explorer finding: github-connect-browser: The GitHub connect browser view is a blank white page with no sign-in UI, content or progress indicator, so the repository-connect screen never appears.

The user-agent explorer found this while using the app like a user.
One finding per item; the explorer never edits product code.

Flow: github-connect-browser
Found on revision: 59ef790

Repro:

  1. set this state first: true first run (app data wiped) signed in as brand-new e2e-firstrun-1789801978@example.com with $10 credits, 3 seeded Code Reviewer pull requests, membership in a second organization; no GitHub/GitLab linked, no repositories, no sessions; device portrait, system day mode.
  2. open the app on emulator-5554
  3. reach the screen the capture names (github-connect-browser)
  4. the capture shows the defect named below

Observed: The GitHub connect browser view is a blank white page with no sign-in UI, content or progress indicator, so the repository-connect screen never appears.
Expected: the screen renders without this defect

Evidence (from the device run):

Open findings (not fixed here)

  • [e1] Observed: The GitHub connect browser view is a blank white page with no sign-in UI, content or progress indicator, so the repository-connect screen never appears. Expected: the screen renders without this defect
  • [e1] GitHub connect browser renders (github-connect-browser): android emulator-5554: from the PR Review GitHub connect gate (fresh worktree account with no GitHub user token) the recorded scene tapped Connect GitHub and the post-tap digest is unchanged, still 'android.widget.Button Connect GitHub ta
  • not fully verified: some optional checks did not run
  • not proved live: github-connect-browser.png is no longer on the host that took it, so no publish can carry it
  • the '## E2E proof' section carries no log excerpt, so nothing shows the change was driven end to end

@iscekic
iscekic marked this pull request as draft September 19, 2026 10:45
Comment thread apps/mobile/src/components/pr-review/pr-review-connect-gate.tsx Outdated
@kilo-code-bot

kilo-code-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

The new shared launcher owns an Android AppState listener that has no cancellation path, so a caller that unmounts while the browser is open leaves the subscription and pending closures registered until the next foreground.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
apps/mobile/src/lib/pr-review/connect-gate-platform.ts 38 Android AppState subscription has no cancellation path; an unmounted caller leaves the listener and pending onReturn closures registered until the next foreground.
Files Reviewed (16 files)
  • apps/mobile/src/lib/pr-review/connect-gate-platform.ts - 1 issue
  • apps/mobile/src/lib/pr-review/connect-gate-platform.test.ts
  • apps/mobile/src/components/pr-review/pr-review-connect-gate.tsx
  • apps/mobile/src/components/pr-review/pr-review-connect-gate-view.mounted.test.tsx
  • apps/mobile/src/components/pr-review/pr-review-connect-gate-view.test.ts (deleted)
  • apps/mobile/src/components/code-reviewer/provider-connect-card.tsx
  • apps/mobile/src/components/security-agent/security-agent-setup.tsx
  • apps/mobile/src/components/security-agent/security-agent-setup.mounted.test.tsx
  • apps/mobile/src/lib/use-github-repos-refresh.ts
  • apps/mobile/src/lib/use-github-repos-refresh-helpers.ts
  • apps/mobile/src/lib/use-github-repos-refresh.test.ts
  • apps/mobile/src/lib/use-new-session-repos.ts
  • apps/mobile/src/lib/use-new-session-repos.test.ts
  • apps/mobile/src/lib/external-auth/use-external-auth-return.ts (deleted)
  • apps/mobile/src/lib/auth/passkey-client.test.ts
  • apps/mobile/src/lib/case-guard.test.ts

Fix these issues in Kilo Cloud

Previous Review Summary (commit 58585ff)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 58585ff)

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

A provider-gate refetch rejection can now become an unhandled promise rejection after the local catch was removed in favor of the new launchConnectGateBrowser helper.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/mobile/src/components/pr-review/pr-review-connect-gate.tsx 288 ProviderConnectGate lost its catch, so a rejected status.refetch() (or any helper rejection) escapes void handleConnect() as an unhandled rejection.
Files Reviewed (4 files)
  • apps/mobile/src/lib/pr-review/connect-gate-platform.ts - 0 issues
  • apps/mobile/src/lib/pr-review/connect-gate-platform.test.ts - 0 issues
  • apps/mobile/src/components/pr-review/pr-review-connect-gate.tsx - 1 issue
  • apps/mobile/src/components/pr-review/pr-review-connect-gate-view.test.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

@iscekic
iscekic force-pushed the kwf/explorer-github-connect-browser-the-github-connect-browse-6703f-d9bc branch from 58585ff to 8a053d8 Compare September 19, 2026 11:15
@iscekic

iscekic commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator Author

bot: Cross-platform fix. Pushed da7a249 (kwf kwf-fix-platform-c27d).

What changed:

  • openAuthorizationAndWaitForReturn and launchConnectGateBrowser no longer take a platform; one shared helper owns the only platform branch.
  • Android keeps the single branch because it lacks a native auth-session completion callback; a code comment names that gap and the stuck polyfill state (KILO-APP-22) behind it.
  • The launch sentinel and the useExternalAuthReturn hook are removed; each caller now awaits the launch, then runs its own refresh.
  • iOS refreshes when the native auth session resolves; Android refreshes when the app returns to the foreground.
  • A failed launch is reported through onOpenFailure and never rejects; refetch errors still propagate to the caller.
  • Android drops the foreground listener when the browser fails to open, so a retry is not left with a stale listener.
  • Affected flows: provider connect card, security-agent setup, both PR-review connect gates, GitHub repo refresh, and the new-session GitLab and Bitbucket connect flows.
  • Tests cover the shared launch contract on both platforms; review the Android listener teardown and retry path first.

@iscekic
iscekic force-pushed the kwf/explorer-github-connect-browser-the-github-connect-browse-6703f-d9bc branch from 2f914b9 to c8d287b Compare September 19, 2026 15:09
@iscekic
iscekic marked this pull request as ready for review September 19, 2026 15:23
Comment thread apps/mobile/src/lib/pr-review/connect-gate-platform.ts Outdated
@iscekic
iscekic marked this pull request as draft September 19, 2026 16:00
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