Faulty logic in the deprecation of system prompts
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3573100. -->
Reported by: [marcus_johansson](https://www.drupal.org/user/385947)
Related to !1191
>>>
<p>[Tracker]<br>
<strong>Update Summary: </strong>[One-line status update for stakeholders]<br>
<strong>Short Description: </strong>[One-line issue summary for stakeholders]<br>
<strong>Check-in Date: </strong>MM/DD/YYYY<br>
<em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br>
[/Tracker]</p>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>In 1.2.x we upped how the system prompt worked, with moving it into the ChatInput object where it belongs. For none-bc reasons we still have the option to load it via the provider object and some logic to it.</p>
<p>Right now that logic makes it so that the system prompt is added into memory, when it does exist in the ChatInput, instead of when it doesn't.</p>
<p>This can have effects, since the provider is one service that keep the system prompt in memory for the whole run and thus, can reuse the same system prompt between different ai calls.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4>
<p>1. Add an agent with a subagent<br>
2. Run the whole agent in one go, the last parent agent system prompt, will be that of the subagent prompt.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Fix the logic inverse.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3>Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)</h3>
<h3 id="summary-ai-usage">AI usage (if applicable)</h3>
<p>[ ] AI Assisted Issue<br>
This issue was generated with AI assistance, but was reviewed and refined by the creator.</p>
<p>[ ] AI Assisted Code<br>
This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.</p>
<p>[ ] AI Generated Code<br>
This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.</p>
<p>[ ] Vibe Coded<br>
This code was generated by an AI and has only been functionally tested.</p>
> Related issue: [Issue #3573049](https://www.drupal.org/node/3573049)
issue