SEO panel calls the AI feature endpoint even when Jetpack AI is disabled

Open Beginner friendly
#53,467 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, php, react, wordpress
Domain
api, backend, frontend

Research direction

Start with the SEO panel component, its SEO enhancer hook, and useAiFeature() in editor.js, following the initiator stack described in the issue. Check where availability is determined and why the hook runs when Jetpack AI is disabled and SEO Tools is inactive. Done when opening the editor under those conditions no longer requests the AI feature endpoint; verify in the network panel.

Written by the indexing model from the issue text.

Description

Bug Needs triage
Impacted plugin

Jetpack

Quick summary

With add_filter( 'jetpack_ai_enabled', '__return_false' ), the block editor still requests GET /wp-json/wpcom/v2/jetpack-ai/ai-assistant-feature on every load. The request comes from the Jetpack SEO panel: its component calls the SEO enhancer hook, which calls useAiFeature() before anything checks whether the AI SEO enhancer is available. On sites where the editing user has no WordPress.com token, the endpoint returns a 500.

Steps to reproduce
  1. On a Jetpack-connected site, add add_filter( 'jetpack_ai_enabled', '__return_false' ); and leave the SEO Tools module inactive.
  2. Log in as a user who can activate modules but is not linked to a WordPress.com account.
  3. Open a post in the block editor with the network panel open.
  4. Observe GET /wp-json/wpcom/v2/jetpack-ai/ai-assistant-feature on load, status 500, body failed_to_fetch_data. The initiator stack runs from the SEO panel component through the SEO enhancer hook to useAiFeature in editor.js.
Site owner impact

Fewer than 20% of the total website/platform users

Severity

Moderate

What other impact(s) does this issue have?

No revenue impact

If a workaround is available, please outline it here.

No response

Platform (Simple and/or Atomic)

No response

Dominant language
PHP
Stars
1.9k
Forks
906
Avg merge
1d 18h
Merged PRs (30d)
793

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/jetpack

All issues in Automattic/jetpack

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.