Improve orch status reconciliation view

This commit is contained in:
2026-03-20 17:57:58 +08:00
parent 693a79345b
commit cf3c3cbe60
11 changed files with 374 additions and 21 deletions
+9 -6
View File
@@ -18,12 +18,13 @@ It is not a replacement for automated Go tests.
Snapshot date:
- `2026-03-19`
- `2026-03-20`
Current state:
- `orch` CLI is implemented for the current scheduler, strict worktree, wait, and council review surfaces
- automated Go tests now cover every currently documented `orch` command case and workflow case, combining the original integration suite with focused contract tests for run/task/ready/dispatch/blocked/answer/cleanup/status/reconcile/workflow/council-report edges
- `status` coverage now also documents the richer leader view: auto-reconcile plus latest attempt, latest message, and blocked-question context
- this roadmap now exists under `docs/tests/orch/ROADMAP.md`
- all planned global, shared, workflow, command-index, and command-case Markdown documents in the current `orch` test-plan set have been authored
- every implemented `orch` leaf-command folder now uses `README.md` as an index plus one Markdown file per planned case
@@ -31,10 +32,10 @@ Current state:
Progress summary for planned test-plan documents, excluding `ROADMAP.md`:
- planned document files: `64`
- authored document files: `64`
- planned case slugs in this roadmap: `46`
- authored case slugs in this roadmap: `46`
- planned document files: `65`
- authored document files: `65`
- planned case slugs in this roadmap: `47`
- authored case slugs in this roadmap: `47`
## Scope
@@ -270,6 +271,7 @@ docs/tests/orch/
| `docs/tests/orch/cleanup/cleanup-returns-no-matching-work-when-filters-miss.md` | `cleanup` command case | 1 | 1 | done |
| `docs/tests/orch/status/README.md` | `status` command case index | 0 | 0 | done |
| `docs/tests/orch/status/status-returns-run-summary-and-task-list.md` | `status` command case | 1 | 1 | done |
| `docs/tests/orch/status/status-auto-reconciles-and-includes-blocked-context.md` | `status` command case | 1 | 1 | done |
| `docs/tests/orch/council-start/README.md` | `council start` command case index | 0 | 0 | done |
| `docs/tests/orch/council-start/council-start-dispatches-three-reviewers.md` | `council start` command case | 1 | 1 | done |
| `docs/tests/orch/council-wait/README.md` | `council wait` command case index | 0 | 0 | done |
@@ -333,7 +335,8 @@ docs/tests/orch/
| `docs/tests/orch/cleanup/cleanup-removes-completed-worktree.md` | `cleanup-removes-completed-worktree` | cleanup removes completed attempt worktree artifacts | done |
| `docs/tests/orch/cleanup/cleanup-rejects-attempt-without-task.md` | `cleanup-rejects-attempt-without-task` | cleanup enforces `--task` when `--attempt` is specified | done |
| `docs/tests/orch/cleanup/cleanup-returns-no-matching-work-when-filters-miss.md` | `cleanup-returns-no-matching-work-when-filters-miss` | cleanup returns no_matching_work when selectors find no candidates | done |
| `docs/tests/orch/status/status-returns-run-summary-and-task-list.md` | `status-returns-run-summary-and-task-list` | status reports aggregate run state and per-task statuses | done |
| `docs/tests/orch/status/status-returns-run-summary-and-task-list.md` | `status-returns-run-summary-and-task-list` | status reports aggregate run state, per-task statuses, and latest attempt context | done |
| `docs/tests/orch/status/status-auto-reconciles-and-includes-blocked-context.md` | `status-auto-reconciles-and-includes-blocked-context` | status auto-reconciles inbox state and exposes blocked-task question context | done |
| `docs/tests/orch/council-start/council-start-dispatches-three-reviewers.md` | `council-start-dispatches-three-reviewers` | council start creates and dispatches three fixed reviewer tasks | done |
| `docs/tests/orch/council-wait/council-wait-wakes-when-all-reviewers-complete.md` | `council-wait-wakes-when-all-reviewers-complete` | council wait wakes when all reviewer tasks complete | done |
| `docs/tests/orch/council-wait/council-wait-times-out-when-reviewers-incomplete.md` | `council-wait-times-out-when-reviewers-incomplete` | council wait timeout stays machine-readable | done |
+2 -1
View File
@@ -4,4 +4,5 @@
| Case Slug | File | Coverage Note |
| --- | --- | --- |
| `status-returns-run-summary-and-task-list` | [status-returns-run-summary-and-task-list.md](./status-returns-run-summary-and-task-list.md) | returns aggregate run status plus the per-task status list |
| `status-returns-run-summary-and-task-list` | [status-returns-run-summary-and-task-list.md](./status-returns-run-summary-and-task-list.md) | returns aggregate run status plus the per-task status list and latest attempt context |
| `status-auto-reconciles-and-includes-blocked-context` | [status-auto-reconciles-and-includes-blocked-context.md](./status-auto-reconciles-and-includes-blocked-context.md) | auto-reconciles inbox state and exposes blocked-task attempt and question context |
@@ -0,0 +1,41 @@
# Case: `status-auto-reconciles-and-includes-blocked-context`
## 用例意义
验证 `status` 在返回结果前会先 reconcile 当前 inbox 线程状态,并附带 blocked 任务的 latest attempt、latest message 与 latest blocked question 上下文,方便 leader 直接判断谁在执行、卡在什么问题上。
## 前置条件
- 已存在 run `run_blog_002`
- 任务 `T1` 已 dispatch 到 `worker-a`
- `worker-a``claim` 对应线程,并写入一次 `blocked` 问题
- leader 尚未显式执行 `reconcile`
## 输入
```bash
orch --db TMPDIR/coord.db --json run init --run run_blog_002 --goal "Build blog MVP"
orch --db TMPDIR/coord.db --json task add --run run_blog_002 --task T1 --title "Implement retry policy" --default-to worker-a
orch --db TMPDIR/coord.db --json dispatch --run run_blog_002 --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 blocked --summary "Need logging decision" --payload-json '{"question":"Should retry attempts be logged?"}'
orch --db TMPDIR/coord.db --json status --run run_blog_002
```
## 预期输出
- `status` 退出码为 `0`
- `data.run.status == "blocked"`
- `data.tasks[0].status == "blocked"`
- `data.tasks[0].latest_attempt.thread_id == THREAD_ID`
- `data.tasks[0].latest_attempt.status == "blocked"`
- `data.tasks[0].latest_message.kind == "question"`
- `data.tasks[0].latest_message.summary == "Need logging decision"`
- `data.tasks[0].blocked_question.kind == "question"`
- `data.tasks[0].blocked_question.summary == "Need logging decision"`
## 断言结论
- `status` 现在是更偏 operational 的 leader 视图,而不是只读的任务列表查询
- leader 在常见排障场景里,不必先手工 `reconcile` 再额外跑 `blocked`
- enriched task context 能直接暴露当前 attempt 与问题摘要,减少二次查询
@@ -2,7 +2,7 @@
## 用例意义
验证 `status` 会返回 run 聚合视图以及任务明细列表,是 leader 端的完整状态检查入口。
验证 `status` 会返回 run 聚合视图任务明细列表以及最新 attempt/message 上下文,是 leader 端的完整状态检查入口。
## 前置条件
@@ -30,8 +30,13 @@ orch --db TMPDIR/coord.db --json status --run run_blog_001
- 返回 `data.tasks` 数组
- `data.tasks[0].task_id == "T1"`
- `data.tasks[0].status == "done"`
- `data.tasks[0].latest_attempt.assigned_to == "worker-a"`
- `data.tasks[0].latest_attempt.status == "done"`
- `data.tasks[0].latest_message.kind == "result"`
- `data.tasks[0].latest_message.summary == "Retry policy implemented"`
## 断言结论
- `status``run show` 更完整,适合做 run 级收口检查
- 任务清单与 run 聚合状态应保持一致,不应出现 run 已完成而任务仍显示旧状态的结果
- leader 不必再单独查询 attempt 或 thread 历史,常见收口信息可直接从 `status` 拿到