The AI Agent prompt override form prevent YAML overrides from being saved and used correctly.
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3538575. -->
Reported by: [scott weston](https://www.drupal.org/user/1116332)
Related to !166
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>- The config form AiAgentPromptChanger is hardcoding 'agent_id' (with quotes) rather than using a variable.<br>
- YAML overrides are stored with escaped newlines (\r\n) instead of standard YAML format, preventing successful validation and saving to the databse.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<ol>
<li>Go to /admin/config/ai/agents/settings/[agent_id]</li>
<li>Click "override" link next to a prompt</li>
<li>Modify the YAML content</li>
<li>Save the form</li>
<li>Check the stored configuration - it contains escaped newlines</li>
<li>The agent continues to use the original prompt instead of the override</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<ul>
<li>Change 'agent_id' to $agent_id in buildForm()</li>
<li>Properly extract agent settings and config</li>
<li>Parse the original file and create standardized YAML for comparison</li>
<li>Compare parsed YAML content instead of raw file content</li>
<li>Improve variable handling</li>
</ul>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>None</p>
<h3 id="summary-api-changes">API changes</h3>
<p>None</p>
<h3 id="summary-data-model-changes">Data model changes</h3>
<p>None</p>
issue