fix(compat): restore Connectors admin page on WP 6.9 + Gutenberg#1311
Conversation
… load-order race causes Gutenberg to skip its own registration
On WP 6.9 with Gutenberg 22.8.0+ active, the Connectors admin page at
options-general.php?page=options-connectors-wp-admin returns 404. Root
cause: Gutenberg's lib/load.php gates registration on
class_exists('\\WordPress\\AiClient\\AiClient') at file-include
time. Plugins load alphabetically, so 'gutenberg' runs before
'superdav-ai-agent', meaning our SdkLoader::register() (which makes the
SDK class autoloadable from lib/php-ai-client/) has not yet run. The
gate fails, Gutenberg never requires experimental/connectors/load.php,
and the admin page is never registered.
Fix: a new GutenbergConnectorsBridge polyfill, hooked on admin_menu
priority 12 (one tick after Gutenberg's own priority 11), detects this
case and manually requires Gutenberg's render-page file before calling
add_submenu_page() with its render callback. No-op on WP 7.0+ (native
page) and when Gutenberg is missing (existing JS prompts to install).
Note: this regression became user-visible after the plugin slug rename
from 'gratis-ai-agent' to 'superdav-ai-agent' moved us alphabetically
after 'gutenberg'.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… follow-up) (#1312) * fix(compat): force-load Gutenberg Connectors subsystem on WP 6.9 The previous PR #1311 only restored the Settings → Connectors menu item but left Gutenberg's connectors registry, default AI providers, REST validation, and script-module data filter unloaded. Result: the page rendered but only Jetpack appeared, while Anthropic/Google/OpenAI provider cards (and any other plugin-registered connectors) were missing because the wp_connectors_init action never fired. Root cause: Gutenberg gates lib/experimental/connectors/load.php behind a class_exists('\\WordPress\\AiClient\\AiClient') check evaluated at plugin file-load time. Plugins load alphabetically, so gutenberg < superdav-ai-agent — our SdkLoader::register() runs after Gutenberg's gate, so the gate always fails and the entire connectors subsystem stays unloaded. Fix: directly require Gutenberg's connectors loader on plugins_loaded:1 (after our SDK loader, before init:15 when Gutenberg's registry initialiser fires). After this hook runs, behaviour is identical to a fresh Gutenberg install on WP 7.0 — every default AI provider registers, every plugin's wp_connectors_init hook fires, and the script-module data filter populates the React app. The existing admin_menu:12 menu polyfill stays as defence-in-depth should a future Gutenberg release move the loader path. No-op on WP 7.0+ (core) or without Gutenberg ≥ 22.8.0. * fix(build): strip dev-only scripts/, playwright.config.js, .wordpress-org/ from release zips Three top-level dev artefacts were being shipped inside both the full GitHub release zip and the WordPress.org zip: - scripts/ (Node helper scripts: archive.js, add-strict-types.js) - playwright.config.js (E2E test runner config) - .wordpress-org/ (WP.org SVN-only assets + Playground blueprints) None of them are referenced by runtime PHP. The .wordpress-org/ directory is read by WordPress.org from the SVN repository root, NOT from the plugin zip — shipping it inside the zip wastes ~30 KB and exposes dev-only blueprint scaffolding to end-user installs. Verified on the rebuilt 1.11.1-wporg zip (clean install on jurassic.ninja WP 6.9.4 + Gutenberg 23.1.1): no fatals, all three paths absent, Connectors subsystem still loads correctly. Zip size dropped from 2.18 MB to 2.09 MB.
Summary
On WP 6.9 with Gutenberg 22.8.0+ active, the Connectors admin page at
options-general.php?page=options-connectors-wp-adminreturns 404.Root cause
gutenberg/lib/load.php:133gates Connectors-page registration on a class-existence check that runs at plugin file-include time:WordPress loads plugins alphabetically. After we renamed from
gratis-ai-agenttosuperdav-ai-agent,gutenbergnow loads before us. At the moment Gutenberg evaluates that gate, ourSdkLoader::register()(which makes\WordPress\AiClient\AiClientautoloadable from our bundledlib/php-ai-client/) has not yet run. The gate returnsfalse, Gutenberg silently skips loadingexperimental/connectors/load.php, and the admin page is never registered.Fix
New
SdAiAgent\Compat\GutenbergConnectorsBridgepolyfill, hooked onadmin_menupriority 12 (one tick after Gutenberg's own priority 11 hook). It:options-general.php(defence in depth).require_onces Gutenberg'sbuild/pages/options-connectors/page-wp-admin.php(which definesgutenberg_options_connectors_wp_admin_render_page), then callsadd_submenu_page()with that callback — restoring the official Gutenberg-backed Connectors UI.Wired in
AdminHandler::register_gutenberg_connectors_bridge()via#[Action(tag: 'admin_menu', priority: 12)].Verification
php -lclean on both edited files..distignoreexclusion — new file ships in both full and WP.org zips.compile=falseand on first request after fresh install whencompile=true. Fresh installs of the rebuilt 1.11.1 zip will pick up the new method.Notes
1.11.1(not bumped to1.11.2) at user request — same WP.org review submission, just a corrected zip.aidevops.sh v3.15.23 plugin for OpenCode v1.14.41 with claude-sonnet-4-6 spent 21h 16m and 40 tokens on this as a headless worker.