Skip to content

Studio: text shared to Studio is lost when signing in from a signed-out share #2305

Open

Description

@kantord

TL;DR

Text shared to Studio (from the phone/OS share sheet) is lost if the user isn't signed in and signs in with the full-page Sign in link. They end up in an empty chat. The cause is a mismatch between Studio's auth gate and the prototype's design, which has no gate.

Found by reading code; not reproduced in a running app.

How sharing is meant to work

  1. The installed web app declares a share target. Sharing text opens /workspace/chat?prompt=<shared text> (Studio manifest.webmanifest#L11-L15).
  2. The chat page reads prompt and pre-fills the composer. It never sends on its own.

What goes wrong

  1. User isn't signed in. Studio does not render the chat page. It renders a public sign-in shell until auth is verified (auth-gate.tsx#L242-L251).
  2. The full-page Sign in link is built by authLoginUrl, which deletes prompt and send from the return URL on /workspace/chat (auth-gate.tsx#L39-L47, used at #L229).
  3. After login the user comes back to /workspace/chat with no prompt. The shared text is gone.

The code comment justifies the stripping only for "a login popup or new tab". The full-page link gets the same treatment. The popup path keeps the original tab on its URL, so it likely works (not tested).

Passing the text through wouldn't work anyway: the server rejects a return_to over 2,048 characters (service.ts#L856-L868), and real shares are often longer.

Why it happens (structural)

  • The prototype has no auth gate. Its Sign-in card says "the app-wide AuthGate is gone" (sign-in-card.tsx#L13) and the app renders "route content even when signed out" (main.tsx#L67). Sign-in is a popup only (use-oidc-popup.ts), so the share URL never leaves the page and the prompt survives.
  • Studio added a gate and a full-page sign-in link. The design never considered that combination, so nothing says what a signed-out share should do.
  • The prototype's share target and prompt handling are the same as Studio's, so this is not a copying mistake: prototype manifest.webmanifest#L10-L14, chat-seed.ts#L10.

Decision needed

What should a signed-out share do?

  • A. Keep the gate, but stash the prompt (e.g. in sessionStorage) before the redirect and restore it after sign-in.
  • B. Keep the gate, and for a chat with a pending prompt only offer the popup sign-in.
  • C. Accept the loss, and tell the user their text wasn't kept.
  • D. Move toward the prototype: render the chat while signed out. Biggest change.

Side note

Studio's share target passes only text. The prototype also passes title and url, so those are dropped even when signed in.

Done when

  • A signed-out share is either kept through sign-in or the user is told it wasn't.
  • Studio and the prototype agree on what happens.

Part of #2302.

Fully or partially written by an AI agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions