标记阻塞(原子操作)
(task_id, reason)
| 487 | |
| 488 | |
| 489 | def cmd_block(task_id, reason): |
| 490 | """标记阻塞(原子操作)""" |
| 491 | def modifier(tasks): |
| 492 | t = find_task(tasks, task_id) |
| 493 | if not t: |
| 494 | log.error(f'任务 {task_id} 不存在') |
| 495 | return tasks |
| 496 | t['state'] = 'Blocked' |
| 497 | t['block'] = reason |
| 498 | t['updatedAt'] = now_iso() |
| 499 | return tasks |
| 500 | atomic_json_update(TASKS_FILE, modifier, []) |
| 501 | _trigger_refresh() |
| 502 | log.warning(f'⚠️ {task_id} 已阻塞: {reason}') |
| 503 | _append_audit(task_id, _infer_agent_id_from_runtime(), 'block', None, 'Blocked', reason) |
| 504 | |
| 505 | |
| 506 | def cmd_confirm(task_id, action, reason=''): |
no test coverage detected