Skip to content

bug: Slack integration fails - missing get_user_agent_access_level method #48

Closed

Description

@vybe

Summary

The Slack integration for public links fails with an AttributeError. The slack.py router calls db.get_user_agent_access_level() which doesn't exist on the DatabaseManager class. This prevents users from connecting public agent links to Slack channels.

Component

Backend / Slack Router

Priority

P1

Error

AttributeError: 'DatabaseManager' object has no attribute 'get_user_agent_access_level'

Full traceback:

File "/app/routers/slack.py", line 425, in get_slack_connection_status
    access = db.get_user_agent_access_level(current_user.id, name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DatabaseManager' object has no attribute 'get_user_agent_access_level'

Location

  • File: backend/routers/slack.py
  • Lines: 425, 461, 497, 525
  • Functions: get_slack_connection_status, initiate_slack_oauth, and 2 others

Root Cause

The Slack router references a method get_user_agent_access_level() that was never implemented in the DatabaseManager class. This appears to be incomplete code - the Slack feature was added but the required database method wasn't created.

Reproduction Steps

  1. Deploy Trinity with Slack credentials configured
  2. Create a public link for an agent
  3. Attempt to connect the public link to Slack via the UI
  4. Check backend logs - observe AttributeError

Suggested Fix

Either:

  1. Implement the missing method in database.py / db_manager.py:
def get_user_agent_access_level(self, user_id: int, agent_name: str) -> str:
    # Check agent ownership and permissions
    # Return access level: "owner", "admin", "operator", "viewer", or None
    ...
  1. Or use existing access check pattern from other routers if one exists.

Environment

  • Trinity version: 77c45e4
  • Docker version: 24.0+
  • OS: Ubuntu 22.04

Related

  • Affected file: backend/routers/slack.py
  • Database module: backend/database.py

Activity

  1. vybe commented on Mar 1, 2026

    @vybe
    ContributorAuthor

    Fixed in commit. Replaced non-existent db.get_user_agent_access_level() calls with existing codebase patterns:

    • GET endpoint (read access): Uses db.can_user_access_agent(current_user.username, name)
    • POST/PUT/DELETE endpoints (owner access): Uses db.can_user_share_agent(current_user.username, name)

    This aligns with how all other routers (agents, schedules, subscriptions, etc.) handle agent access control. No new methods were needed - the existing can_user_access_agent and can_user_share_agent methods already provide the necessary functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority-p1type-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions