Problem
src/backend/routers/git.py:315 executes raw SQL directly against the DB, bypassing the service/db layer. Violates Architectural Invariant #1 (Three-Layer Backend: Router → Service → DB).
db.execute_query("DELETE FROM agent_git_config WHERE agent_name = ?", (agent_name,))
Context: orphan cleanup when agent has a DB row but no git config in the container.
Scope
- Add a
delete_agent_git_config(agent_name) operation to src/backend/db/git.py (or equivalent operations class used by git_service).
- Call it from
routers/git.py instead of the raw db.execute_query(...).
- No behavior change.
Out of scope
Process engine router SQL (routers/processes.py, routers/triggers.py) — the Process Engine is dormant and explicitly out of scope (see CLAUDE.md). Those violations stay as-is until Process Engine is resumed or removed.
Acceptance Criteria
References
Problem
src/backend/routers/git.py:315executes raw SQL directly against the DB, bypassing the service/db layer. Violates Architectural Invariant #1 (Three-Layer Backend: Router → Service → DB).Context: orphan cleanup when agent has a DB row but no git config in the container.
Scope
delete_agent_git_config(agent_name)operation tosrc/backend/db/git.py(or equivalent operations class used bygit_service).routers/git.pyinstead of the rawdb.execute_query(...).Out of scope
Process engine router SQL (
routers/processes.py,routers/triggers.py) — the Process Engine is dormant and explicitly out of scope (see CLAUDE.md). Those violations stay as-is until Process Engine is resumed or removed.Acceptance Criteria
routers/git.py— all DB access goes throughdb/or a service/validate-architectureno longer flagsrouters/git.py:315under Invariant Fix: Add missing Docker labels to system agent container #1References