# 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
