Skip to content

fix(db): delegate get/set_full_capabilities onto DatabaseManager facade (#1200)#1214

Open
dolho wants to merge 1 commit into
devfrom
feature/1200-capabilities-facade
Open

fix(db): delegate get/set_full_capabilities onto DatabaseManager facade (#1200)#1214
dolho wants to merge 1 commit into
devfrom
feature/1200-capabilities-facade

Conversation

@dolho

@dolho dolho commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Problem

GET and PUT /api/agents/{name}/capabilities both return HTTP 500 since the #1093 SQLAlchemy-Core db decomposition (v0.6.1):

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)

get_full_capabilities / set_full_capabilities live on SecurityMixin (composed into AgentOperations, i.e. db._agent_ops) but were never given a delegating pass-through on the DatabaseManager facade the routers call. So an agent's full-capabilities setting can be neither read nor changed via API/UI. Backend-independent (pure facade gap; SQLite + PostgreSQL).

Fix

Add the two pass-throughs on DatabaseManager, alongside the existing read-only delegations (src/backend/database.py):

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 SecurityMixin implementations already exist — this purely restores the facade passthrough.

Tests

tests/unit/test_database_facade_delegation.py already whitelisted these two names in KNOWN_FACADE_GAPS. Removed them so the AST-based static guard now actively enforces the delegation, and added an explicit test_1200_capabilities_methods_delegated regression check.

unit/test_database_facade_delegation.py ... 3 passed
unit/test_capability_set.py             ... 4 passed

Sweep (per issue note)

Swept every method on the AgentOperations mixins for un-delegated facade gaps. Only the two capabilities methods are both missing and called as db.<m>(...). is_agent_shared_with_email is also un-delegated but has 0 db. call sites (latent, not a live 500) — left out of scope. The other KNOWN_FACADE_GAPS entries are pre-existing, unrelated to #1200.

Related to #1200. Sibling #1093 regression: #1199.

🤖 Generated with Claude Code

…de (#1200)

GET/PUT /api/agents/{name}/capabilities 500'd with
`AttributeError: 'DatabaseManager' object has no attribute 'get_full_capabilities'`.
The #1093 db decomposition added explicit pass-throughs for most agent
settings but missed the full-capabilities pair — the methods live on
SecurityMixin (composed into AgentOperations / self._agent_ops) but had no
delegating method on the facade the routers call.

Add the two pass-throughs alongside the read-only delegations, and remove
them from the test_database_facade_delegation KNOWN_FACADE_GAPS allowlist so
the static guard now enforces them. Add an explicit #1200 regression check.

Related to #1200.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dolho dolho requested a review from vybe June 15, 2026 09:47
@github-actions

Copy link
Copy Markdown

⚠️ Nightly unit-suite check skipped — merge conflict against dev.

Resolve by running git merge dev locally and pushing the result. The next nightly run will re-test once the conflict is gone.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant