Skip to content

[Bug]: Agent Cannot be shared for internal users + upload for File Search only avaiable after create agent #9813

Description

@SharpLu

What happened?

  1. Agent Sharing Not Working
  • Users cannot share agents with other users, even though the share button is visible
  • Root cause: Default USER role lacks SHARED_GLOBAL permission
  • Other users cannot see shared agents in the marketplace
  1. File Upload UX Issue
  • Files can only be uploaded AFTER creating an agent
  • Users must first save the agent, then edit it to add files
  • This creates a confusing two-step process

Affected Files

  • /packages/data-provider/src/roles.ts - Missing default permissions
  • /packages/api/src/app/permissions.ts - Incomplete permission initialization
  • /api/server/controllers/agents/v1.js - Agent creation/sharing logic

Root Cause Analysis

// Current DEFAULT permissions for USER role
[SystemRoles.USER]: {
permissions: {
[PermissionTypes.AGENTS]: {}, // Empty - no permissions!
[PermissionTypes.PEOPLE_PICKER]: {
[Permissions.VIEW_USERS]: false, // Cannot view users to share with
},
[PermissionTypes.MARKETPLACE]: {
[Permissions.USE]: false, // Cannot access marketplace
},
}
}

Proposed Fix

Quick Fix (for users):
// Update MongoDB directly
db.roles.updateOne(
{ name: 'USER' },
{
$set: {
'permissions.AGENTS.SHARED_GLOBAL': true,
'permissions.AGENTS.USE': true,
'permissions.AGENTS.CREATE': true,
'permissions.PEOPLE_PICKER.VIEW_USERS': true,
'permissions.MARKETPLACE.USE': true
}
}
)

Permanent Fix (for codebase):

  1. Update default USER permissions in /packages/data-provider/src/roles.ts
  2. Add SHARED_GLOBAL permission initialization in /packages/api/src/app/permissions.ts
  3. Allow file uploads during agent creation, not just after

Impact

  • All LibreChat deployments with agent functionality enabled
  • Users expecting agent sharing to work out-of-the-box
  • Affects collaboration features

Workaround

Enable in config:
ALLOW_SHARED_LINKS: "true"
Then manually update database permissions as shown above.

Image

Version Information

version docker-ghcr-io/danny-avila/librechat:v0.8.0-rc3

Steps to Reproduce

  1. Create agent from marketplace
  2. Share with your internal users
  3. they can't access this agent
  4. even for user yourself you need using the shared url can able to chat

What browsers are you seeing the problem on?

Chrome

Relevant log output

the screen has been attached. free to ping me if like to repeat this issue.

Screenshots

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions