Skip to content

llm.log is spammed with "No access to Duo Chat" messages

I noticed while trying to enable Amazon Q, the logs are filled with No access to Duo Chat messages.

It looks like this is triggered whenever the sidebar helper checks if TanukiBot is enabled for that project:

/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/llm/chain/utils/chat_authorizer.rb:42:in `user'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/llm/tanuki_bot.rb:12:in `enabled_for?'
/opt/gitlab/embedded/service/gitlab-rails/ee/app/helpers/ee/sidebars_helper.rb:40:in `super_sidebar_context'
/opt/gitlab/embedded/service/gitlab-rails/app/views/layouts/_page.html.haml:8:in `_app_views_layouts__page_html_haml___521795682326061347_833920'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/base.rb:244:in `public_send'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/base.rb:244:in `_run'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/template.rb:157:in `block in render'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activesupport-7.0.8.6/lib/active_support/notifications.rb:208:in `instrument'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/template.rb:361:in `instrument_render_template'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/template.rb:155:in `render'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/renderer/partial_renderer.rb:251:in `block in render_partial_template'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activesupport-7.0.8.6/lib/active_support/notifications.rb:208:in `instrument'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/renderer/partial_renderer.rb:246:in `render_partial_template'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/renderer/partial_renderer.rb:237:in `render'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/renderer/renderer.rb:81:in `render_partial_to_object'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/renderer/renderer.rb:53:in `render_partial'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/helpers/rendering_helper.rb:44:in `render'
/opt/gitlab/embedded/service/gitlab-rails/app/views/layouts/application.html.haml:16:in `_app_views_layouts_application_html_haml__4336139261339718420_833680'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/base.rb:244:in `public_send'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/base.rb:244:in `_run'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/template.rb:157:in `block in render'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activesupport-7.0.8.6/lib/active_support/notifications.rb:208:in `instrument'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/template.rb:361:in `instrument_render_template'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/template.rb:155:in `render'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionview-7.0.8.6/lib/action_view/renderer/template_renderer.rb:65:in `block (2 levels) in render_template'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activesupport-7.0.8.6/lib/active_support/notifications.rb:206:in `block in instrument'
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activesupport-7.0.8.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'

It seems that whenever no_access_message is called, it is logged: https://gitlab.com/gitlab-org/gitlab/-/blob/c50c8a581372fc65287c7432ef0d2ea8dd1111cd/ee/lib/gitlab/llm/utils/authorizer.rb#L64-67

@mksionek @jessieay Can we drop this, or make the log message optional here?