From ab8d878bc731669262d26b0b991d573ebb7a4ac4 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Fri, 31 Jul 2026 09:41:32 +0200 Subject: [PATCH] gate: db.expunge_all() after rollback to clear pending objects from failed INSERTs --- app/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/main.py b/app/main.py index 16ee15d..be7e79d 100644 --- a/app/main.py +++ b/app/main.py @@ -233,10 +233,12 @@ async def lifespan(app: FastAPI): except Exception as exc: logger.warning(f"[STARTUP] Plugin {name} activation issue for tenant {tenant_id}: {exc}") await db.rollback() + db.expunge_all() # Clear pending objects from failed INSERT break except Exception as exc: logger.warning(f"[STARTUP] Plugin {name} activation failed: {exc}") await db.rollback() + db.expunge_all() plugin_record.status = "active" logger.info(f"[STARTUP] Activated plugin: {name}")