Skip to content

fix(mobile): offer Copy link in the chat's MCP sign-in when the phone can't open the page - #51525

Merged
AmoabaKelvin merged 3 commits into
mainfrom
mobile-link-open-refusals
Nov 28, 2026
Merged

AmoabaKelvin merged 3 commits into
mainfrom
mobile-link-open-refusals

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

In a phone chat, the MCP servers tray (/mcp) has a "Sign in" button for servers that need one. If the sign-in page's address was too long for the installed phone app, tapping Sign in or "Open again" did nothing. Now the tray shows "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 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​103 $\color{#cf222e}{\Huge{\mathbf{−}}}$​54 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​49

What Changed

  • Before: the tray opened the agent's MCP sign-in page and ignored a refusal. Today's store app refuses links over 2,048 characters (see fix(mobile): open long sign-in links, and offer Copy link where the phone can't #51303), so for a long one (PostHog's is about 3,600), "Sign in" and "Open again" did nothing.
  • After, on today's store app with a link that's too long:
    • Sign-ins you finish by pasting the address back: the row shows "Copy link" (then "Copied") and Cancel, with nothing that offers to open the link. The paste box is unchanged.
    • Sign-ins that finish on the provider's site: the row shows "Copy link", Done and Cancel, with "Open the copied link in your browser, finish there, then tap Done." under it. If Done is tapped too early, the message says to finish in the browser rather than "on the page that opened".
    • A failed copy shows "Couldn't copy the link."
  • Unchanged: phones on the next store build open the page directly, as with any short link, and the tray looks the same as before.

Mechanism: each server row reuses useSignInLinkCopy from #51303. That hook knows whether this phone's app can open the link and ties the copy to the sign-in attempt. McpButton moved unchanged into its own file to keep the panel under the line cap.

Why

#51303 fixed the tool sign-in pages but not the other places the phone opens a link and ignores a refusal. I checked each one on main:

Opener Reachable refusal today? Why
Chat /mcp tray sign-in Yes It opens the agent's own MCP OAuth URL, which asks for every scope the server lists, the same kind of URL as PostHog's in #51303.
Composio connect (settings and chat card) No The link is Composio's own short hosted connect link (src/main/composio/composio-api.ts:214-222). The other Composio links are fixed COMPOSIO_PAGES constants.
Slack install / post-as No The link is Slack's install URL for Orca's own app, which Orca Cloud sends (cloud/packages/connector-contract/src/slack-bot-messages.ts:11-17). Its length comes from Orca's fixed scope list, not anything a user enters. The other Slack links are short constants or permalinks.

Reusing the hook keeps one rule for when a sign-in has to be copied instead of opened.

Linked Issue

#48342. This follows up the merged fix, which closed it, and covers another sign-in surface.

Visual Proof

These are the real tray component and hook rendered at phone width (402 pt) in Chromium, with a scripted sign-in whose link is too long for today's store app. A real agent MCP sign-in on a phone needs a live agent turn.

Before / next store build (on today's store app, "Open again" did nothing for this link):

before

After, sign-in finished by pasting the address (light, then Copied in dark):

after-callback
after-callback-copied

After, sign-in finished on the provider's site (light, then Copied in dark):

after-external
after-external-copied

Testing

  • Rendered the real panel in light and dark for both sign-in kinds, at both today's store-app link limit and the next build's. Tapped Copy link and saw Copied.

  • pnpm check:changed and mobile typecheck pass.

  • Two review rounds, plus a perf pass: no P0/P1. Both P2s from round 1 (the cut-off status line and the "page that opened" message) are fixed. After the design review, the row no longer reads "Open in browser" while the link must be copied (scoped review: no findings).

  • Not run on a device: simulator slots were taken. The open/copy rule is the one fix(mobile): open long sign-in links, and offer Copy link where the phone can't #51303 proved on the iOS simulator.

  • 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: this is a UI fallback reusing a hook #51303 already proved on a device, and a test would only pin UI.

Performance

None, because each tray row adds one hook that does nothing while no sign-in runs. While a sign-in runs, it parses the URL once (memoized) and writes the clipboard once per tap. There are no timers or subscriptions.

Risk

Level: Low

The change only shows up when a phone's app can't open the sign-in link; otherwise the tray is unchanged. Native screens never take this path, and desktop's tray doesn't use this component. A plain revert undoes it.

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 copy only happens when the user taps it, and only for the agent's own sign-in URL. The link allowlist is unchanged.
  • No store build needed. Phones that already take long links never show the fallback.

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 MCP panel now offers a copy-link control when it cannot open a sign-in link on the phone. It displays copy status, browser instructions, and copy failures. The change adds English translations and row hint styling. The MCP button component moves from the panel into a separate module.

Merge Risk: Minimal · up to 9a460

The change adds a Copy link fallback to the mobile MCP sign-in tray for links the phone cannot open. No concrete defect was found, and links the phone can open keep their existing behavior. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a Copy link fallback in the mobile chat MCP sign-in when the phone cannot open the sign-in page. It matches the changeset, which adds a copy-link action to the MCP pan…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template and covers the required sections. It has a clear ELI5, a detailed What Changed section with before and after behavior, a Why section that compares alter…
Full details: Title check

Explanation

The title names the main change: a Copy link fallback in the mobile chat MCP sign-in when the phone cannot open the sign-in page. It matches the changeset, which adds a copy-link action to the MCP panel rows for links the phone cannot open. The title is specific and uses the conventional fix(mobile) prefix.

Full details: Description check

Explanation

The description follows the repository template and covers the required sections. It has a clear ELI5, a detailed What Changed section with before and after behavior, a Why section that compares alternative openers, a linked issue (#48342), visual proof images for both sign-in flows, testing notes, a performance statement, and a risk level with a revert path. The Linked Issue section says it is a follow-up to a merged fix, which is acceptable. Minor gaps: the Testing checkbox for added tests is unchecked with a stated reason, the 'Every added test fails' item is not applicable, and the AI Disclosure section is empty. The author is not identified as a StablyAI team member, so AI Disclosure is needed for non-internal contributors. The Review section is also empty. These gaps are non-critical, so the check 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: 128a97c9-4caf-4150-ac57-609affae36f8
Commits

Reviewing files that changed from the base of the PR and between fac45a9 and 9a4602d.

Files selected for processing: 2

  • mobile/src/i18n/locales/en.json
  • mobile/src/session/native-chat/mcp/MobileNativeChatMcpPanel.tsx
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; 6 remain after this review.

@supportaiforall-cmd supportaiforall-cmd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@supportaiforall-cmd supportaiforall-cmd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… can't open the page

The /mcp tray opened the agent's MCP sign-in page and ignored a refusal, so a
link longer than today's store shell takes left Sign in and Open again doing
nothing. The row now shows Copy link for the same sign-in, reusing the
tool sign-in's useSignInLinkCopy.
@AmoabaKelvin
AmoabaKelvin force-pushed the mobile-link-open-refusals branch from fac45a9 to 9a4602d Compare November 28, 2026 10:36
@AmoabaKelvin
AmoabaKelvin merged commit fb4a7fc into main Nov 28, 2026
29 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.

3 participants