mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
After the user answers the one clarification round, the agent's next turn carries a complete Full Plan plus a Runtime State. On 0.22.1-prerelease.9 (OPEND-2954) that state said `inputStage: "request"` — the value every Runtime State example in the protocol reference shows, and the one field the clarification continuation never named — and the coordinator refused the turn on that field alone. The task settled terminal-`blocked`, a plan that passed every other gate never reached production, and no repair path could anchor on it because the block was schema-valid and the mismatch is not a parser issue. The stage is host-owned truth: the daemon issued it, wrote it into the continuation wrapper, and holds it on the task, so a disagreeing declaration carries no authority — the same footing as the execution mode a clarification turn predicts, which the parser already discards. `adoptHostInputStage` now gives the state the host's stage before validation whenever the corrected state is a valid declaration for that stage, and records the decision as a normalization rather than a reason code so an agent-declared `blocked` keeps its own attribution. Where the field does carry meaning — a second `clarification_required`, a `plan_ready` at production — the corrected state fails the contract, the agent's value stands, and the turn is refused exactly as before. The serialization-repair anchor gets the same treatment so a fenced plan on a clarification turn can still enter its one repair. The clarification continuation now also says which stage it runs at, mirroring the production continuation's `inputStage production`, so the agent has one sentence to follow instead of three examples that all say `request`. Specs: a clarification turn declaring `request` / `plan_ready` with a valid plan reaches `plan_ready` (red on main: blocked with `od_next_protocol_stage_mismatch`); an agent-declared block with the wrong stage keeps `od_next_agent_declared_block`; a second question round is still refused; a fenced plan with the wrong stage still anchors a repair; the continuation text names `inputStage clarification`. Co-authored-by: Cheems <216108319+hihicheems@users.noreply.github.com>