Problem/Motivation

Two independent bugs were found during a live functional-testing pass of all 29 AI Agent tools this module ships, both confirmed via reproduction against a real Canvas AI panel session and a real site.

1. src/Plugin/AiFunctionCall/CanvasPageEdit.php — the page_edit tool's add/swap actions cannot place any vartheme_bs5 theme SDC component (e.g. card-icon, card-hero). Its classify()/buildInputs()/declaredProps() methods are a stale copy of CreateCanvasPage's pre-fix logic (the docblock literally says "Copied from CreateCanvasPage so add/swap actions resolve components identically to a full page build") but were never updated when CreateCanvasPage itself gained SDC support.

2. src/AiAssistant.php — the ask()/askJson() methods backing 5 tools (improve_text, alt_text, meta_description, translate_page, ab_variants) resolve a single AI provider via resolveDefault(), try it exactly once, and return an empty result on any failure, with no fallback. If the site's ai.settings:default_providers.chat_with_tools provider is unhealthy (expired key, outage) while a perfectly good chat provider is configured right next to it, all 5 tools fail with "the AI provider returned no usable variants" for no good reason.

Steps to reproduce

  1. Ask the Canvas AI assistant to add a theme SDC component (e.g. card-icon) to an existing page via the page_edit tool. Result: Unknown component "card-icon".
  2. Configure ai.settings:default_providers.chat_with_tools to an unhealthy/expired provider while a working chat provider is also configured, then invoke any of improve_text, alt_text, meta_description, translate_page or ab_variants. Result: fails with "the AI provider returned no usable variants" even though a working provider exists.

Proposed resolution

  1. Port CreateCanvasPage's SDC-aware branch (an sdc. id lookup plus a findSdcComponentId() bare-leaf-name lookup against Component config entities with source: sdc) into CanvasPageEdit's classify(), and the matching prop_field_definitions-based branches into buildInputs()/declaredProps().
  2. Refactor AiAssistant::resolveDefault() into resolveCandidates() (returns every configured default provider, de-duplicated, in the same priority order) and have ask()/askJson() iterate through all candidates, only giving up after every one fails.

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Addition/Change/Update/Fix to this project
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ❌ Reviewed by a human
  • ❌ Code review by maintainers
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Update Release Notes
  • ✅ Release

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Fixes page_edit so it can place theme SDC components exactly like create_canvas_page, and makes the content-improvement tools (rewrite, alt text, meta description, translate, A/B variants) fall back to any other configured AI provider instead of failing outright when the site's primary default provider is unavailable.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajab natshah created an issue. See original summary.

  • rajab natshah committed ad546502 on 1.0.x
    fix: #3612553 Fix page_edit's stale component classifier and add a...
rajab natshah’s picture

Assigned: Unassigned » josebc
Status: Active » Needs review
Issue tags: +varbase_ai_figma-1.0.0-alpha1
rajab natshah’s picture

Assigned: josebc » mohammed j. razem
rajab natshah’s picture

Assigned: mohammed j. razem » Unassigned
Issue summary: View changes
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.