fix(agent): set TenantID on streaming events in runLoop emitRun (#445)

The emitRun wrapper in runLoop (loop.go) is missing TenantID, causing
all streaming events (chunk, thinking, tool.call) to be emitted with
TenantID=Nil. The event filter (event_filter.go:43-44) blocks unscoped
events for non-admin clients, so tenant-bound API key users receive no
streaming — only run.started and run.completed (emitted from Run() in
loop_run.go which already sets TenantID).

Fix: add event.TenantID = l.tenantID, matching the pattern in
loop_run.go's emitRun wrapper.
This commit is contained in:
therichardngai-code authored and GitHub committed 2026-03-24 21:14:48 +07:00
1 parent af3fe2fe08
commit 00db30c2d1
1 file changed
+1
+1
View File
@@ -37,6 +37,7 @@ func (l *Loop) runLoop(ctx context.Context, req RunRequest) (*RunResult, error)
event.UserID = req.UserID
event.Channel = req.Channel
event.ChatID = req.ChatID
event.TenantID = l.tenantID
l.emit(event)
}