kin: KIN-021 Аудит-лог для --dangerously-skip-permissions в auto mode
This commit is contained in:
parent
67071c757d
commit
a0b0976d8d
16 changed files with 1477 additions and 14 deletions
|
|
@ -219,6 +219,35 @@ class TestResolvePendingAction:
|
|||
# _run_claude with allow_write=True
|
||||
assert result["rerun_result"]["success"] is True
|
||||
|
||||
def test_manual_task_brief_has_task_type_manual_escalation(self, conn):
|
||||
"""brief["task_type"] должен быть 'manual_escalation' — KIN-020."""
|
||||
action = {
|
||||
"type": "permission_fix",
|
||||
"original_item": {"title": "Fix .dockerignore", "type": "hotfix",
|
||||
"priority": 3, "brief": "Create .dockerignore"},
|
||||
}
|
||||
result = resolve_pending_action(conn, "VDOL-001", action, "manual_task")
|
||||
assert result is not None
|
||||
assert result["brief"]["task_type"] == "manual_escalation"
|
||||
|
||||
def test_manual_task_brief_includes_source(self, conn):
|
||||
"""brief["source"] должен содержать ссылку на родительскую задачу — KIN-020."""
|
||||
action = {
|
||||
"type": "permission_fix",
|
||||
"original_item": {"title": "Fix X"},
|
||||
}
|
||||
result = resolve_pending_action(conn, "VDOL-001", action, "manual_task")
|
||||
assert result["brief"]["source"] == "followup:VDOL-001"
|
||||
|
||||
def test_manual_task_brief_includes_description(self, conn):
|
||||
"""brief["description"] копируется из original_item.brief — KIN-020."""
|
||||
action = {
|
||||
"type": "permission_fix",
|
||||
"original_item": {"title": "Fix Y", "brief": "Detailed context here"},
|
||||
}
|
||||
result = resolve_pending_action(conn, "VDOL-001", action, "manual_task")
|
||||
assert result["brief"]["description"] == "Detailed context here"
|
||||
|
||||
def test_nonexistent_task(self, conn):
|
||||
action = {"type": "permission_fix", "original_item": {}}
|
||||
assert resolve_pending_action(conn, "NOPE", action, "skip") is None
|
||||
|
|
@ -261,6 +290,22 @@ class TestAutoResolvePendingActions:
|
|||
tasks = models.list_tasks(conn, project_id="vdol")
|
||||
assert len(tasks) == 2 # VDOL-001 + новая manual task
|
||||
|
||||
@patch("agents.runner._run_claude")
|
||||
def test_escalated_manual_task_has_task_type_manual_escalation(self, mock_claude, conn):
|
||||
"""При эскалации после провала rerun созданная задача имеет task_type='manual_escalation' — KIN-020."""
|
||||
mock_claude.return_value = {"output": "", "returncode": 1}
|
||||
action = {
|
||||
"type": "permission_fix",
|
||||
"description": "Fix X",
|
||||
"original_item": {"title": "Fix X", "type": "frontend_dev", "brief": "Apply fix"},
|
||||
"options": ["rerun", "manual_task", "skip"],
|
||||
}
|
||||
results = auto_resolve_pending_actions(conn, "VDOL-001", [action])
|
||||
|
||||
assert results[0]["resolved"] == "manual_task"
|
||||
created_task = results[0]["result"]
|
||||
assert created_task["brief"]["task_type"] == "manual_escalation"
|
||||
|
||||
@patch("agents.runner._run_claude")
|
||||
def test_empty_pending_actions(self, mock_claude, conn):
|
||||
"""Пустой список — пустой результат."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue