From 4cdbcb63e66a7a874e9fb12ec83af767160c96c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20S=C3=A1nchez?= Date: Thu, 3 Sep 2026 22:30:44 -0600 Subject: [PATCH] fix[backend](soar): command line add tenant id on context --- backend/modules/soar/handler/command_ws.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/modules/soar/handler/command_ws.go b/backend/modules/soar/handler/command_ws.go index 2f76e07a1..a073aa9a6 100644 --- a/backend/modules/soar/handler/command_ws.go +++ b/backend/modules/soar/handler/command_ws.go @@ -195,8 +195,11 @@ func (h *CommandWSHandler) CommandStream(c *gin.Context) { return } // A fresh context: ctx is cancelled by the time this runs on a - // disconnect, and the row still has to be closed. - done, cancelDone := context.WithTimeout(context.Background(), 5*time.Second) + // disconnect, and the row still has to be closed. The tenancy GORM + // callback needs the acting tenant in the context, so carry it over + // from the actor — a bare context.Background() fails the update with + // ErrNoTenant whenever multi-tenancy is enabled. + done, cancelDone := context.WithTimeout(authz.WithTenantID(context.Background(), actor.TenantID), 5*time.Second) defer cancelDone() _ = h.executionUC.FinishManual(done, execID, status, collected.String()) }