ai_chatbot_page_attachments() causes UNCACHEABLE pages due to missing theme cache context
## Problem When the ai_chatbot module is enabled, all pages return X-Drupal-Dynamic-Cache: UNCACHEABLE. The cause is ai_chatbot_page_attachments() in ai_chatbot.module: ```php function ai_chatbot_page_attachments(array &$attachments) { $theme = \Drupal::theme()->getActiveTheme()->getName(); $attachments['#attached']['drupalSettings']['theme'] = $theme; } ``` The hook attaches a drupalSettings value that depends on the active theme, but does\ not declare the theme cache context. This causes Drupal's render pipeline to be unable to determine the cacheability of the page, resulting in max-age: 0 and UNCACHEABLE. Steps to reproduce 1. Enable ai_chatbot module 2. Request any page as anonymous user 3. Observe X-Drupal-Dynamic-Cache: UNCACHEABLE (poor cacheability) in response headers ## Fix Add the theme cache context to the hook: ``` function ai_chatbot_page_attachments(array &$attachments) { $theme = \Drupal::theme()->getActiveTheme()->getName(); $attachments['#attached']['drupalSettings']['theme'] = $theme; $attachments['#cache']['contexts'][] = 'theme'; } ```
issue