Repository navigation
Description
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(DatabaseManagerfacade) - Methods exist on:
src/backend/db/agent_settings/security.py(SecurityMixin.get_full_capabilities/set_full_capabilities), mixed intoAgentOperations
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
- Deploy Trinity at a commit including the
#1093db decomposition (v0.6.1). - Register/start any agent.
- As an admin,
GET /api/agents/<agent_name>/capabilities. - Observe HTTP 500 with
AttributeError: 'DatabaseManager' object has no attribute 'get_full_capabilities'. PUT /api/agents/<agent_name>/capabilitieswith{"full_capabilities": true}fails the same way onset_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
src/backend/database.py(DatabaseManager)src/backend/db/agent_settings/security.py(SecurityMixin)src/backend/routers/agent_config.py(get_agent_capabilities,set_agent_capabilities)- Sibling
#1093db-facade regression: bug: GET /api/ops/auth-report 500s — SQLAlchemy auto-correlation in get_agent_subscription (#1093, v0.6.1) #1199 (get_agent_subscriptionauto-correlation). Same release; worth a sweep for other un-delegated facade methods.
Activity
fix(db): delegate get/set_full_capabilities onto DatabaseManager faca…