Repository navigation
Description
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
- The installed web app declares a share target. Sharing text opens
/workspace/chat?prompt=<shared text>(Studiomanifest.webmanifest#L11-L15). - The chat page reads
promptand pre-fills the composer. It never sends on its own.
What goes wrong
- 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). - The full-page Sign in link is built by
authLoginUrl, which deletespromptandsendfrom the return URL on/workspace/chat(auth-gate.tsx#L39-L47, used at#L229). - After login the user comes back to
/workspace/chatwith 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
AuthGateis 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.
Activity