Skip to content

Studio Agentic UI: Define signed-out experience for Agentic UI chat - #4183

Merged
bcotrim merged 25 commits into
trunkfrom
add/logout-experience-for-agentic-ui
Jul 20, 2026
Merged

Studio Agentic UI: Define signed-out experience for Agentic UI chat#4183
bcotrim merged 25 commits into
trunkfrom
add/logout-experience-for-agentic-ui

Conversation

@katinthehatsite

@katinthehatsite katinthehatsite commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Related issues

Fixes STU-1898

How AI was used in this PR

It was used to extract the changes that were suggested in the exploration from #3975

Proposed Changes

This PR adds a logged-out experience for the users for the agentic UI:

Screenshot 2026-07-14 at 3 55 08 PM

Testing Instructions

  • Pull the changes from this branch
  • Start Studio with npm start
  • Enable the Agentic UI feature flag from Studio -> Feature flags from the topbar
  • Log out of WordPress.com
  • Observe that New chat button is disabled
  • Observe that when you select a specific site, you get redirected to its settings with the log in banner
  • Observe the Log in button in the sidebar
  • Confirm that the Share button for the previews is disabled and it asks you to log in to share the link
Screenshot 2026-07-14 at 3 57 28 PM
  • Confirm that log in button works as expected and that once you log in, all the disabled options become available

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@katinthehatsite katinthehatsite self-assigned this Jul 13, 2026
@katinthehatsite
katinthehatsite marked this pull request as draft July 13, 2026 10:37
@katinthehatsite
katinthehatsite requested a review from a team July 14, 2026 15:10
@katinthehatsite
katinthehatsite marked this pull request as ready for review July 14, 2026 15:11

@bcotrim bcotrim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I did some brief testing.
Some initial comments:

  • I believe this branch needs to adjust to the latest trunk updates
  • While offline I still see my sites when I try publish:
Image
@katinthehatsite

Copy link
Copy Markdown
Contributor Author

I believe this branch needs to adjust to the latest trunk updates

I just did the rebase 👍

While offline I still see my sites when I try publish

I have not tested the offline mode yet, I will take a look now. I will check if it makes sense to handle this as a part of this PR or open a completely new issue to handle the offline mode across the whole agentic UI

@katinthehatsite

Copy link
Copy Markdown
Contributor Author

@bcotrim for the offline mode, I think we need a separate issue. I will create one in Linear, there are multiple elements that need to de handled holistically e.g. Log in button, Publish button, New chat button, some sort of indication that the user is offline. I think we can focus on logged out screen in this PR, and handle the offline mode separately. What do you think?

@wpmobilebot

wpmobilebot commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 328973c vs trunk

app-size

Metric trunk 328973c Diff Change
App Size (Mac) 1355.69 MB 1353.86 MB 1.83 MB 🟢 -0.1%

site-editor

Metric trunk 328973c Diff Change
load 1066 ms 1100 ms +34 ms ⚪ 0.0%

site-startup

Metric trunk 328973c Diff Change
siteCreation 6505 ms 6511 ms +6 ms ⚪ 0.0%
siteStartup 2396 ms 2398 ms +2 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@bcotrim

bcotrim commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@bcotrim for the offline mode, I think we need a separate issue. I will create one in Linear, there are multiple elements that need to de handled holistically e.g. Log in button, Publish button, New chat button, some sort of indication that the user is offline. I think we can focus on logged out screen in this PR, and handle the offline mode separately. What do you think?

Yes, I think it makes sense to address offline mode in a separate issue.
I did mean to say "logged-out" in my test, I didn't check offline mode 😅

@katinthehatsite

katinthehatsite commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

I did mean to say "logged-out" in my test, I didn't check offline mode 😅

I see what you mean now - I have adjusted the dropdown to show only the button to create a site when the user is logged out without loading all the other sites. This is how it looks like when the user is logged out:

Screenshot 2026-07-16 at 11 07 16 AM

Let me know what you think!

@katinthehatsite
katinthehatsite requested a review from bcotrim July 16, 2026 09:07
@bcotrim

bcotrim commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

I did mean to say "logged-out" in my test, I didn't check offline mode 😅

I see what you mean now - I have adjusted the dropdown to show only the button to create a site when the user is logged out without loading all the other sites. This is how it looks like when the user is logged out:
Screenshot 2026-07-16 at 11 07 16 AM

Let me know what you think!

I think that's good for now, we can ask @shaunandrews for a review to get his thoughts on it.

However the request to fetch the sites is still being made, so we get this on the logs:

Error occurred in handler for 'fetchSyncableWpcomSites': Error: Authentication required to fetch WordPress.com sites.
    at fetchSyncableWpcomSites (/Users/bcotrim/.mognet/worktrees/studio/mognet-37cfb615/apps/studio/dist/main/index.js:48639:33)
    at async Session.<anonymous> (node:electron/js2c/browser_init:2:116010)
Error occurred in handler for 'fetchSyncableWpcomSites': Error: Authentication required to fetch WordPress.com sites.
    at fetchSyncableWpcomSites (/Users/bcotrim/.mognet/worktrees/studio/mognet-37cfb615/apps/studio/dist/main/index.js:48639:33)
    at async Session.<anonymous> (node:electron/js2c/browser_init:2:116010)
Error occurred in handler for 'fetchSyncableWpcomSites': Error: Authentication required to fetch WordPress.com sites.
    at fetchSyncableWpcomSites (/Users/bcotrim/.mognet/worktrees/studio/mognet-37cfb615/apps/studio/dist/main/index.js:48639:33)
    at async Session.<anonymous> (node:electron/js2c/browser_init:2:116010)
Error occurred in handler for 'fetchSyncableWpcomSites': Error: Authentication required to fetch WordPress.com sites.
    at fetchSyncableWpcomSites (/Users/bcotrim/.mognet/worktrees/studio/mognet-37cfb615/apps/studio/dist/main/index.js:48639:33)
    at async Session.<anonymous> (node:electron/js2c/browser_init:2:116010)

I think we should prevent the request from being made, if possible.

@katinthehatsite

Copy link
Copy Markdown
Contributor Author

I think we should prevent the request from being made, if possible.

Agreed, I am taking a look now 👀

@katinthehatsite
katinthehatsite force-pushed the add/logout-experience-for-agentic-ui branch from 9d9cb50 to e8933b2 Compare July 17, 2026 12:14
@katinthehatsite

Copy link
Copy Markdown
Contributor Author

It should now be addressed @bcotrim - let me know what you think

@bcotrim

bcotrim commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Thanks for addressing the issue @katinthehatsite, I no longer see the network request when opening the publish menu.
Some issues I noticed:

  1. "+" menu reverted to the previous version with "New chat, new site, import...".
image
  1. Preview shows update option when logged out (the error layout isn't good but let's do that in a follow-up)
image
  1. Connected site is lost when logged out, which matches the behavior in legacy UI, but it's strange to send the user to create a new site if the site is already connected to another. Maybe when logged out we could change the action from "create a new site" to "login to WordPress.com" matching exactly the workflow we have in legacy UI.
Logged-in Logged-out
image image
- Revert sidebar header to simple "+" button (trunk version)
- Disable preview update button when signed out
- Disable pull/push/disconnect when signed out
- Show "Log in" button instead of "Publish" when signed out

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@katinthehatsite
katinthehatsite force-pushed the add/logout-experience-for-agentic-ui branch from 3aa3cce to 5f85bf5 Compare July 17, 2026 19:13
Kateryna Kodonenko and others added 2 commits July 17, 2026 21:16
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@katinthehatsite

Copy link
Copy Markdown
Contributor Author

@bcotrim I made some more changes based on your feedback, let me know what you think! Feel free to take over while I am AFK

@bcotrim bcotrim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pushed some smaller fixes.
LGTM 👍

@bcotrim
bcotrim merged commit 4174501 into trunk Jul 20, 2026
13 checks passed
@bcotrim
bcotrim deleted the add/logout-experience-for-agentic-ui branch July 20, 2026 10:22
bcotrim added a commit that referenced this pull request Jul 21, 2026
…#4130)

## Related issues

- Related to STU-1985 — extracted from #3998 as part of splitting it
into smaller PRs.

## How AI was used in this PR

The core change was cherry-picked from #3998 (authored there with AI
assistance). Claude Code ported it onto trunk, resolved merge conflicts
(including the moves to id-based session↔site matching from #4131 and
the signed-out gates from #4183), addressed review feedback, and wrote
the unit tests for the redirect logic. All code was reviewed and
verified locally (lint, typecheck, apps/ui test suite).

## Proposed Changes

Studio's agentic UI always lands on the first site (in raw fetch order)
at launch, regardless of where the user was working. This PR makes the
app reopen on the site the user last worked with:

- The dashboard remembers the last visited site in `localStorage`.
- On launch, the `/` index route opens that site's newest active chat
(or a new chat if it has none) — matching exactly what clicking the site
in the site-centric sidebar (#4191) does.
- If the remembered site no longer exists (deleted) or nothing is stored
yet, it falls back to the **top site in sidebar order**, respecting the
manual ordering from #4134 instead of raw fetch order.
- The sidebar auto-scrolls to keep the restored site's row visible when
it sits below the fold (thanks @sejas for catching this!).

An earlier revision restored the exact last-visited *session*. We
simplified to site-level restore to stay consistent with the
site-centric sidebar model: sites are the primary navigation unit, and a
site always opens its newest active chat.

No launch-time cost: the index route already fetched sites and sessions
before redirecting; this adds only a synchronous `localStorage` read.

## Testing Instructions

1. Launch Studio with the agentic UI and open a chat on a site other
than the top one in the sidebar.
2. Quit and relaunch — you should land on that same site (its newest
active chat).
3. With enough sites to make the sidebar scroll, work on a site near the
bottom, relaunch — the sidebar should scroll so the selected site's row
is visible.
4. Archive the chat you were on, relaunch — you should land on that
site's newest remaining active chat, or a new chat if none are left.
5. Delete the site you were on, relaunch — you should land on your
sidebar's top site, with no errors.
6. Drag a different site to the top of the sidebar, clear the app's
localStorage, relaunch — the fallback should follow your sidebar order.

## Pre-merge Checklist

- [x] Have you checked for TypeScript, React or other console errors?

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Shaun Andrews <shaun@automattic.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants