-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails 6 Zeitwerk Mode for Dependencies Autoloading breaks external Agents #2845
Comments
Current workaround is to opt-out of Zeitwerk Mode adding config.autoloader = :classic to |
Hmm this is odd I am using a bunch of Agent gems in production and don't seem to have any issues with it. In which environments are you seeing the issue? |
I too have a production system that kept/keeps chugging along and drove me nuts when suddenly (upgrade to Rails 6) I could no longer develop locally external gems! I just looked at your commits and on May 26th you did force |
Urg, that is annoying I thought I still had Agent gems active in my development environment. I guess the auto-reloader changed in some way that it breaks.I think we should still try to support the new autoloader because I am assuming Rails will get rid of the old one at some point, but I don't know when I have the time to work on it. |
@dsander - now that |
Sure, that would be great! |
Patch is ready and quite simple (example below). As soon the change in def types
all_agents.map(&:constantize)
end
def all_agents
const_get(:TYPES) + HuginnAgent.additional_agents
end
def valid_type?(type)
all_agents.include?(type)
end |
That's great! Can you open a PR to Huginn as well? You can switch the branch of |
External agents which rely on
huginn_agent
are loaded during initialization and injected inAgent::TYPES
.Rails 6 implements a new dependencies autoloading system called Zeitwerk Mode.
Unfortunately this change breaks
huginn_agent
paradigm becauseAgent::TYPES
will be rebuild from scratch after initialization and only contain default agents.It also generates a lengthy warning when running tests
The text was updated successfully, but these errors were encountered: