gate: worker flush after plugin activation to detect swallowed RLS errors

This commit is contained in:
Agent Zero
2026-07-31 09:19:45 +02:00
parent ec0cf6f588
commit ab61c81d2b
+3 -1
View File
@@ -147,10 +147,12 @@ async def on_startup(ctx: dict[str, Any]) -> None:
try: try:
await set_tenant_context(db, tenant_id) await set_tenant_context(db, tenant_id)
await plugin.on_activate(db, container, event_bus) 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: except Exception as exc:
# RLS may block duplicate cron job inserts — rollback and continue # RLS may block duplicate cron job inserts — rollback and continue
# The cron jobs are already registered from the API container startup # The cron jobs are already registered from the API container startup
logger.warning(f"Worker: plugin {name} activation failed for tenant {tenant_id}: {exc}") logger.warning(f"Worker: plugin {name} activation issue for tenant {tenant_id}: {exc}")
await db.rollback() await db.rollback()
activation_failed = True activation_failed = True
break break