Allow Field Widget Actions to target a specific automator
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3571915. -->
Reported by: [oneliner](https://www.drupal.org/user/1781526)
>>>
<p>[Tracker]<br>
<strong>Update Summary: </strong>Fix enables multiple field widget action buttons to run only their selected automator.<br>
<strong>Short Description: </strong>Field widget actions trigger all automators on a field instead of the selected one.<br>
<strong>Check-in Date: </strong>02/06/2026<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>It’s possible (though not exposed by the default UI) to configure multiple AI automators for the same field by duplicating the automator config entity with a different ID suffix. In that setup, clicking one Field Widget Action button can run all automators or the wrong automator. This prevents having separate actions like Translate and Summarize on the same field.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4>
<p>1. Enable ai, ai_automators, and field_widget_actions modules.<br>
2. Configure two AI automators for the same field (e.g., node.hg_post.body) by duplicating the automator config with a different ID suffix.<br>
3. Add both automators as Field Widget Actions on the form display.<br>
4. Edit a node and click one of the automator buttons.</p>
<p>Expected: Only the selected automator runs.<br>
Actual: All automators run or a different automator runs, overwriting the field.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Pass the selected automator_id into AiAutomatorEntityModifier::saveEntity() and filter the automator list to the matching ID before processing. Guard against missing automators in the widget action handler.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>- Upload patch and request review.<br>
- Add automated test coverage if maintainers request it.</p>
<h3>Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)</h3>
<p>No UI changes. API change: saveEntity() gains an optional $specificAutomatorId parameter.</p>
<h3 id="summary-ai-usage">AI usage (if applicable)</h3>
<p>[x] 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>[x] 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