fix(agent): remove unused RunnableByViewer gate blocking viewer chat

The runnable_by_viewer field was never populated for built-in agents,
so TenantRoleViewer users always hit 403 on agent-chat. Drop the field
and RBAC check so agent-chat matches knowledge-chat access for viewers.
This commit is contained in:
wizardchen
2026-06-23 18:19:17 +08:00
committed by lyingbug
parent 35f717f7fa
commit be26563f86
4 changed files with 66 additions and 109 deletions
+2 -3
View File
@@ -503,9 +503,8 @@ func CloneContext(ctx context.Context) context.Context {
// active tenant (PR 2 #1303). Must be propagated for the same
// reason as TenantIDContextKey — any handler that does
// `ctx := logger.CloneContext(c.Request.Context())` and then
// reads role via TenantRoleFromContext (e.g. session/qa.go's
// "viewer cannot run runnable_by_viewer=false agent" gate)
// would otherwise see the type-zero TenantRole and fall back
// reads role via TenantRoleFromContext would otherwise see the
// type-zero TenantRole and fall back
// to Viewer, blocking even Owners.
types.TenantRoleContextKey,
types.LanguageContextKey,