fix: plugin duplicate route registration + prestart.sh Python instead of psql + SMTP in docker-compose
Check Cross-Plugin Imports / check (push) Has been cancelled

This commit is contained in:
Agent Zero
2026-07-29 12:48:25 +02:00
parent de53bcff25
commit fd1a170f31
3 changed files with 49 additions and 10 deletions
+9
View File
@@ -615,6 +615,15 @@ class PluginRegistry:
routers = plugin.get_routes()
mounted_routes: list[Any] = []
for router in routers:
# Check if routes from this router are already registered (P1.2 fix)
# This prevents duplicate route registration when plugins are
# statically registered in main.py AND dynamically activated
existing_paths = {getattr(r, 'path', None) for r in self._app.router.routes}
router_paths = {getattr(r, 'path', None) for r in router.routes}
if router_paths & existing_paths:
# Routes already registered — skip to avoid duplicates
logger.debug("Plugin '%s' routes already registered, skipping", name)
continue
# Snapshot existing route object IDs before inclusion
existing_ids = {id(r) for r in self._app.router.routes}
self._app.include_router(router)