moa_tower_wait
Block until a specified tower condition is met—CI commit match, inbox messages, mission status change, or all dependencies merged—then return the payload or a retryable timeout.
Instructions
Long-poll wait primitive for the tower domain (M1), modeled on moa_board_wait / moa_wait_turn: block until the requested condition holds, then return {status:"ok", ...observed payload}; at the safety cap (default 25min, MOAMCP_WAIT_CAP_MS / timeoutMs tune it — timeoutMs is clamped to the cap) return {status:"timeout", retry:true}. wait.kind:"ci" → block until the ci/ record exists AND its commit matches the branch's CURRENT tip (a stale record from an older tip does NOT satisfy it); payload = the ci record. wait.kind:"inbox" → block until the caller's tower inbox has at least one message (same set moa_tower_inbox returns); payload = the messages. wait.kind:"mission" → block until the mission doc's status changes from what it was at call time; payload = the mission doc (a closed task scope returns {status:"closed"} instead of timing out). wait.kind:"deps" → block until EVERY mission id in mission(mission_id).deps has status "merged" — the dependency-driven parallel-dispatch primitive: all missions are dispatched at once and a dependent parks here, waking when its deps land (a successful moa_tower_merge always writes the dep mission doc, which wakes the wait); already-merged deps return immediately, an empty deps list is satisfied vacuously, and a dep id with no mission document is a protocol error (deps are validated at plan time, so a missing doc means corruption); payload = {mission_id, deps:[{id,status}...]}. Any registered roster member (tower/worker/reviewer) may wait; a delegator is rejected — delegators may only call moa_tower_send addressed to the tower.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wait | Yes | What to wait for. kind:"ci" needs branch; kind:"mission" needs id; kind:"deps" needs mission_id; kind:"inbox" needs nothing. | |
| timeoutMs | No | Per-call cap override (clamped to the MOAMCP_WAIT_CAP_MS safety cap) | |
| workspace | Yes | The absolute repo root (main checkout) this tower namespace anchors to. Required on every tower tool — the server cwd is never used as a fallback. | |
| caller_agent_id | Yes | Your engine agent id. The tower tools resolve it against the boot-registered roster (the booted tower, or a spawned worker/reviewer). |