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
- Ask the Canvas AI assistant to add a theme SDC component (e.g.
card-icon) to an existing page via thepage_edittool. Result:Unknown component "card-icon". - Configure
ai.settings:default_providers.chat_with_toolsto an unhealthy/expired provider while a workingchatprovider is also configured, then invoke any ofimprove_text,alt_text,meta_description,translate_pageorab_variants. Result: fails with "the AI provider returned no usable variants" even though a working provider exists.
Proposed resolution
- Port
CreateCanvasPage's SDC-aware branch (ansdc.id lookup plus afindSdcComponentId()bare-leaf-name lookup againstComponentconfig entities withsource: sdc) intoCanvasPageEdit'sclassify(), and the matchingprop_field_definitions-based branches intobuildInputs()/declaredProps(). - Refactor
AiAssistant::resolveDefault()intoresolveCandidates()(returns every configured default provider, de-duplicated, in the same priority order) and haveask()/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_editso it can place theme SDC components exactly likecreate_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.
Issue fork varbase_ai_figma-3612553
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
Comment #4
rajab natshah✅ Released varbase_ai_figma-1.0.0-alpha1
Comment #5
rajab natshahComment #6
rajab natshah