Add orch wait command

This commit is contained in:
2026-03-19 14:02:33 +08:00
parent 1b0cd723d7
commit f1785b314f
7 changed files with 535 additions and 22 deletions
+20 -9
View File
@@ -27,9 +27,10 @@ As of now:
- `orch` now implements `run init/show`, `task add`, `dep add`, `ready`, `dispatch`, `reconcile`, `blocked`, `answer`, and `status`
- `orch` can create runs, gate tasks through dependencies, dispatch work through `inbox`, reconcile worker thread state back into task state, answer blocked tasks, and create per-attempt Git worktrees during strict dispatch
- `orch dispatch` now supports `--repo-path`, `--workspace-root`, and `--strict-worktree`, resolves committed base revisions, records workspace metadata on attempts, and writes that metadata into inbox task payloads
- automated integration tests now cover the main `orch` scheduler slice, including dependency gating, dispatch, blocked-answer flow, reconcile, strict worktree creation, and dirty-repo rejection rules
- `orch wait` now blocks on run-scoped task events and reconciles inbox state while polling so leader waits can wake on worker progress without manual sleep loops
- automated integration tests now cover the main `orch` scheduler slice, including dependency gating, dispatch, blocked-answer flow, reconcile, strict worktree creation, dirty-repo rejection rules, and wait wake/timeout behavior
This means the project now has a working `orch` core scheduler plus strict worktree-backed dispatch, and is ready for leader-side wait/retry/reassign follow-on work.
This means the project now has a working `orch` core scheduler with strict worktree-backed dispatch and leader-side wait support, and is ready for the remaining retry/reassign/cancel/cleanup controls.
## Source Of Truth
@@ -71,9 +72,9 @@ Current implementation status:
- `Milestone 3: Inbox Happy Path` is complete
- `Milestone 4: Orch Core Scheduling` is complete for the current non-worktree scheduler scope
- `Milestone 5: Strict Worktree Support` is complete for the current explicit dispatch worktree mode
- `Milestone 6: Waiting Primitives` is partially complete through `inbox wait-reply`
- `Milestone 6: Waiting Primitives` is complete
The next practical coding target is `Milestone 6: Waiting Primitives`.
The next practical coding target is the remaining leader-side scheduler controls: `retry`, `reassign`, `cancel`, and `cleanup`.
### Milestone 1: Go Skeleton
@@ -241,7 +242,6 @@ Completed so far:
Remaining:
- `orch wait`
- retry, reassign, cancel, and cleanup workflows
### Milestone 5: Strict Worktree Support
@@ -295,6 +295,17 @@ Definition of done:
- leader can block on new task events
- blocked worker can block on reply events
Status:
- completed
Completed so far:
- `orch wait`
- `inbox wait-reply`
- `orch wait` reconciles inbox state while polling and wakes on matching run-scoped `task_*` events
- CLI integration tests cover wait wake and timeout behavior
### Milestone 7: Council Review
Goal:
@@ -318,11 +329,11 @@ Definition of done:
If a new agent is taking over now, the next concrete step should be:
1. start `Milestone 6: Waiting Primitives`
2. implement `orch wait` over the run-scoped event stream
1. implement the remaining leader-side scheduler controls: `retry`, `reassign`, `cancel`, and `cleanup`
2. decide whether task retry should reuse prior task metadata or allow dispatch-time overrides per retry
3. keep the authored inbox test-plan set in `docs/tests/inbox/` synchronized if CLI behavior changes during further `orch` work
The inbox implementation and its human-readable test-plan set are already in place, and `orch` now supports strict worktree-backed dispatch, so the next meaningful project step is to give the leader a blocking wait primitive and finish the remaining scheduler controls.
The inbox implementation and its human-readable test-plan set are already in place, and `orch` now supports strict worktree-backed dispatch plus leader-side waiting, so the next meaningful project step is to finish the remaining scheduler control commands.
## Recommended Driver Choices
@@ -346,11 +357,11 @@ Completed so far:
- orch scheduler lifecycle coverage for run/task/dependency/dispatch/reconcile
- orch blocked-question and answer coverage
- orch strict worktree creation and dirty-repo policy coverage
- orch wait wake and timeout coverage
Still recommended before the codebase grows too much:
- worktree path generation test
- `orch wait` event wake test
- council tally grouping test
## Inbox Test Documentation Roadmap
+1
View File
@@ -240,6 +240,7 @@ Suggested flags:
Behavior:
- blocks until a later matching event exists
- reconciles inbox state while polling so worker thread transitions can surface as `task_*` events
- returns a cursor for the next wait
- lets the leader wait for worker activity without manual sleep loops
+60
View File
@@ -0,0 +1,60 @@
# Orch Wait
## Status
- `completed`
## Owner
- codex
## Started At
- `2026-03-19`
## Goal
- implement `orch wait` so the leader can block on run-scoped task events instead of manual sleep loops
## Scope
- add store support for waiting on run-scoped events with event-type filters and timeout behavior
- make `orch wait` reconcile inbox state while polling so worker transitions can surface as `task_*` events
- add integration tests for wake and timeout behavior
- update the implementation roadmap and archive this workstream when complete
## Checklist
- [x] inspect `orch wait` docs and current event/reconcile behavior
- [x] implement `orch wait` store and CLI layers
- [x] add integration coverage for wake and timeout paths
- [x] run `go test ./...`
- [x] update `docs/implementation-roadmap.md`
- [x] archive this roadmap with a completion summary
## Files
- `docs/roadmaps/archive/orch-wait.md`
- `docs/implementation-roadmap.md`
- `internal/cli/orch/root.go`
- `internal/cli/orch/wait.go`
- `internal/cli/orch/integration_test.go`
- `internal/store/orch.go`
## Decisions
- let `orch wait` perform reconcile while polling so a leader can wait directly on `task_*` events without a separate manual reconcile loop
## Blockers
- none
## Next Step
- implement the remaining leader-side scheduler controls: `retry`, `reassign`, `cancel`, and `cleanup`
## Completion Summary
- `orch wait` now blocks on run-scoped `task_*` events with `--for`, `--after-event`, and timeout support
- the wait loop reconciles inbox state while polling, so worker thread transitions can wake the leader without a separate manual reconcile step
- integration tests now cover both wake-on-blocked and timeout behavior