@@ -12,11 +12,14 @@ host-specific wake adapters, and operator presentation are later slices in the
1212Turn Loop Controller plan.
1313
1414The controller is an exported transition API, not a loop implicitly started by
15- ` loopx turn run-once ` . The CLI does not currently call ` decide_loop_disposition `
16- or persist a ` BoundedTurnBudget ` . Both ` max_turns ` and ` completed_turns ` must be
17- supplied by an integrating caller; there is no CLI or product default of three
18- Turns. The budget applies to continued ` validated_progress ` on the same Todo,
19- not a chain of completed Todos and not fine-grained planning mode.
15+ ` loopx turn run-once ` . ` loopx turn managed-step ` calls ` decide_loop_disposition `
16+ for one already-journaled failed Turn and returns the typed answer without
17+ executing anything, which is the first production consumer of the transition.
18+ The CLI still does not persist a ` BoundedTurnBudget ` ; both ` max_turns ` and
19+ ` completed_turns ` must be supplied by an integrating caller, and there is no CLI
20+ or product default of three Turns. The budget applies to continued
21+ ` validated_progress ` on the same Todo, not a chain of completed Todos and not
22+ fine-grained planning mode.
2023
2124## Inputs
2225
@@ -172,6 +175,40 @@ with an open acceptance gap, a terminal/obsolete/incompatible selected todo,
172175validated negative evidence, or two eligible turns without material progress
173176all require replan rather than another delivery attempt.
174177
178+ ## Managed Step Surface
179+
180+ ` loopx turn managed-step ` is the CLI surface that consumes this transition for
181+ one already-journaled Turn:
182+
183+ ``` bash
184+ loopx turn managed-step \
185+ --goal-id < goal-id> \
186+ --agent-id < agent-id> \
187+ --turn-key < sha256:64-hex-digest> \
188+ --format json
189+ ```
190+
191+ It rebuilds the ` ValidatedTurnReceipt ` from the canonical Journal, projects the
192+ current control-plane decision as a fresh ` loopx_turn_envelope_v0 ` , and returns
193+ ` loopx_turn_managed_step_v0 ` : the disposition, its reason, the goal/agent/Todo
194+ lineage, and, on ` wait ` , the typed ` retry_continuation ` block.
195+
196+ The command is read-only and grants no authority of its own. It never launches
197+ a host, writes state, spends quota, sleeps, or mints a Turn. On ` wait ` the
198+ answer only describes the bounded backoff after which the outer scheduler may
199+ wake the * same* Turn; carrying the existing ` --retry-failed-turn ` /
200+ ` --resume-turn-key ` flags on the next ` run-once ` stays the caller's decision.
201+
202+ The Turn Journal remains the sole authority for the attempt count and retry
203+ ceiling. ` --observed-attempt ` and ` --observed-max-attempts ` are reconciled
204+ against it and refused on disagreement, so a caller's bookkeeping can be
205+ checked but never substituted. A Journal that is not a finished failed Turn,
206+ whose typed host failure is not retryable, or whose current snapshot fails the
207+ canonical TypeScript journal consistency checks is refused before the transition
208+ is reached. A stored recovery audit describes an earlier attempt, not current
209+ eligibility. The eventual ` run-once ` still revalidates host-session binding and
210+ execution authority before retrying.
211+
175212## Boundary
176213
177214The controller is a pure function. It must not invoke a model, sleep, mutate a
0 commit comments