Agent ModelOwner missing description_override handling and str_contains safety check for tool settings
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3567232. --> Reported by: [yautja_cetanu](https://www.drupal.org/user/626050) Related to !228 >>> <h3>Problem/Motivation</h3> <p>The Agent ModelOwner in <code>Agent.php</code> was updated to handle most behavioral tool settings (<code>return_directly</code>, <code>require_usage</code>, <code>use_artifacts</code>, <code>progress_message</code>), but two issues remain:</p> <ol> <li><strong>Missing description_override</strong>: The <code>description_override</code> field is not extracted to <code>tool_settings</code> and not removed before property restriction processing. This causes it to be passed to the foreach loop where <code>explode('___', 'description_override')</code> fails.</li> <li><strong>No safety check for malformed keys</strong>: If any key without <code>___</code> separator reaches the foreach loop, the <code>explode()</code> call produces a single-element array, causing PHP errors or malformed config entries.</li> </ol> <h3>Steps to reproduce</h3> <ol> <li>Use the Modeler API (e.g., FlowDrop UI or BPMN.io) to save an agent with a tool that has <code>description_override</code> set</li> <li>The save will either fail with a PHP error or create malformed config in <code>tool_usage_limits</code></li> </ol> <h3>Expected behavior</h3> <p><code>description_override</code> should be saved to <code>tool_settings</code> alongside other behavioral settings:</p> <pre> tool_settings: 'tool:entity_bundle_list': return_directly: 0 require_usage: 0 use_artifacts: 0 description_override: 'Custom description here' progress_message: '' </pre><h3>Actual behavior</h3> <p><code>description_override</code> is passed through to the property restriction loop, causing either:</p> <ul> <li>PHP error from <code>explode('___', 'description_override')</code> not having enough elements</li> <li>Malformed entry in <code>tool_usage_limits</code> like <code>{'': 'value'}</code></li> </ul> <h3>Proposed resolution</h3> <ol> <li>Add <code>description_override</code> to the <code>elementSettings</code> array extraction (line 486)</li> <li>Add <code>unset($config['description_override'])</code> before the foreach loop</li> <li>Add a <code>str_contains($key, '___')</code> check at the start of the foreach loop to skip any keys that don't match the expected property restriction format</li> </ol> <h3>Remaining tasks</h3> <ul> <li>Review patch</li> <li>Test with Modeler API implementations (FlowDrop, BPMN.io)</li> <li>Commit</li> </ul>
issue