kin: KIN-128-backend_dev

This commit is contained in:
Gros Frumos 2026-03-18 22:11:14 +02:00
parent d3bb5ef6a9
commit 11314a8c37
9 changed files with 348 additions and 4 deletions

View file

@ -1051,6 +1051,20 @@ def revise_task(task_id: str, body: TaskRevise):
raw = row["steps"]
steps = _json.loads(raw) if isinstance(raw, str) else raw
# KIN-128: On 2nd+ revision, inject analyst as first step for fresh perspective.
# Guard: skip if analyst is already the first step (idempotent), or if steps is None.
if revise_count >= 2 and steps and (not steps or steps[0].get("role") != "analyst"):
analyst_step = {
"role": "analyst",
"model": "sonnet",
"brief": (
f"Задача вернулась на ревизию №{revise_count}. "
"Проведи свежий анализ причин провала предыдущих попыток "
"и предложи другой подход."
),
}
steps = [analyst_step] + list(steps)
conn.close()
# Launch pipeline in background subprocess