Enabling YJIT via Template Doesn't Work

I’m sorry, I’ve figured it out.

sudo -u discourse scrubs the env. Using the -E flag brings the normal env along, and in that case sudo -E -u discourse RAILS_ENV=production bundle exec rails runner 'puts "YJIT enabled: #{RubyVM::YJIT.enabled?}"; puts RUBY_DESCRIPTION' returns

YJIT enabled: true
ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +YJIT +PRISM [x86_64-linux]

With just the template added.

I apologise for wasting your time, and have marked your response as the solution. Sorry about this. Thank you for investigating and taking the time to respond.