gate: API main.py flush+rollback after plugin activation for RLS error handling

This commit is contained in:
Agent Zero
2026-07-31 09:32:15 +02:00
parent 9d7b160e2a
commit 31d11efd33
+4 -1
View File
@@ -227,8 +227,11 @@ async def lifespan(app: FastAPI):
try:
await set_tenant_context(db, tenant_id)
await plugin.on_activate(db, container, event_bus)
# Flush to detect any RLS errors that were swallowed by the plugin
await db.flush()
except Exception as exc:
logger.error(f"[STARTUP] Failed to activate plugin {name} for tenant {tenant_id}: {exc}")
logger.warning(f"[STARTUP] Plugin {name} activation issue for tenant {tenant_id}: {exc}")
await db.rollback()
activation_failed = True
break