kin: KIN-020 UI для manual_task эскалации из auto_resolve_pending_actions

This commit is contained in:
Gros Frumos 2026-03-16 07:14:32 +02:00
parent a0b0976d8d
commit 77ed68c2b5
3 changed files with 57 additions and 3 deletions

View file

@ -41,6 +41,17 @@ def build_context(
"role": role,
}
# If task has a revise comment, fetch the last agent output for context
if task and task.get("revise_comment"):
row = conn.execute(
"""SELECT output_summary FROM agent_logs
WHERE task_id = ? AND success = 1
ORDER BY created_at DESC LIMIT 1""",
(task_id,),
).fetchone()
if row and row["output_summary"]:
ctx["last_agent_output"] = row["output_summary"]
if role == "pm":
ctx["modules"] = models.get_modules(conn, project_id)
ctx["decisions"] = models.get_decisions(conn, project_id)
@ -207,6 +218,18 @@ def format_prompt(context: dict, role: str, prompt_template: str | None = None)
sections.append(f"## Target module: {hint}")
sections.append("")
# Revision context: director's comment + agent's previous output
task = context.get("task")
if task and task.get("revise_comment"):
sections.append("## Director's revision request:")
sections.append(task["revise_comment"])
sections.append("")
last_output = context.get("last_agent_output")
if last_output:
sections.append("## Your previous output (before revision):")
sections.append(last_output)
sections.append("")
# Previous step output (pipeline chaining)
prev = context.get("previous_output")
if prev: