Skip to content

AI Sidebar: Update Jetpack AI Sidebar contract#111814

Open
iamchughmayank wants to merge 1 commit into
trunkfrom
update/jetpack-sidebar-legacy-marker
Open

AI Sidebar: Update Jetpack AI Sidebar contract#111814
iamchughmayank wants to merge 1 commit into
trunkfrom
update/jetpack-sidebar-legacy-marker

Conversation

@iamchughmayank

Copy link
Copy Markdown
Contributor

Proposed Changes

Client-side half of the Jetpack AI Sidebar contract rename: Jetpack now emits agentsManagerData.jetpackAiSidebar instead of jetpackAiSidebarPreview.

  • Gate: on non-Simple sites, suppress the legacy Jetpack AI Sidebar (releases that don't honour the AI Assistant setting) by the absence of jetpackAiSidebar. Drop only the Jetpack provider; keep the rest (Big Sky, …). Simple stays server-gated.
  • Reader: read feature flags from jetpackAiSidebar.features.*. AI Editorial Review comes from that single flag; Optimize Title defaults off; remove the unread chatHistory/supportGuides.
  • Narrow the agentsManagerData type and update tests.

Companion: Automattic/jetpack#49489 (carries the jetpackAiSidebar key).

Why are these changes being made?

The companion Jetpack PR renames the emitted payload key while making the sidebar honour the WordPress.com AI Assistant setting. Calypso must read the new key so feature gating stays correct after the rename.

Testing Instructions

Client half of the companion Jetpack PR — follow its testing instructions: Automattic/jetpack#49489

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • For UI changes, have you tested the affected components in dark mode?
  • Have you tested accessibility for your changes?
  • Have you used memoizing on expensive computations?
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use?

- Gate suppresses the legacy sidebar on non-Simple sites by the absence of jetpackAiSidebar; drops only the Jetpack provider, keeps the rest
- Reader reads jetpackAiSidebar.features.*: AER single-source, Optimize Title defaults off, remove unread chatHistory/supportGuides
- Narrow agentsManagerData type; update tests

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@iamchughmayank iamchughmayank changed the title AI Sidebar: read jetpackAiSidebar contract; lean gate and reader AI Sidebar: Update Jetpack AI Sidebar contract Jun 18, 2026
@matticbot

Copy link
Copy Markdown
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • agents-manager
  • help-center
  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/jetpack-sidebar-legacy-marker on your sandbox.

@iamchughmayank iamchughmayank requested a review from Copilot June 18, 2026 23:56
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jun 18, 2026
@iamchughmayank iamchughmayank marked this pull request as ready for review June 18, 2026 23:56

Copilot AI 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.

Pull request overview

Updates Calypso’s Agents Manager / Jetpack AI Sidebar integration to match Jetpack’s renamed inline contract (agentsManagerData.jetpackAiSidebar instead of jetpackAiSidebarPreview) and adjusts client-side gating/feature-flag behavior accordingly.

Changes:

  • Switch Jetpack AI Sidebar feature flag reads to agentsManagerData.jetpackAiSidebar.features.* and remove legacy flag fallbacks.
  • Update the Agents Manager “preview gate” logic to suppress legacy Jetpack sidebar mounts on non-Simple sites by the absence of jetpackAiSidebar (while preserving non-Jetpack providers).
  • Narrow the inline-data typing and update affected unit tests.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/jetpack-ai-sidebar/src/index.ts Reads the new jetpackAiSidebar config and gates suggestions/features based on enabled + features.*.
packages/jetpack-ai-sidebar/src/index.test.ts Updates provider tests to use the renamed config key and new defaults/expectations.
packages/jetpack-ai-sidebar/src/global.d.ts Updates the declared agentsManagerData shape to the renamed inline payload.
apps/agents-manager/jetpack-ai-sidebar-preview-gate.js Changes legacy suppression behavior to key off presence/absence of jetpackAiSidebar on non-Simple sites.
apps/agents-manager/tests/jetpack-ai-sidebar-preview-gate.test.js Updates gate tests for the new contract marker and legacy suppression expectations.
apps/agents-manager/tests/agents-manager-gutenberg.test.js Updates gutenberg entry tests to reflect the new suppression logic (no longer depends on jetpackAiSidebarPreview).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +60 to 64
it( 'suppresses on non-Simple sites when the legacy sidebar is the only provider', () => {
setAgentsManagerData( {
sectionName: 'gutenberg',
agentProviders: [ JETPACK_PROVIDER ],
jetpackAiSidebarPreview: { enabled: true },
} );
* @returns {boolean} True when Agents Manager should not mount at all — the legacy
* Jetpack sidebar was the only provider.
*/
export function shouldSuppressJetpackAiSidebarPreview() {

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'd be in favour of removing all this logic and just gating on the presence of data.jetpackAiSidebarPreview. Would that work? Default to false, true if data?.jetpackAiSidebarPreview is truthy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants