kin: KIN-ARCH-023-debugger
This commit is contained in:
parent
f1c868e335
commit
2be94f0c68
4 changed files with 94 additions and 68 deletions
17
cli/main.py
17
cli/main.py
|
|
@ -616,7 +616,22 @@ def run_task(ctx, task_id, dry_run, allow_write):
|
|||
is_noninteractive = os.environ.get("KIN_NONINTERACTIVE") == "1"
|
||||
click.echo(f"Task: {task['id']} — {task['title']}")
|
||||
|
||||
# Step 1: PM decomposes
|
||||
# Step 1a: Check for pre-built steps from revise endpoint (e.g. with analyst injection).
|
||||
# Decision #866: steps built in web/api.py are saved as pending_steps and consumed here.
|
||||
pending_steps = task.get("pending_steps")
|
||||
if pending_steps:
|
||||
pipeline_steps = pending_steps
|
||||
models.update_task(conn, task_id, pending_steps=None)
|
||||
click.echo(f"Using pre-built pipeline ({len(pipeline_steps)} steps, skipping PM)...")
|
||||
pm_result = None
|
||||
pm_started_at = pm_ended_at = None
|
||||
if is_noninteractive:
|
||||
click.echo("\n[non-interactive] Auto-executing pipeline...")
|
||||
elif not click.confirm("\nExecute pipeline?"):
|
||||
click.echo("Aborted.")
|
||||
return
|
||||
else:
|
||||
# Step 1b: PM decomposes
|
||||
click.echo("Running PM to decompose task...")
|
||||
pm_started_at = datetime.now(timezone.utc).isoformat()
|
||||
pm_result = run_agent(
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ CREATE TABLE IF NOT EXISTS tasks (
|
|||
revise_comment TEXT,
|
||||
revise_count INTEGER DEFAULT 0,
|
||||
revise_target_role TEXT DEFAULT NULL,
|
||||
pending_steps JSON DEFAULT NULL,
|
||||
labels JSON,
|
||||
category TEXT DEFAULT NULL,
|
||||
telegram_sent BOOLEAN DEFAULT 0,
|
||||
|
|
@ -400,6 +401,10 @@ def _migrate(conn: sqlite3.Connection):
|
|||
conn.execute("ALTER TABLE tasks ADD COLUMN revise_target_role TEXT DEFAULT NULL")
|
||||
conn.commit()
|
||||
|
||||
if "pending_steps" not in task_cols:
|
||||
conn.execute("ALTER TABLE tasks ADD COLUMN pending_steps JSON DEFAULT NULL")
|
||||
conn.commit()
|
||||
|
||||
if "obsidian_vault_path" not in proj_cols:
|
||||
conn.execute("ALTER TABLE projects ADD COLUMN obsidian_vault_path TEXT")
|
||||
conn.commit()
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ _JSON_COLUMNS: frozenset[str] = frozenset({
|
|||
"tech_stack",
|
||||
"brief", "spec", "review", "test_result", "security_result", "labels",
|
||||
"smoke_test_result",
|
||||
"pending_steps",
|
||||
"tags",
|
||||
"dependencies",
|
||||
"steps",
|
||||
|
|
@ -380,7 +381,7 @@ def update_task(conn: sqlite3.Connection, id: str, **fields) -> dict:
|
|||
"""
|
||||
if not fields:
|
||||
return get_task(conn, id)
|
||||
json_cols = ("brief", "spec", "review", "test_result", "security_result", "labels", "smoke_test_result")
|
||||
json_cols = ("brief", "spec", "review", "test_result", "security_result", "labels", "smoke_test_result", "pending_steps")
|
||||
for key in json_cols:
|
||||
if key in fields:
|
||||
fields[key] = _json_encode(fields[key])
|
||||
|
|
|
|||
|
|
@ -1065,6 +1065,11 @@ def revise_task(task_id: str, body: TaskRevise):
|
|||
}
|
||||
steps = [analyst_step] + list(steps)
|
||||
|
||||
# Persist computed steps so the subprocess can use them (avoids PM re-planning).
|
||||
# Decision #866: modified pipeline steps must be saved to DB before subprocess launch.
|
||||
if steps:
|
||||
models.update_task(conn, task_id, pending_steps=steps)
|
||||
|
||||
conn.close()
|
||||
|
||||
# Launch pipeline in background subprocess
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue