From f348a5fea720430123786ed6d90901aa543fe074 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Fri, 21 Aug 2026 02:24:40 +0200 Subject: [PATCH] fix(critical): auto-install + activate discovered plugins in prestart.sh New plugins (self_improvement, knowledge) were discovered but never activated in the production DB. prestart.sh now auto-installs and activates all discovered builtin plugins on every container start. --- prestart.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/prestart.sh b/prestart.sh index 1c85fdd..cf27e81 100644 --- a/prestart.sh +++ b/prestart.sh @@ -107,6 +107,37 @@ python3 /app/scripts/sync_plugin_schema.py echo "[prestart] Seeding admin user if not exists..." python3 /app/scripts/seed_admin.py || echo "[prestart] WARNING: Admin seed failed (may already exist)" +echo "[prestart] Auto-installing and activating discovered plugins..." +python3 -c " +import asyncio +from app.plugins.registry import get_registry +from app.core.db import async_session_factory +from sqlalchemy import select +from app.models.plugin import Plugin as PluginModel + +async def auto_activate_plugins(): + r = get_registry() + discovered = r.discover_builtins() + async with async_session_factory() as db: + for name in discovered: + result = await db.execute(select(PluginModel).where(PluginModel.name == name)) + record = result.scalar_one_or_none() + try: + if record is None: + await r.install(db, name) + await r.activate(db, name) + print(f'[prestart] Installed + activated plugin: {name}') + elif not record.active: + await r.activate(db, name) + print(f'[prestart] Activated plugin: {name}') + except Exception as e: + print(f'[prestart] WARNING: Could not activate plugin {name}: {e}') + await db.commit() + print('[prestart] Plugin auto-activation complete.') + +asyncio.run(auto_activate_plugins()) +" || echo "[prestart] WARNING: Plugin auto-activation failed" + echo "[prestart] Starting uvicorn on 0.0.0.0:8000 (workers=1)..." exec uvicorn app.main:app \ --host 0.0.0.0 \