fix: prevent PendingRollbackError and add MCP tool support for sessions

- Add explicit session.rollback() in exception handlers for database
  context managers in features.py, schedules.py, and database.py get_db()
  to prevent SQLAlchemy PendingRollbackError on failed transactions
- Add EXPAND_FEATURE_TOOLS to expand session security settings allow list
  so the expand skill can use the MCP tools it references
- Update assistant session prompt to direct the LLM to call MCP tools
  directly for feature creation instead of suggesting CLI commands

Cherry-picked fixes from PR #92 (closed) with cleaner implementation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Auto
2026-02-01 09:15:24 +02:00
parent 79d02a1410
commit 6609a0f7d6
5 changed files with 22 additions and 6 deletions

View File

@@ -71,6 +71,9 @@ def get_db_session(project_dir: Path):
session = SessionLocal()
try:
yield session
except Exception:
session.rollback()
raise
finally:
session.close()