Skip to content

Studio Code: List the user's WordPress.com sites in site_list - #5234

Merged
chubes4 merged 2 commits into
trunkfrom
studio-code/site-list-wpcom
Oct 21, 2026
Merged

chubes4 merged 2 commits into
trunkfrom
studio-code/site-list-wpcom

Conversation

@chubes4

@chubes4 chubes4 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude (via the Pi coding agent in a Roadie session) wrote the change and the tests, and ran the eval below on trunk and on this branch. I reviewed the diff and the transcripts.

Proposed Changes

site_list listed only local sites. When the user names one of their WordPress.com sites and no WordPress.com site is active, the agent looked there, found nothing, and concluded the site doesn't exist. Nothing pointed it to WordPress.com, except a line in the remote-site runbook, which is only loaded once the agent already knows the site is remote.

  • site_list now returns { local, wordpressCom }. wordpressCom holds the sites the stored login reaches, with the ID wpcom_request takes as siteId. They come from the same getWpComSites() the /site picker uses: about 14 KB for 160 sites, versus 2.4 MB for GET !/me/sites with plan.
  • Signed out, it says signedIn: false. If the lookup fails, it reports the error and still lists the local sites.
  • Its annotation is now REMOTE_READ, like site_connected_remote_sites. That tool is still read-only, so hosts run it without asking.
  • The remote-site runbook points to site_list for other sites instead of site_connected_remote_sites or GET !/me/sites.

Testing Instructions

  • npx vitest run apps/cli/ai/tests/tools.test.ts: it lists local and WordPress.com sites together, reports a signed-out user, and keeps the local sites when WordPress.com can't be reached.
  • Eval: two prompts naming a WordPress.com site (a Business plan Atomic site) while no WordPress.com site is active, 4 runs each per arm, with trunk and this branch as two providers in one promptfoo config.
Prompt Trunk This branch
"Which theme is my Franklin Works site using?" (no active site) 0/4: asked which site was meant; one run grepped ~/Studio with Bash 4/4: site_list, then one wpcom_request
"Add a draft post titled 'Site list eval' to my Franklin Works site." (a local site active) 0/4: offered the local site or a new one; one run used Bash 4/4: a draft on the right site, without touching the local site

No run on either arm called GET !/me/sites. Median tokens went from 37k to 52k (theme) and from 32k to 53k (draft), because the branch finishes the task where trunk stopped to ask. The drafts were trashed afterwards.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

site_list only listed local sites, so a site the user named that lives on
WordPress.com looked missing. It now also returns the WordPress.com sites the
login reaches, with the ID wpcom_request takes, through the same
getWpComSites() the /site picker uses. A failed or signed-out lookup leaves the
local listing intact. The remote-site runbook points to site_list instead of
GET !/me/sites, whose plan field can return megabytes.
@chubes4
chubes4 marked this pull request as ready for review October 21, 2026 03:54
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 850a7a4 vs trunk

app-size

Metric trunk 850a7a4 Diff Change
App Size (Mac) 922.00 MB 922.00 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 850a7a4 Diff Change
load 1213 ms 1200 ms 13 ms ⚪ 0.0%

site-startup

Metric trunk 850a7a4 Diff Change
siteCreation 8562 ms 8574 ms +12 ms ⚪ 0.0%
siteStartup 5896 ms 5894 ms 2 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

@chubes4
chubes4 merged commit 1c35b57 into trunk Oct 21, 2026
12 checks passed
@chubes4
chubes4 deleted the studio-code/site-list-wpcom branch October 21, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants