kin: auto-commit after pipeline

This commit is contained in:
Gros Frumos 2026-03-17 22:18:19 +02:00
parent 48aadd5b9f
commit 885e8fb388
2 changed files with 249 additions and 0 deletions

View file

@ -2036,6 +2036,28 @@ def run_pipeline(
current_task = models.get_task(conn, task_id)
current_status = current_task.get("status") if current_task else None
# KIN-116: detect destructive ops — force review even in auto mode
destructive_ops = _detect_destructive_operations(results) if results else []
if destructive_ops and mode == "auto_complete":
mode = "review" # Downgrade to review for this pipeline run
_logger.warning(
"KIN-116: destructive operations detected in pipeline output — "
"forcing task %s to review. Patterns: %s",
task_id,
destructive_ops[:5],
)
try:
models.log_audit_event(
conn,
event_type="destructive_ops_detected",
task_id=task_id,
step_id="runner",
reason=f"Destructive operations detected: {destructive_ops[:5]}",
project_id=project_id,
)
except Exception:
pass
if current_status in ("done", "cancelled"):
pass # User finished manually — don't overwrite
elif mode == "auto_complete" and auto_eligible: