kin: auto-commit after pipeline

This commit is contained in:
Gros Frumos 2026-03-17 20:44:44 +02:00
parent c1d3018922
commit 9aa058a823
2 changed files with 465 additions and 8 deletions

View file

@ -1612,6 +1612,14 @@ def run_pipeline(
if agent_error:
error_msg += f": {agent_error}"
models.update_task(conn, task_id, status="blocked", blocked_reason=error_msg)
# Worktree cleanup on step failure (KIN-103)
if worktree_path and not dry_run:
try:
from core.worktree import cleanup_worktree
p_path = str(Path(project_for_wt["path"]).expanduser())
cleanup_worktree(worktree_path, p_path)
except Exception:
pass
return {
"success": False,
"error": error_msg,
@ -1652,14 +1660,6 @@ def run_pipeline(
cleanup_worktree(worktree_path, p_path)
except Exception:
pass # Worktree errors must never block pipeline
elif worktree_path and not dry_run:
# Step failed — cleanup worktree without merging
try:
from core.worktree import cleanup_worktree
p_path = str(Path(project_for_wt["path"]).expanduser())
cleanup_worktree(worktree_path, p_path)
except Exception:
pass
results.append(result)