Repository navigation
fix: a plugin dependency cycle no longer stops every plugin from loading - #75
Open
theLeverager1705 wants to merge 1 commit into
Open
theLeverager1705 wants to merge 1 commit into
theLeverager1705 wants to merge 1 commit into
Conversation
sortByDependencies threw on a dependency cycle and loadAll does not catch it, so one installed plugin whose manifest names itself (or a peer that names it back) in dependsOn, dependencies or engines.plugins aborted the whole load. At boot that rejects startADB(), and the process exits before the dashboard starts listening. Dashboard installs are recorded in data/installed-plugins.json before loadAll runs, so reconcile reinstalls the plugin on every restart and the container crash-loops until someone removes it by hand. The same walk also ignored the disabled flag on a plugin skipped for a missing dependency: if another plugin depended on it, visit() still put it in the load order, so it loaded anyway, and so did its dependents. visit() now reports whether each plugin can load. Cycle members are skipped with the cycle path in the log, and a plugin whose dependency was skipped is skipped too, whatever the discovery order. Healthy plugins load as before, and command collection still refuses to deploy an incomplete set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #73.
sortByDependencies()threw on a dependency cycle and nothing above it catches the error. So one plugin whose manifest names itself, or a peer that names it back, stopped every plugin from loading. At boot the bot exits before the dashboard comes up. After a dashboard install it crash-loops, because the install is persisted beforeloadAll()runs. The issue has the full trace with line references.The same walk also ignored
disabled: a plugin skipped for a missing dependency still loaded whenever another plugin depended on it.What changed
All changes are in
sortByDependencies()incore/PluginManager.js(+20 / −10):visit()now returns whether a plugin can load. When it hits a cycle it logs the path, marks every member disabled, and moves on:Skipping plugins in circular dependency: adb-plugin-a -> adb-plugin-b -> adb-plugin-aloadAll()already refuses to deploy when any discovered plugin is disabled, sodeploy-commands.jsstill won't push an incomplete set. I only reworded its message to "missing or circular plugin dependencies", since it now covers both.No changes to the manifest format, the plugin API, or the dashboard.
How I tested it
Five new tests in
test/pluginManager.test.js:loadAll()against realadb-plugin-*packages in a tempnode_modules, one cycle: resolves, healthy plugin loadsFull suite on Linux (GitHub Actions on my fork, with the workflow from #76): 488/488 on Node 20, 22 and 24, plus the dashboard check (15/15) and production build.
Run: https://github.com/theLeverager1705/Advanced-Discord-Bot/actions/runs/39145211627
Locally on Windows with Node 24, 485/488 pass. The 3 failures fail on
mainon this machine too: the symlink discovery test needs Windows developer mode, and two deploy-CLI tests hit their 10 s spawn timeout on a slow disk. All of them pass on Linux.I didn't test against a live guild because the change doesn't touch any Discord-facing code path. It only changes which plugins
loadAll()hands toloadPlugin().Type of change
Checklist
core/, 2-space in this test file)visit()returns and why)Reviewer notes
dependsOn/dependenciesentry could still load if something depended on it. Now it never loads, and neither do its dependents. Forengines.pluginsedgescheckEngines()already refused them at load time, so nothing changes there.lastErrorwould be a useful follow-up, but it changes howloadAll()interacts with the install and update flows, so I kept it out of this PR.🤖 Generated with Claude Code