kin: KIN-016 Агенты должны уметь говорить 'не могу'. Если агент не может выполнить задачу (нет доступа, не понимает, выходит за компетенцию) — он должен вернуть status: blocked с причиной, а не пытаться угадывать. PM при получении blocked от агента — эскалирует к человеку через GUI (уведомление) и Telegram (когда будет).
This commit is contained in:
parent
a605e9d110
commit
d9172fc17c
35 changed files with 2375 additions and 23 deletions
76
core/db.py
76
core/db.py
|
|
@ -23,6 +23,12 @@ CREATE TABLE IF NOT EXISTS projects (
|
|||
language TEXT DEFAULT 'ru',
|
||||
execution_mode TEXT NOT NULL DEFAULT 'review',
|
||||
deploy_command TEXT,
|
||||
project_type TEXT DEFAULT 'development',
|
||||
ssh_host TEXT,
|
||||
ssh_user TEXT,
|
||||
ssh_key_path TEXT,
|
||||
ssh_proxy_jump TEXT,
|
||||
description TEXT,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
|
|
@ -43,6 +49,9 @@ CREATE TABLE IF NOT EXISTS tasks (
|
|||
forgejo_issue_id INTEGER,
|
||||
execution_mode TEXT,
|
||||
blocked_reason TEXT,
|
||||
blocked_at DATETIME,
|
||||
blocked_agent_role TEXT,
|
||||
blocked_pipeline_step TEXT,
|
||||
dangerously_skipped BOOLEAN DEFAULT 0,
|
||||
revise_comment TEXT,
|
||||
category TEXT DEFAULT NULL,
|
||||
|
|
@ -95,6 +104,21 @@ CREATE TABLE IF NOT EXISTS modules (
|
|||
UNIQUE(project_id, name)
|
||||
);
|
||||
|
||||
-- Фазы исследования нового проекта (research workflow KIN-059)
|
||||
CREATE TABLE IF NOT EXISTS project_phases (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
project_id TEXT NOT NULL REFERENCES projects(id),
|
||||
role TEXT NOT NULL,
|
||||
phase_order INTEGER NOT NULL,
|
||||
status TEXT DEFAULT 'pending',
|
||||
task_id TEXT REFERENCES tasks(id),
|
||||
revise_count INTEGER DEFAULT 0,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_phases_project ON project_phases(project_id, phase_order);
|
||||
|
||||
-- Pipelines (история запусков)
|
||||
CREATE TABLE IF NOT EXISTS pipelines (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
|
@ -250,6 +274,16 @@ def _migrate(conn: sqlite3.Connection):
|
|||
conn.execute("ALTER TABLE tasks ADD COLUMN category TEXT DEFAULT NULL")
|
||||
conn.commit()
|
||||
|
||||
if "blocked_at" not in task_cols:
|
||||
conn.execute("ALTER TABLE tasks ADD COLUMN blocked_at DATETIME")
|
||||
conn.commit()
|
||||
if "blocked_agent_role" not in task_cols:
|
||||
conn.execute("ALTER TABLE tasks ADD COLUMN blocked_agent_role TEXT")
|
||||
conn.commit()
|
||||
if "blocked_pipeline_step" not in task_cols:
|
||||
conn.execute("ALTER TABLE tasks ADD COLUMN blocked_pipeline_step TEXT")
|
||||
conn.commit()
|
||||
|
||||
if "obsidian_vault_path" not in proj_cols:
|
||||
conn.execute("ALTER TABLE projects ADD COLUMN obsidian_vault_path TEXT")
|
||||
conn.commit()
|
||||
|
|
@ -258,10 +292,50 @@ def _migrate(conn: sqlite3.Connection):
|
|||
conn.execute("ALTER TABLE projects ADD COLUMN deploy_command TEXT")
|
||||
conn.commit()
|
||||
|
||||
# Migrate audit_log table (KIN-021)
|
||||
if "project_type" not in proj_cols:
|
||||
conn.execute("ALTER TABLE projects ADD COLUMN project_type TEXT DEFAULT 'development'")
|
||||
conn.commit()
|
||||
|
||||
if "ssh_host" not in proj_cols:
|
||||
conn.execute("ALTER TABLE projects ADD COLUMN ssh_host TEXT")
|
||||
conn.commit()
|
||||
|
||||
if "ssh_user" not in proj_cols:
|
||||
conn.execute("ALTER TABLE projects ADD COLUMN ssh_user TEXT")
|
||||
conn.commit()
|
||||
|
||||
if "ssh_key_path" not in proj_cols:
|
||||
conn.execute("ALTER TABLE projects ADD COLUMN ssh_key_path TEXT")
|
||||
conn.commit()
|
||||
|
||||
if "ssh_proxy_jump" not in proj_cols:
|
||||
conn.execute("ALTER TABLE projects ADD COLUMN ssh_proxy_jump TEXT")
|
||||
conn.commit()
|
||||
|
||||
if "description" not in proj_cols:
|
||||
conn.execute("ALTER TABLE projects ADD COLUMN description TEXT")
|
||||
conn.commit()
|
||||
|
||||
# Migrate audit_log + project_phases tables
|
||||
existing_tables = {r[0] for r in conn.execute(
|
||||
"SELECT name FROM sqlite_master WHERE type='table'"
|
||||
).fetchall()}
|
||||
if "project_phases" not in existing_tables:
|
||||
conn.executescript("""
|
||||
CREATE TABLE IF NOT EXISTS project_phases (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
project_id TEXT NOT NULL REFERENCES projects(id),
|
||||
role TEXT NOT NULL,
|
||||
phase_order INTEGER NOT NULL,
|
||||
status TEXT DEFAULT 'pending',
|
||||
task_id TEXT REFERENCES tasks(id),
|
||||
revise_count INTEGER DEFAULT 0,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_phases_project ON project_phases(project_id, phase_order);
|
||||
""")
|
||||
conn.commit()
|
||||
if "audit_log" not in existing_tables:
|
||||
conn.executescript("""
|
||||
CREATE TABLE IF NOT EXISTS audit_log (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue