Make it possible to spoof tokens on any test
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3554957. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !7 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>We are currently allowing token injection on any agent and many of these are global and will just work - but there are examples of agents, like the Canvas AI agents where this is added on request time.</p> <p>In the example of Canvas AI, the entity type and entity id the current Canvas AI agent is working on, is sent in the payload. So we need to be able to spoof this in the tests.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Add a field that stores overwritten tokens as a encoded yaml blob - so string long.</li> <li>Add an update hook, for current environments.</li> <li>Add a form field for the YAML overrides. Hide it in a details, since its "advanced" setup.</li> <li>On runtime of an agent, add an eventsubscriber that listens for BuildSystemPromptEvent and uses setTokens.</li> </ul>
issue