Canvas AI: Title and metadata generation agents fail when layout contains apostrophes
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3572865. --> Reported by: [petar_basic](https://www.drupal.org/user/3626336) Related to !587 >>> <h3 id="overview">Overview</h3> <p>The title_generation and metadata_generation agents fail with a YAML parsing error when the current layout context contains apostrophes (e.g. "team's expertise" in a component's text content).<br> The layout context is injected into the agent's prompt as YAML, but values containing apostrophes are not properly escaped/quoted.</p> <p>Steps to reproduce:<br> 1. Open Canvas editor<br> 2. Add a component with text containing an apostrophe (e.g. "Our team's expertise")<br> 3. Ask the AI to "Generate a title for this page"<br> 4. YAML parsing error</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>Ensure layout context values are properly quoted/escaped when serialized to YAML before being passed to the title and metadata generation agents.</p> <h3 id="ui-changes">User interface changes</h3>
issue