Skip to content

fix(ui): open browser for alphaXiv sign-in on remote sessions - #884

Merged
alphaxiv-bot[bot] merged 2 commits into
alphaXiv:mainfrom
jyuan-dev:fix/alphaxiv-browser-signin
Nov 4, 2026
Merged

alphaxiv-bot[bot] merged 2 commits into
alphaXiv:mainfrom
jyuan-dev:fix/alphaxiv-browser-signin

Conversation

@jyuan-dev

Copy link
Copy Markdown
Contributor

Closes #883

Summary

When orx is running on a remote host (e.g. workstation connected from a laptop), the backend orx login process attempts to launch a browser locally on the host via open_browser, which cannot open a browser window on the client machine.

In LoginSession (ui/src/components/AccountChip.tsx), the authorization URL was captured from the PTY stdout and stored in local state, but window.open was never called on the client side. The dialog rendered "Finish signing in in your browser…" while no browser tab was ever prompted or opened on the user's laptop.

This change invokes window?.open?.(match[0], "_blank") when the authorization URL arrives from the login session stream, using a ref guard so it opens only once.

Test plan

  • Added unit test LoginSession prompts browser window when authorization URL arrives in ui/tests/accountChip.test.mjs.
  • node --test --experimental-strip-types ui/tests/accountChip.test.mjs: all 10 tests pass.
  • pnpm -C ui test: all 578 unit tests pass.
  • pnpm -C ui typecheck: typecheck passes without errors.
  • pnpm -C ui build: Paraglide compile, typecheck, and Vite production build pass without errors.
  • cargo fmt --check: passes without formatting differences.
  • cargo check --bin orx: passes without errors.

Assisted-by: claude-opus-5.5

When orx is running on a remote host (e.g. workstation connected from
laptop), the backend orx login process cannot launch a browser on the
client machine via host-side open_browser. LoginSession received the
authorization URL from the PTY stdout but only set component URL state
without invoking window.open, leaving the dialog stuck on "Finish
signing in in your browser…". Prompt window.open with the authorization
URL once received.

Closes alphaXiv#883

Assisted-by: claude-opus-5.5
@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches the sign-in and account-linking flows in the UI.

The PR appears safe to merge, with non-blocking issues around blocked popups and duplicate local sign-in tabs.

Findings

  1. P2 Sign-in tab can stay closed ▶
  2. P2 Local sign-in opens twice ▶
Fix with agent prompt
### Issue 1
ui/src/components/AccountChip.tsx:112-114
`window.open` runs from a WebSocket callback, after the click's browser permission can expire. If the browser blocks this delayed popup, remote sign-in still opens no tab. The user must click the existing URL link.

Open a placeholder tab during the sign-in click and navigate it when the URL arrives, as `RemoteHostDialog` already does.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

### Issue 2
ui/src/components/AccountChip.tsx:114
Local desktop sign-in now opens the same authorization URL twice. Both login endpoints run `login`, which already calls `open_browser` unconditionally. The desktop app sends this new `window.open` request to the system browser too. The `opened` ref only prevents repeated frontend calls, so users get two account prompts for one action.

Coordinate the two launch paths so each sign-in opens one tab.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

LoginSession now asks the client to open the authorization URL once when it arrives.

  • The sign-in UI opens the authorization URL in a browser tab.

Diagram

sequenceDiagram
  participant UI as Login dialog
  participant CLI as Login command
  participant Browser as System browser
  UI->>CLI: Start login over WebSocket
  CLI-->>UI: Print authorization URL
  CLI->>Browser: Open authorization URL
  UI->>Browser: Open authorization URL again
Loading

Reviews (1) · Last reviewed commit: "fix(ui): open browser for alphaXiv sign-..." · Reviewed by Greptile

Comment thread ui/src/components/AccountChip.tsx Resolved
Comment thread ui/src/components/AccountChip.tsx Resolved
… sessions

Avoid opening duplicate browser tabs on local sign-in by deferring to
backend login's open_browser when not in a remote session. On remote
sessions in web browsers, open a placeholder tab during user gesture
and navigate it once the authorization URL arrives to prevent popup
blocking. In remote desktop app sessions, prompt window.open directly
without pre-opening.

Assisted-by: claude-opus-5.5
@jyuan-dev

Copy link
Copy Markdown
Contributor Author

Addressed in commit 1c0c7be:

• Issue 1 (Delayed popup blocking in browsers):
When running a remote session in a web browser (!inDesktopApp && remote), openSignIn and SignInDialog retry handlers open a placeholder window (window.open("/remote-launch", "_blank")) synchronously during the user gesture. Once the authorization URL arrives over the WebSocket stream, LoginSession navigates the placeholder via placeholderWindow.location.replace(authUrl) instead of triggering a delayed window.open that could get blocked by the browser's popup blocker. If cancelled or on error, the placeholder tab is closed. If popups are blocked by the browser, showAlert(m.remote_popup_blocked(), "error") is shown.

• Issue 2 (Duplicate browser tabs on local sign-in):
On local sessions (!remote), backend login already executes open_browser on the local machine. LoginSession only triggers browser navigation or window.open when in a remote session (remote), avoiding duplicate tabs on local desktop and local browser sign-ins.

@small-angel small-angel added the auto-merge Queue for automatic merge once all checks pass label Nov 4, 2026
@alphaxiv-bot
alphaxiv-bot Bot merged commit 3fd83d0 into alphaXiv:main Nov 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Queue for automatic merge once all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

alphaXiv sign-in does not open browser on remote host sessions

2 participants