Skip to content

Guard against wpcom-dependent Jetpack modules on local sites#3611

Open
lezama wants to merge 3 commits into
trunkfrom
fix-jetpack-wpcom-connection
Open

Guard against wpcom-dependent Jetpack modules on local sites#3611
lezama wants to merge 3 commits into
trunkfrom
fix-jetpack-wpcom-connection

Conversation

@lezama
Copy link
Copy Markdown
Contributor

@lezama lezama commented May 25, 2026

What

Adds explicit guidance in the AI agent's Jetpack plugin recommendations to check for a WordPress.com connection before trying to activate modules that require one (e.g. subscriptions, blaze, stats).

If the site is not connected to wpcom, the agent falls back to Jetpack Forms (contact-form module) for newsletter signups instead of hitting:

Error: Newsletter could not be activated. Exit code: 1

Why

The subscriptions Jetpack module has Requires Connection: Yes in its module header. Jetpack's activation code explicitly blocks it when there's no wpcom connection — even JETPACK_DEV_DEBUG doesn't help because it only sets offline mode, which still enforces the connection check for modules that require it.

Studio Code is local-first, so local sites won't have a Jetpack connection by default. The agent was blindly trying to activate subscriptions (e.g. when adding a newsletter signup), triggering the error every time.

Testing Instructions

Build a new local site with a newsletter signup (e.g. "a site for a coffee shop"). The agent should now:

  1. Check connection status with wp jetpack connection status
  2. If not connected, use Jetpack Forms (contact-form) instead of trying to activate subscriptions

Related

Reported by youknowriad in #studio-code.

Pre-merge Checklist

  • Changes work as described
  • Tests updated/added
  • No new tech debt introduced

🤖 Generated with Claude Code

lezama and others added 2 commits May 25, 2026 12:22
…l env

Add explicit caveat to the general Jetpack guidance in plugin-recommendations.ts:
- List modules that require a wpcom connection (subscriptions, blaze, stats, sync)
- Instruct the agent to NOT activate these in Studio's local PHP-WASM environment
- Redirect newsletter signup requests to Jetpack Forms (contact-form module)

Fixes the error youknowriad observed:
  wp jetpack module activate subscriptions
  Error: Newsletter could not be activated. Exit code: 1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Check connection status first rather than blocking outright.
If the site is not connected to wpcom, fall back to Jetpack Forms
for newsletter signups instead of activating the subscriptions module.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented May 25, 2026

📊 Performance Test Results

Comparing a2a26ab vs trunk

app-size

Metric trunk a2a26ab Diff Change
App Size (Mac) 1339.26 MB 1338.53 MB 0.73 MB ⚪ 0.0%

site-editor

Metric trunk a2a26ab Diff Change
load 1781 ms 1778 ms 3 ms ⚪ 0.0%

site-startup

Metric trunk a2a26ab Diff Change
siteCreation 9605 ms 9596 ms 9 ms ⚪ 0.0%
siteStartup 4916 ms 4916 ms 0 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

…ed fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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