OSSS.ai.orchestration.pipeline.turn_normalizer¶
OSSS.ai.orchestration.pipeline.turn_normalizer
¶
TurnNormalizer
¶
Runs BEFORE classification/routing/planning.
Best-practice (Step B): - Pending actions are protocol contracts (wizard-agnostic). - Normalizer interprets ONLY yes/no/cancel while a contract is awaiting. - It writes exec_state["pending_action_result"] and clears awaiting flag on exec_state["pending_action"] (done by TurnController). - It route-locks to the contract’s resume_route/resume_pattern. - suppress_history=True so "yes/no" doesn't pollute conversation history. - canonical_user_text: - YES -> pending_question (so caller can treat it as the real user intent) - NO/CANCEL -> "" (so nothing is routed as a query)
✅ Fix for your logs: - When wizard is in collect_details, the user message is a "detail reply" and MUST NOT overwrite the canonical query ("query consents"). - Store it as exec_state["wizard_user_reply"] and return canonical_user_text=wizard.original_query. - Also set pending_action_resume_turn=True so classifier is skipped (Fix 2).