orch: require explicit dispatch execution mode

This commit is contained in:
2026-03-20 19:27:30 +08:00
parent 7840b2767f
commit 5859ff219e
43 changed files with 277 additions and 312 deletions
@@ -2,7 +2,7 @@
## 用例意义
验证显式 `--strict-worktree` dispatch 会创建隔离 worktree,并把 workspace 元数据持久化到 attempt 与任务 payload 中。
验证显式 `--execution-mode code` dispatch 会创建隔离 worktree,并把 workspace 元数据持久化到 attempt 与任务 payload 中。
## 前置条件
@@ -15,7 +15,7 @@
```bash
orch --db TMPDIR/coord.db --json run init --run run_blog_worktree_001 --goal "Validate strict worktree dispatch"
orch --db TMPDIR/coord.db --json task add --run run_blog_worktree_001 --task T1 --title "Implement backend" --default-to worker-a
orch --db TMPDIR/coord.db --json dispatch --run run_blog_worktree_001 --task T1 --repo-path TMPDIR/repo --workspace-root .orch/worktrees --strict-worktree --body "Implement inside isolated worktree."
orch --db TMPDIR/coord.db --json dispatch --run run_blog_worktree_001 --task T1 --execution-mode code --repo-path TMPDIR/repo --workspace-root .orch/worktrees --body "Implement inside isolated worktree."
```
## 预期输出
@@ -26,11 +26,12 @@ orch --db TMPDIR/coord.db --json dispatch --run run_blog_worktree_001 --task T1
- `data.attempt.branch_name == "orch/run-blog-worktree-001/T1/attempt-1"`
- 返回非空 `data.attempt.worktree_path`
- `data.attempt.workspace_status == "created"`
- `data.message.payload_json.execution_mode == "code"`
- `data.message.payload_json.worktree_path` 与 attempt 中的路径一致
## 断言结论
- strict worktree dispatch 会创建真正的隔离工作目录,而不是只记录一组字符串元数据
- code-mode dispatch 会创建真正的隔离工作目录,而不是只记录一组字符串元数据
- worker 读取任务 payload 时可以拿到同一份 worktree 路径
## 补充约束