# Case: `dispatch-creates-attempt-and-thread-for-ready-task` ## 用例意义 验证 `dispatch` 在任务已 `ready` 时,会创建 attempt、映射 inbox thread,并写入首条任务消息。 ## 前置条件 - 已存在 run `run_blog_001` - 已存在无依赖任务 `T1` ## 输入 ```bash orch --db TMPDIR/coord.db --json run init --run run_blog_001 --goal "Build blog MVP" --summary "Public blog plus admin CRUD" orch --db TMPDIR/coord.db --json task add --run run_blog_001 --task T1 --title "Implement retry policy" --summary "Add retry policy to HTTP client" --default-to worker-a orch --db TMPDIR/coord.db --json dispatch --run run_blog_001 --task T1 --body "Implement retry handling for the HTTP client." ``` ## 预期输出 - `dispatch` 退出码为 `0` - `data.task.status == "dispatched"` - `data.attempt.attempt_no == 1` - 返回 `data.attempt.thread_id` - `data.attempt.assigned_to == "worker-a"` - `data.thread.thread_id` 与 `data.attempt.thread_id` 一致 - `data.message.kind == "task"` ## 断言结论 - `dispatch` 是把调度意图物化为一次 attempt 和 inbox thread 的命令 - 任务进入 `dispatched` 后,leader 可以用 thread 映射等待 worker 侧进展 ## 补充约束 - 未显式传 `--to` 时,会回退使用任务的 `default_to` - `--body` 与 `--body-file` 互斥;不可读的 `--body-file` 应返回 `invalid_input`