Skip to content

fix(mobile): open long sign-in links, and offer Copy link where the phone can't - #51303

Merged
AmoabaKelvin merged 5 commits into
mainfrom
mu-connector-signin-48342
Nov 28, 2026
Merged

AmoabaKelvin merged 5 commits into
mainfrom
mu-connector-signin-48342

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

On the phone, adding some apps to an agent (PostHog, for one) showed an "Open sign-in page" button that did nothing when tapped. The phone app limits how long a web address it will open, and PostHog's sign-in address is longer than that limit. Phones on the next app build open these long addresses. Phones on today's build show "Copy link" instead, so you can paste the address into your browser and finish signing in.

Files Added Deleted Net
Test 0 0 0 0
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​191 $\color{#cf222e}{\Huge{\mathbf{−}}}$​40 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​151

What Changed

  • Before: Agent › Connectors › Add › PostHog › Sign in › "Open sign-in page" did nothing, and so did "Open page again". The page logged a warning and nothing else happened.
  • After, on phones with the next store build: the sign-in page opens in the phone's browser like every other app's.
  • After, on phones with today's store build: when the link is too long for the installed app, the Open row becomes "Copy link" (it shows "Copied" once the link is on the clipboard), with the footer "Paste it into your browser to sign in." The same sign-in attempt continues, so pasting the address you land on into Orca still finishes it. This applies on the agent's tool sign-in page, on the tool-added card in an agent's chat, and on the MCP servers sign-in sheet.

Mechanism:

  • BRIDGE_MAX_EXTERNAL_LINK_CHARS is now 16 KiB and no longer reuses the route href cap (2048). The bridge frame limit is 640 KiB.
  • New shells advertise an externalLinkLong capability in BRIDGE_SHELL_GRANTS. The page reads it at init (bridgeExternalLinkMaxChars) and publishes that limit with its link opener, so canOpenExternalLink/openExternalLink and the externalLink notify never send a shell a link longer than it accepts. readBridgeExternalLinkUrl now requires the limit, so no page caller can fall back to the larger cap by accident.
  • The shared tool sign-in hook (usePhoneToolSignIn) gets useSignInLinkCopy. It returns whether the attempt's page can open on this phone, plus a clipboard copy whose result is tied to that attempt's link.
  • /h/[hostId]/mcp declares native.clipboard.write as optional. On a shell without it, Copy link reports that it couldn't copy.

Long links opening directly needs a store build of Orca Mobile. Until then the page falls back to Copy link on installed phones.

Why

Root cause: the page-to-shell bridge capped external links at the route href's 2048 characters. That limit was set when the bridge first let pages hand links to the device ("bounded by the route href cap"). It was borrowed from navigation, never sized for real links. MCP sign-in asks for every scope a server lists, as the MCP spec says, and PostHog's scope list alone is 2,927 characters, so its authorize URL is 3,594. The page refused the link with a console warning and the sign-in page ignored the refusal. Installed shells enforce the same 2048 at the frame, so a page-only change would still do nothing on today's phones.

Of the 16 catalog apps I measured, only PostHog is over the limit today (Atlassian is next at 1,585). Any provider with a long scope list hits it, though, and so does a URL from Add by URL.

Alternatives considered:

  • Shorten on the host. The phone's browser can't reach the computer's address, and there is no short-link service to use.
  • Request fewer scopes. The URL follows the spec, and the bug is the limit, not the URL.
  • Hide the button with "Update Orca Mobile". This would leave everyone on today's build unable to sign in until the next store build ships.
  • A capability token instead of a numeric init field. A token follows the existing externalNavigation precedent and needs no new init field.

Linked Issue

Fixes #48342

Visual Proof

Flow: Agent › Connectors › PostHog › Sign in. Simulator captures are an iOS 27 simulator paired with a dev desktop built from this branch.

Before (main): tapping "Open sign-in page" or "Open page again" opens nothing; the phone stays on this screen.

(screenshot removed: contained real product data)

After, on today's store build (light, then after Copy link). While the link has to be copied, step 1 reads "Copy the link below and open it in your browser."; normal shells keep "Sign in to {app} and allow access.":

(screenshot removed: contained real product data)
(screenshot removed: contained real product data)

Same, dark:

(screenshot removed: contained real product data)
(screenshot removed: contained real product data)

The chat's tool-added card on today's store build (Copy link, then Copied):

(screenshot removed: contained real product data)
(screenshot removed: contained real product data)

The sign-in page and card shots above are the real components and hook rendered in Chromium at phone width with a scripted host (a 2,758-character link at today's store-app limit); the card needs a live bot agent turn to appear in a real chat. The other shots are from the simulator.

The copied link pasted into Safari opens PostHog's real sign-in page:

(screenshot removed: contained real product data)

After, with this branch's shell (the next store build): "Open sign-in page" opens PostHog directly. The sign-in screen itself looks the same as before.

(screenshot removed: contained real product data)

Testing

  • Reproduced on fresh main in an iOS simulator against a hidden dev desktop. Both "Open sign-in page" and "Open page again" opened nothing for PostHog. Vercel opened Safari as expected.

  • With this branch's page on today's store shell (0.0.71), Copy link appeared and showed Copied, and the link pasted into Safari loaded PostHog's sign-in.

  • After the step 1 copy change, rendered the real sign-in page and tool-added card (with their hook) in Chromium against a scripted host: Copy link and Copied in light and dark.

  • With this branch's shell (its JS swapped into the installed app), "Open sign-in page" opened PostHog directly in Safari.

  • Measured the authorize URL length for each catalog app through bots.tools.signIn.start on the dev host.

  • pnpm check:changed, mobile typecheck, and the focused tests that load changed modules pass.

  • Not run: Android. The fallback and the link limit are shared TypeScript, used the same way by both shells.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

No test added. The fix is a negotiated limit plus UI fallback, proven end to end on a device. A unit test would only pin the constant.

Performance

None, because the only new work is one memoized URL parse when a sign-in attempt's link changes, plus one clipboard write per Copy link tap. There are no timers, subscriptions or new requests, and an idle tool card does nothing. Init frames carry one extra capability name (about 19 bytes).

Risk

Level: Low

The riskiest part is the bridge limit across mixed versions:

  • New page on an old shell: the old shell doesn't advertise the token, so the page keeps the 2048 limit and offers Copy link.
  • Old page on a new shell: the old page still enforces 2048 itself.
  • New page on a new shell: every shell-side check (notify envelope, native.link.open params, host notify) accepts up to 16 KiB.

If something goes wrong, long links on new shells could still be refused, and users would see Copy link or the old dead button. A plain revert undoes everything; nothing is persisted.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Security: the scheme allowlist (https/http/mailto) is unchanged, and the limit is checked before and after URL normalization. Copy happens only when the user taps it.
  • Needs a store build for long links to open directly; installed phones get Copy link until then.
  • Follow-up: other link openers (Composio, Slack install, the chat MCP tray) also ignore a refused open. Their URLs are short today, so they're left out of this PR.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The bridge now applies grant-based external-link length limits when it validates and opens URLs. Mobile sign-in interfaces offer a copy-link option and browser instructions when a link cannot open in the app. The MCP route adds optional clipboard-write permission.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 3bb1f

Long connector sign-in links now open directly on shells that support them. Older shells show a Copy link option with browser instructions. No unresolved merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main parts of the change: long sign-in links now open on mobile, and a Copy link fallback appears where the phone cannot open them. The changeset matches both parts, including …
Linked Issues check Passed Issue #48342 reports that the mobile connector sign-in button does nothing and asks for a way to reach the sign-in page in the mobile browser. The supplied evidence shows two parts addressed. (1) Root…
Out of Scope Changes check Passed Every changed file in the supplied summary ties to the sign-in link objective of #48342. Bridge limit and grant files (bridge-caps.ts, bridge-frame-fields.ts, bridge-client-notifications.ts, bridge-ho…
Description check Passed The description covers most required sections. It has an ELI5, a detailed What Changed section with before and after behavior, a Why section with root cause and alternatives, a linked issue (Fixes #48…
Full details: Title check

Explanation

The title names the two main parts of the change: long sign-in links now open on mobile, and a Copy link fallback appears where the phone cannot open them. The changeset matches both parts, including the 16 KiB external-link limit, the externalLinkLong capability, and the useSignInLinkCopy hook. The title uses the conventional fix(mobile) prefix and is 79 characters, which is within a normal title length.

Full details: Linked Issues check

Explanation

Issue #48342 reports that the mobile connector sign-in button does nothing and asks for a way to reach the sign-in page in the mobile browser. The supplied evidence shows two parts addressed. (1) Root cause: the page-to-shell bridge capped external links at the route href limit of 2048 characters. bridge-caps.ts now sets BRIDGE_MAX_EXTERNAL_LINK_CHARS to 16,384, keeps the old value as BRIDGE_LEGACY_EXTERNAL_LINK_CHARS, and requires maxChars in readBridgeExternalLinkUrl. bridge-frame-fields.ts advertises the externalLinkLong grant and bridgeExternalLinkMaxChars, and web-entry/index.tsx passes that limit to publishExternalLinkOpener. (2) Installed shells that refuse long links: use-sign-in-link-copy.ts, usePhoneToolSignIn, MobileBotToolSignInPage.tsx, and MobileBotToolAddedCard.tsx replace the dead Open row with Copy link, a Copied state, and a paste instruction. This gives a working route to the sign-in page in the phone browser. mobile-web-page-routes.mjs declares native.clipboard.write as optional for /h/[hostId]/mcp, and copy reports failure without that grant. No automated tests were added. The issue does not request tests, so this does not fail the assessment. Unresolved uncertainty: the supplied summaries do not give the value of the native cancelled-navigation URL limit (maxCancelledNavigationUrlCharacters in the iOS and Android policy files). The Swift comment describes it as a tighter bound. The 16 KiB direct-open path on new native shells therefore rests on the PR's device test report, not on source evidence in the summary. The incremental diff from the previous reviewed head could not be read, so this assessment relies on the whole-PR summary and the prior assessment.

Full details: Out of Scope Changes check

Explanation

Every changed file in the supplied summary ties to the sign-in link objective of #48342. Bridge limit and grant files (bridge-caps.ts, bridge-frame-fields.ts, bridge-client-notifications.ts, bridge-host-notify.ts, cancelled-navigation-target.ts, native-link-open-verb.ts, external-link.web.ts, web-entry/index.tsx) carry the longer limit and its negotiation. Sign-in UI files (MobileBotToolSignInPage.tsx, MobileBotToolAddedCard.tsx, use-bot-tool-phone-sign-in.ts, use-sign-in-link-copy.ts) provide the copy fallback. en.json adds matching strings. mobile-web-page-routes.mjs adds the optional clipboard grant that the copy path needs. The Android and iOS navigation policy files change only comments. None of the changes address unrelated behavior. Other link openers (Composio, Slack install, chat MCP tray) are deferred to follow-up and are not in this PR.

Full details: Description check

Explanation

The description covers most required sections. It has an ELI5, a detailed What Changed section with before and after behavior, a Why section with root cause and alternatives, a linked issue (Fixes #48342), Visual Proof with screenshots, Testing steps with checked boxes, a Performance line, a Risk section with level and revert plan, and a Checklist. Gaps: the AI Disclosure, Review, and Agent skill sections are empty or only partly filled. The Performance line starts with 'None, because' and gives a reason, so it is acceptable. The Testing section also says that no automated test was added and gives a reason, which is acceptable. The description is substantive and matches the change, so it passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5db4c145-20b5-4b76-84f0-790a0512e3b0
Commits

Reviewing files that changed from the base of the PR and between f7058d2 and 3bb1f26.

Files selected for processing: 2

  • mobile/src/bots/tools/MobileBotToolSignInPage.tsx
  • mobile/src/i18n/locales/en.json
Files skipped from review as they are similar to previous changes: 1

  • mobile/src/i18n/locales/en.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

…hone can't

The page-to-shell bridge capped external links at the route href's 2048
characters, so an OAuth page with a long scope list (PostHog's is 3594)
was refused with only a console warning: Open sign-in page did nothing.
Links now go up to 16 KiB on shells that advertise externalLinkLong;
on older shells the sign-in shows Copy link for the same attempt.
@AmoabaKelvin
AmoabaKelvin force-pushed the mu-connector-signin-48342 branch from f7058d2 to 3bb1f26 Compare November 28, 2026 03:07
@AmoabaKelvin
AmoabaKelvin merged commit bbb8fe8 into main Nov 28, 2026
59 checks passed
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.

[Bug] Unable to open Connector URLs on Mobile

1 participant