ai_context_install breaks existing config site installs (and probably recipes)
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3581501. -->
Reported by: [mglaman](https://www.drupal.org/user/2416470)
Related to !109
>>>
<p>[Tracker]<br>
<strong>Update Summary: </strong>[One-line status update for stakeholders]<br>
<strong>Check-in Date: </strong>MM/DD/YYYY<br>
<strong>Blocked by: </strong>[#XXXXXX] (New issues on new lines)<br>
<strong>Additional Collaborators: </strong> @username1, @username2<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>When installing from existing config, ai_context_install calls code which modifies config and assumes config/install from the module ran. Specifically _ai_context_add_to_workflow leading to an exception when dependencies are calculated:</p>
<pre>throw new \LogicException(sprintf('Missing bundle entity, entity type %s, entity id %s.', $bundle_entity_type_id, $bundle));</pre><p>That's because ai_context.ai_context_item_type.default was not imported (yet)</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Check if config is syncing before performing these operations.</p>
<pre>function ai_context_install(bool $is_syncing): void {<br> if ($is_syncing) {<br> return;<br> }</pre><h3 id="summary-remaining-tasks">Target date or deadline</h3>
<h3 id="summary-remaining-tasks">Remaining tasks</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>
issue