Skip to content

activeagent 0.6.3 breaks production boot with Zeitwerk NameError #276

@RayNawara

Description

@RayNawara

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

  1. Create a Rails 8.0.4 application with Ruby 3.4.6
  2. Add activeagent 0.6.3 to Gemfile
  3. Create a controller with "ai_" prefix in the filename (e.g., ai_assistant_controller.rb defining AiAssistantController)
  4. 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:

  1. Works in development (lazy loading) - controllers load on-demand without issue
  2. Fails in production (eager loading) - Zeitwerk's eager loader expects different constant names
  3. 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

  1. Did activeagent 0.6.x introduce any inflection rules or Zeitwerk configuration changes?
  2. Are there any known compatibility issues with Rails 8.0.4 + Zeitwerk 2.7.3?
  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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions