From 31d11efd334840a6d22fd0ed851de3b60ee344e4 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Fri, 31 Jul 2026 09:32:15 +0200 Subject: [PATCH] gate: API main.py flush+rollback after plugin activation for RLS error handling --- app/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 70b15e4..c4c04b5 100644 --- a/app/main.py +++ b/app/main.py @@ -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