hook_ai_context_scope_values_alter() is not honored in scope value forms
## Problem/Motivation While integrating ai_context into the AI Empathy Evaluation module (#3583739, built on the convenience API from #3584838), the main friction was extending scope values. A downstream module that wants to add a custom value — e.g. an "empathy_evaluation" use case — has no working extension point. hook_ai_context_scope_values_alter() looks like the intended mechanism, but it is only invoked in AiContextScopeManager::getAllScopeValues(), and nothing in the module consumes getAllScopeValues(). The scope subscription UI (AiContextAgentForm) and the context item form (AiContextItemForm) both build their checkboxes from the scope plugin's raw getValues() via AiContextScopeBase::buildValueForm(), which never sees the alter. As a result a value added through the documented hook appears nowhere a user can select it. Relatedly, AiContextScopeUseCase::getValues() is hardcoded (writing_words, working_in_canvas) with no first-class way to extend it, so even setting aside the alter, there is no supported path to contribute a use case. ## Steps to reproduce 1. Implement hook_ai_context_scope_values_alter() to add a value to the 'use_case' scope. 2. Edit a context item (or an agent's scope subscriptions). 3. The new value is absent from the use_case checkboxes. ## Current workaround In ai_empathy we re-apply getAllScopeValues() onto the built widget's #options in our own hook_form_alter() — for both our own form and the ai_context item form. It works, but every consumer has to reinvent it, and altering ai_context's form from a downstream module is fragile. ## Proposed resolution Make the alter authoritative end-to-end. Either: - Have AiContextScopeBase::buildValueForm() build its #options from the alter-aware value set (e.g. via the scope manager) so both the item and agent forms pick up altered values automatically; or - Apply the alter inside getValues() (or a shared wrapper the forms call) so getValues() and getAllScopeValues() cannot diverge. hook_ai_context_scope_values_alter() should then be the single reliable way to extend scope values, reflected in every form that lets a user pick them. ## Remaining tasks - Decide where the alter is applied (form vs getValues()). - Update AiContextItemForm and AiContextAgentForm to use alter-aware values. - Add test coverage for a module-added use_case value appearing in both forms. ## User interface changes None for existing setups; custom scope values added by other modules become selectable.
issue