Skip to content

bug: GET/PUT /api/agents/{name}/capabilities 500 — get_full_capabilities/set_full_capabilities not delegated onto DatabaseManager facade (#1093, v0.6.1) #1200

Closed

Description

@vybe

Summary

GET and PUT /api/agents/{name}/capabilities both return HTTP 500 on the v0.6.1 (#1093 SQLAlchemy-Core / db-decomposition) release. The handlers call db.get_full_capabilities(...) / db.set_full_capabilities(...) on the DatabaseManager facade, but those methods were never delegated onto the facade — they live only on the SecurityMixin that AgentOperations (db._agent_ops) composes. Result: AttributeError, so an agent's full-capabilities setting can be neither read nor changed via the API/UI. Backend-independent (pure Python facade gap; reproduces on SQLite and PostgreSQL).

Component

Backend / Agent Config (DatabaseManager facade)

Priority

P2

Error

AttributeError: 'DatabaseManager' object has no attribute 'get_full_capabilities'
  File "routers/agent_config.py", line 288, in get_agent_capabilities
    db_full_caps = db.get_full_capabilities(agent_name)

(PUT path fails identically on db.set_full_capabilities(agent_name, full_caps).)

Location

  • File: src/backend/routers/agent_config.py
  • Lines: ~288 (GET, db.get_full_capabilities) and ~331 (PUT, db.set_full_capabilities)
  • Missing on: src/backend/database.py (DatabaseManager facade)
  • Methods exist on: src/backend/db/agent_settings/security.py (SecurityMixin.get_full_capabilities / set_full_capabilities), mixed into AgentOperations

Root Cause

During the #1093 db decomposition, DatabaseManager exposes most sub-operations via explicit passthrough methods (e.g. get_read_only_mode → self._agent_ops.get_read_only_mode). The capabilities pair was missed: get_full_capabilities / set_full_capabilities exist on SecurityMixin (and thus on self._agent_ops at runtime) but have no delegating method on DatabaseManager. The routers call them on the facade, so every call raises AttributeError.

Verified at runtime: hasattr(db._agent_ops, "get_full_capabilities") → True, hasattr(db, "get_full_capabilities") → False.

Reproduction Steps

  1. Deploy Trinity at a commit including the #1093 db decomposition (v0.6.1).
  2. Register/start any agent.
  3. As an admin, GET /api/agents/<agent_name>/capabilities.
  4. Observe HTTP 500 with AttributeError: 'DatabaseManager' object has no attribute 'get_full_capabilities'.
  5. PUT /api/agents/<agent_name>/capabilities with {"full_capabilities": true} fails the same way on set_full_capabilities.

Suggested Fix

Add the two passthrough delegations to DatabaseManager (alongside the other self._agent_ops delegations such as get_read_only_mode):

def get_full_capabilities(self, agent_name: str) -> bool:
    return self._agent_ops.get_full_capabilities(agent_name)

def set_full_capabilities(self, agent_name: str, enabled: bool) -> bool:
    return self._agent_ops.set_full_capabilities(agent_name, enabled)

The underlying SecurityMixin implementations already exist, so this is purely restoring the facade passthrough.

Environment

  • Trinity version: v0.6.1 (bd11ea96)
  • Backend: FastAPI + decomposed db/ operations (#1093)
  • Reproduced on SQLite and PostgreSQL

Related

Activity

  1. added
    priority-p2
    type-bug
    theme-reliability
    complexity-low
    on Jun 13, 2026
  2. added
    status-ready
    and removed on Jun 14, 2026
  3. added
    status-in-progress
    and removed
    status-ready
    on Jun 15, 2026
  4. self-assigned this
    on Jun 15, 2026
  5. added
    status-in-dev
    and removed
    status-in-progress
    on Jun 22, 2026
  6. removed
    status-in-dev
    on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-lowpriority-p2theme-reliabilitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions