Access check is making page to be uncacheable

Created on 21 May 2025, 14 days ago

Problem/Motivation

Found that when the ai.admin_providers and the ai.admin_vdb_providers menu links are rendered, like on the admin toolbar, the page cache becomes uncacheable. After some research I found that the access checker for providers and vdb_providers are trying to add user account cache metadata to the result but the user account does not implement the `CacheableDependencyInterface` and so it is just setting max-age to 0. That is making the page cache to become uncacheable.

Steps to reproduce

Enable the ai module and load pages with a user that has permission to render ai menu links. When these menu items are rendered, the page cache should be uncacheable.

Proposed resolution

The main reason to add user cache metadata at this point is to make the result vary based on user. This can also be achieved by adding the `user.permissions` cache context.

Remaining tasks

Remove the `addCacheableDependency` for the user account and add the `user.permissions` cache context instead.

🐛 Bug report
Status

Active

Version

1.0

Component

AI Core module

Created by

🇦🇷Argentina emacoti

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024