AI Agent Explorer throws BadRequestHttpException when token context fields are present
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3585982. --> Reported by: [rob_e](https://www.drupal.org/user/3350728) Related to !260 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p><code>AiAgentExplorerController</code> retrieves the <code>tokens</code> POST parameter using <code>$request-&gt;request-&gt;get('tokens')</code>. Since Symfony 6, <code>InputBag::get()</code> throws a <code>BadRequestHttpException</code> when the value is non-scalar. Because <code>tokens</code> is submitted as an array, any module implementing <code>hook_form_ai_agents_explorer_alter</code> to add token fields will trigger this exception when the explorer form is submitted.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <ol> <li>Install a module that implements <code>hook_form_ai_agents_explorer_alter</code> e.g. <a href="https://www.drupal.org/project/minikanban_agent">Mini Kanban AI Agents</a></li> <li>Load the AI Agent Explorer, select an agent, and submit the form.</li> <li>Observe <code>BadRequestHttpException: Input value "tokens" contains a non-scalar value.</code> error and the agent isn't run</li> </ol> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Replace <code>$request-&gt;request-&gt;get('tokens') ?? []</code> with <code>$request-&gt;request-&gt;all('tokens')</code> in <code>AiAgentExplorerController</code></p>
issue