-
-
Notifications
You must be signed in to change notification settings - Fork 71
Description
activeagent 0.6.3 breaks production boot with Zeitwerk NameError
Environment
- Ruby: 3.4.6
- Rails: 8.0.4
- activeagent: 0.5.0 → 0.6.3 (upgrade caused the issue)
- Zeitwerk: 2.7.3
- Environment: Production only (eager loading enabled)
Issue Description
Upgrading from activeagent 0.5.0 to 0.6.3 causes Rails to fail to boot in production mode with a Zeitwerk NameError. The application boots fine in development mode (lazy loading) but crashes during eager loading in production.
Error Message
/home/ray/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/callbacks.rb:31:in
'Zeitwerk::Loader::Callbacks#on_file_autoloaded': expected file
/path/to/app/controllers/ai_assistant_controller.rb to define constant AIAssistantController, but didn't (Zeitwerk::NameError)
Steps to Reproduce
- Create a Rails 8.0.4 application with Ruby 3.4.6
- Add activeagent 0.6.3 to Gemfile
- Create a controller with "ai_" prefix in the filename (e.g.,
ai_assistant_controller.rbdefiningAiAssistantController) - Try to boot in production mode:
RAILS_ENV=production bundle exec rails runner "puts 'test'"
Expected Behavior
Application should boot successfully in production mode, just as it does with activeagent 0.5.0.
Actual Behavior
Zeitwerk throws a NameError expecting AIAssistantController (with both letters capitalized) instead of AiAssistantController (standard Ruby class naming).
Analysis
The issue appears to be related to how activeagent 0.6.3 handles inflections or Zeitwerk autoloading. Specifically:
- Works in development (lazy loading) - controllers load on-demand without issue
- Fails in production (eager loading) - Zeitwerk's eager loader expects different constant names
- Version specific - activeagent 0.5.0 works perfectly, 0.6.3 breaks
The error suggests that activeagent 0.6.3 may have introduced:
- Custom inflection rules (e.g.,
inflect.acronym "AI") - Changes to Zeitwerk configuration
- Modifications that affect constant name resolution during eager loading
Workaround
Downgrade to activeagent 0.5.0:
gem "activeagent", "~> 0.5.0"Additional Context
- The issue is not caused by Rails 8.0.4 or Ruby 3.4.6 upgrades
- Confirmed by git bisect: the activeagent gem update is the sole cause
- Multiple controllers with "ai_" prefix are affected
- Clearing bootsnap cache does not resolve the issue
Questions
- Did activeagent 0.6.x introduce any inflection rules or Zeitwerk configuration changes?
- Are there any known compatibility issues with Rails 8.0.4 + Zeitwerk 2.7.3?
- Is there a migration guide for upgrading from 0.5.0 to 0.6.3?
Request
Could you please investigate what changed between 0.5.0 and 0.6.3 that would cause Zeitwerk to expect different constant names during eager loading? A changelog or migration guide would be very helpful.
Thank you!