Skip to content

Differentiate preview sites from connected WordPress.com remote sites - #3677

Merged
sejas merged 14 commits into
trunkfrom
stu-1775-differentiate-preview-sites-from-wordpresscom-remote-sites
Jun 25, 2026
Merged

Differentiate preview sites from connected WordPress.com remote sites#3677
sejas merged 14 commits into
trunkfrom
stu-1775-differentiate-preview-sites-from-wordpresscom-remote-sites

Conversation

@sejas

@sejas sejas commented Jun 3, 2026

Copy link
Copy Markdown
Member

Related issues

How AI was used in this PR

Used an AI coding assistant to find the root cause, implement the fix, and write a regression eval. All changes reviewed manually.

Proposed Changes

Studio Code (the AI agent) was calling a temporary preview site a connected WordPress.com site when telling users what a local site is linked to.

These are two different things:

  • Connected WordPress.com site — a real, durable site you push/pull to.
  • Preview site — a temporary, expiring share link (*-studio.wp.build).

The agent had no reliable way to tell them apart, so it guessed from the URL/name and got it wrong.

The fix: each listing now tags every entry with a type field (wpcom-remote or preview), and the preview listing adds an isExpired flag. The agent reads the tag instead of guessing, and the tool descriptions no longer call previews "WordPress.com" sites.

User impact: when you ask Studio Code what a site is connected to, preview sites and connected WordPress.com sites are now reported correctly, each under its own category.

A regression eval (scripts/eval/) seeds both kinds of site and asserts the agent keeps them distinct. The human-facing studio preview list output is unchanged.

Testing Instructions

  • Run npm run cli:build && node apps/cli/dist/cli/main.mjs code
  • Select a local site
  • Ask What wpcom sites do I have?
  • Ask Publish my site
  • Ask Create a preview site
  • Confirm responses make sense and target the correct type of site.
  • If you have Promptfoo variables configured, run npm run eval -- --filter-pattern "preview sites" and confirm the new eval passes correctly.
Screenshot 2026-06-23 at 17 38 58 Screenshot 2026-06-23 at 17 22 13 Screenshot 2026-06-23 at 17 22 56

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@sejas sejas self-assigned this Jun 3, 2026
@sejas
sejas marked this pull request as ready for review June 23, 2026 16:37
@wpmobilebot

wpmobilebot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 18b3566 vs trunk

app-size

Metric trunk 18b3566 Diff Change
App Size (Mac) 1311.91 MB 1311.91 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 18b3566 Diff Change
load 1080 ms 1051 ms 29 ms ⚪ 0.0%

site-startup

Metric trunk 18b3566 Diff Change
siteCreation 6474 ms 6466 ms 8 ms ⚪ 0.0%
siteStartup 6980 ms 6995 ms +15 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

sejas added 3 commits June 24, 2026 06:41
…e-preview-sites-from-wordpresscom-remote-sites
…ites-from-wordpresscom-remote-sites' into stu-1775-differentiate-preview-sites-from-wordpresscom-remote-sites
'preview_create',
'Creates a WordPress.com preview site from a local Studio site. Requires WordPress.com authentication. This can take a few minutes, so tell the user to wait after starting it.',
'Creates a preview site from a local Studio site. A "temporary site", "temporal site", or "share link" all mean a preview site — use this tool for those requests. When a local site is already selected and the user asks to create a temporary/temporal/preview site, create a preview of the selected site rather than a new local site. Requires WordPress.com authentication. This can take a few minutes, so tell the user to wait after starting it.',
{

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 think it is a good idea to remove the WordPress.com reference from there as this can be quite confusing for the agents. I am wondering if we should mention where the preview sites are hosted or it might not be necessary. What do you think?

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.

Although, on a second thought, it might not be necessary for an agent to have that information since it does not really impact user's workflow

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.

Additionally, the synonym disambiguation ("temporary site", "temporal site", "share link") is repeated in both the tool description and the system prompt. Would it make sense to keep the tool description short and defer to the system prompt for synonym mapping?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I preferred to remove the duplication from the system prompt in favor of the tool description.
1e8543a

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I confirmed it is still working:
Screenshot 2026-06-25 at 13 39 41

Comment thread apps/cli/ai/tests/tools.test.ts Outdated
sejas and others added 3 commits June 25, 2026 12:46
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…te-preview-sites-from-wordpresscom-remote-sites

# Conflicts:
#	scripts/eval/README.md

@nightnei nightnei 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.

LGTM and works well 👍
Screenshot 2026-06-25 at 13 25 21
Screenshot 2026-06-25 at 13 26 54
Screenshot 2026-06-25 at 13 28 18

Only one thing - should we add mentioning Pressbale (as Wordpress.com/Pressable), for example, here removed site_connected_remote_sites and in other places where we mention wordpress.com? During my testing, the AI didn't mention Pressable, however, on the screenshots in the "Testing instructions", you had mentioned Pressable, that's why I started wondering - should we mention it directly everywhere, so that the AI always mentions it too in responses?

…te-preview-sites-from-wordpresscom-remote-sites
@sejas

sejas commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

Thank you both for reviewing the PR, and your suggestions.

During my testing, the AI didn't mention Pressable, however, on the screenshots in the "Testing instructions", you had mentioned Pressable, that's why I started wondering - should we mention it directly everywhere, so that the AI always mentions it too in responses?

That's a good point. I'll create an issue to update skills and docs to take Pressable into consideration.

@sejas
sejas enabled auto-merge (squash) June 25, 2026 15:48
@sejas
sejas merged commit 8262017 into trunk Jun 25, 2026
11 checks passed
@sejas
sejas deleted the stu-1775-differentiate-preview-sites-from-wordpresscom-remote-sites branch June 25, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants