Author orch Markdown test plan

This commit is contained in:
2026-03-19 16:27:28 +08:00
parent b448d98e71
commit a20bec1cac
68 changed files with 2225 additions and 160 deletions
+5 -4
View File
@@ -1,7 +1,8 @@
# Orch `reconcile` Test Plan Index
## Status
## Case Files
No command case files are authored yet.
Use [../ROADMAP.md](../ROADMAP.md) for planned case slugs and document progress.
| Case Slug | File | Coverage Note |
| --- | --- | --- |
| `reconcile-maps-claimed-or-in-progress-thread-to-running` | [reconcile-maps-claimed-or-in-progress-thread-to-running.md](./reconcile-maps-claimed-or-in-progress-thread-to-running.md) | maps worker claim or in-progress inbox state back into a running orch task |
| `reconcile-maps-done-or-failed-thread-to-terminal-task-state` | [reconcile-maps-done-or-failed-thread-to-terminal-task-state.md](./reconcile-maps-done-or-failed-thread-to-terminal-task-state.md) | maps terminal inbox states into terminal task states and updates run aggregates |
@@ -0,0 +1,34 @@
# Case: `reconcile-maps-claimed-or-in-progress-thread-to-running`
## 用例意义
验证 `reconcile` 会把 worker 侧的 `claim` / `in_progress` 进展同步回 `orch`,将任务推进到 `running`
## 前置条件
- 已存在 run `run_blog_001`
- 任务 `T1` 已通过 `dispatch` 创建 attempt 和 thread
- worker 已对该 thread 完成 `claim`,并可选地追加 `in_progress` 更新
## 输入
```bash
orch --db TMPDIR/coord.db --json run init --run run_blog_001 --goal "Build blog MVP"
orch --db TMPDIR/coord.db --json task add --run run_blog_001 --task T1 --title "Implement retry policy" --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."
inbox --db TMPDIR/coord.db --json claim --agent worker-a --thread THREAD_ID
inbox --db TMPDIR/coord.db --json update --agent worker-a --thread THREAD_ID --status in_progress --summary "Implementation started"
orch --db TMPDIR/coord.db --json reconcile --run run_blog_001
```
## 预期输出
- `reconcile` 退出码为 `0`
- `data.updated_tasks` 长度为 `1`
- 唯一更新任务的 `status == "running"`
- `data.run.run_id == "run_blog_001"`
## 断言结论
- `reconcile` 是 leader 侧把 inbox 执行状态投影回 scheduler 状态机的关键同步点
- claim 与 in-progress 的 worker 信号不会停留在 inbox 层
@@ -0,0 +1,34 @@
# Case: `reconcile-maps-done-or-failed-thread-to-terminal-task-state`
## 用例意义
验证 `reconcile` 会把 worker 侧 thread 的终态同步到 `orch` 任务,并刷新 run 聚合状态。
## 前置条件
- 已存在 run 和已 dispatch 的任务
- worker 已对该 thread 完成 `done``fail`
## 输入
```bash
orch --db TMPDIR/coord.db --json run init --run run_blog_001 --goal "Build blog MVP"
orch --db TMPDIR/coord.db --json task add --run run_blog_001 --task T1 --title "Implement retry policy" --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."
inbox --db TMPDIR/coord.db --json claim --agent worker-a --thread THREAD_ID
inbox --db TMPDIR/coord.db --json done --agent worker-a --thread THREAD_ID --summary "Retry policy implemented" --body "The HTTP client now retries transient failures."
orch --db TMPDIR/coord.db --json reconcile --run run_blog_001
orch --db TMPDIR/coord.db --json status --run run_blog_001
```
## 预期输出
- `reconcile` 退出码为 `0`
- `data.updated_tasks` 包含 `T1`
- `T1.status == "done"`;若输入是 `fail`,则应为 `failed`
- 后续 `status.data.run.status` 与终态任务聚合结果一致
## 断言结论
- 任务终态依赖 `reconcile` 落回 `orch`,而不是由 worker 直接改写 task 表
- run 级聚合状态会随终态任务一并刷新