ДОМЕНЫ - ВОПРОСЫ - СКЛАД - Склад: усилить follow-up оркестрацию и business-first формат ответов
This commit is contained in:
@@ -1827,8 +1827,8 @@ def build_scenario_acceptance_matrix(pack: dict[str, Any], scenario_results: lis
|
||||
"",
|
||||
f"## {title}",
|
||||
"",
|
||||
"| node_id | status | backed_by_scenarios | question_ids | required_wording_families |",
|
||||
"| --- | --- | --- | --- | --- |",
|
||||
"| node_id | status | backed_by_scenarios | question_ids | required_wording_families | observed_wording_families | missing_wording_families |",
|
||||
"| --- | --- | --- | --- | --- | --- | --- |",
|
||||
]
|
||||
)
|
||||
for node in nodes:
|
||||
@@ -1858,6 +1858,8 @@ def build_scenario_acceptance_matrix(pack: dict[str, Any], scenario_results: lis
|
||||
", ".join(backed_by) or "-",
|
||||
", ".join(normalize_string_list(node.get("covers_question_ids"))) or "-",
|
||||
", ".join(required_wording_families) or "-",
|
||||
", ".join(observed_wording_families) or "-",
|
||||
", ".join(missing_wording_families) or "-",
|
||||
]
|
||||
)
|
||||
+ " |"
|
||||
@@ -1874,8 +1876,8 @@ def build_scenario_acceptance_matrix(pack: dict[str, Any], scenario_results: lis
|
||||
"",
|
||||
"## Critical edges",
|
||||
"",
|
||||
"| edge_id | status | from_node | to_node | backed_by_scenarios | primary_user_path |",
|
||||
"| --- | --- | --- | --- | --- | --- |",
|
||||
"| edge_id | status | from_node | to_node | backed_by_scenarios | primary_user_path | observed_wording_families | missing_wording_families |",
|
||||
"| --- | --- | --- | --- | --- | --- | --- | --- |",
|
||||
]
|
||||
)
|
||||
for edge in edges:
|
||||
@@ -1918,6 +1920,8 @@ def build_scenario_acceptance_matrix(pack: dict[str, Any], scenario_results: lis
|
||||
to_node or "-",
|
||||
", ".join(backed_by) or "-",
|
||||
"yes" if bool(edge.get("primary_user_path")) else "no",
|
||||
", ".join(observed_wording_families) or "-",
|
||||
", ".join(missing_wording_families) or "-",
|
||||
]
|
||||
)
|
||||
+ " |"
|
||||
@@ -2222,13 +2226,14 @@ def build_analyst_loop_prompt(
|
||||
Goal:
|
||||
- evaluate current domain-pack correctness for business meaning, route/capability quality, evidence quality, and absence of silent heuristic masking;
|
||||
- evaluate business usefulness, direct-answer-first behavior, state continuity, and field truthfulness, not only technical groundedness;
|
||||
- evaluate object-centric dialog continuity: stable `focus_object`, reusable bundles such as `provenance_bundle`, and correct action resolution for pronoun-style follow-ups;
|
||||
- evaluate object-centric dialog continuity: stable `focus_object`, stable `answer_object`, reusable bundles such as `provenance_bundle`, and correct action resolution for pronoun-style follow-ups;
|
||||
- evaluate action-first follow-up behavior, answer layering, compactness of narrow micro-actions, and temporal honesty when the runtime broadens beyond the requested date window;
|
||||
- determine whether the gate `quality_score >= {target_score}` is reached;
|
||||
- if not, provide the smallest high-value fix targets for the coder.
|
||||
|
||||
Rules:
|
||||
- `accepted` is allowed only if quality_score >= {target_score}, unresolved_p0_count = 0, and regression_detected = false;
|
||||
- `accepted` also requires `direct_answer_ok = true` and `business_usefulness_ok = true`;
|
||||
- `accepted` also requires `direct_answer_ok = true`, `business_usefulness_ok = true`, `temporal_honesty_ok = true`, and `field_truth_ok = true`;
|
||||
- `partial` means the pack is usable but exactness, routing, or coverage is still insufficient;
|
||||
- `needs_exact_capability` means the primary blocker is a missing exact route or capability, but the loop should still continue autonomously unless a user decision is required;
|
||||
- `continue` means there is a clear next patch cycle;
|
||||
@@ -2241,11 +2246,13 @@ def build_analyst_loop_prompt(
|
||||
- if `requires_user_decision = true`, fill `user_decision_type` and `user_decision_prompt`;
|
||||
- if the pack is below {target_score} but there is still safe autonomous implementation work, keep `requires_user_decision = false`;
|
||||
- do not request user input merely because the score is still below {target_score}; request it only when the loop would otherwise guess, overfit, or risk architecture drift.
|
||||
- return machine-readable fields for: `user_intent_summary`, `expected_direct_answer`, `actual_direct_answer`, `direct_answer_ok`, `business_usefulness_ok`, `business_utility_score`, `direct_answer_priority_score`, `state_continuity_score`, `answer_shape_score`, `evidence_clarity_score`, `focus_object_continuity_ok`, `bundle_reuse_ok`, `followup_action_resolution_ok`, `recommended_state_objects`, `root_cause_layers`, `broken_edge_ids`, `violated_invariants`;
|
||||
- return machine-readable fields for: `user_intent_summary`, `expected_direct_answer`, `actual_direct_answer`, `direct_answer_ok`, `business_usefulness_ok`, `business_utility_score`, `direct_answer_priority_score`, `state_continuity_score`, `answer_shape_score`, `evidence_clarity_score`, `focus_object_continuity_ok`, `bundle_reuse_ok`, `followup_action_resolution_ok`, `temporal_honesty_ok`, `field_truth_ok`, `answer_layering_ok`, `recommended_state_objects`, `root_cause_layers`, `broken_edge_ids`, `violated_invariants`;
|
||||
- if the product found the evidence but failed to retain the selected object, provenance bundle, or another reusable resolved object across turns, classify that as `object_memory_gap` or `edge_carryover_gap`, not as a generic route problem;
|
||||
- if the product retained the item but resolved the wrong action over that item, for example `покажи документы по этой позиции` -> `documents_by_counterparty`, classify that as `followup_action_resolution_gap`;
|
||||
- if the product already resolved supplier/date/document details for the active item but failed to reuse that bundle for adjacent follow-ups, classify that as `bundle_reuse_gap`;
|
||||
- if a narrow business follow-up opens with numbered scaffolding such as `Блок 1/2/3` or a full generic trace packet instead of a compact direct answer, lower business usefulness explicitly rather than treating it as harmless formatting;
|
||||
- if the surfaced business field looks mislabeled, for example supplier vs organization, classify that as `field_mapping_gap`;
|
||||
- if the answer blurs exact-window evidence with nearest available out-of-window evidence, classify that as `temporal_honesty_gap`;
|
||||
- if the answer is technically grounded but still weak for a manager/accountant/operator, classify that as `business_utility_gap`.
|
||||
|
||||
Use this UTF-8 evidence bundle as the source of truth for artifact contents. Do not treat shell rendering artifacts as file corruption if the embedded bundle is readable.
|
||||
@@ -2292,8 +2299,8 @@ def build_coder_loop_prompt(
|
||||
- do not touch unrelated files;
|
||||
- preserve already successful baseline flows.
|
||||
- use `root_cause_layers`, `broken_edge_ids`, `violated_invariants`, and business-utility scores from the analyst verdict to choose the smallest fix;
|
||||
- prioritize state continuity, selected-object persistence, stable `focus_object`, reusable `provenance_bundle` / `sale_trace_bundle`, direct-answer-first behavior, and field-truth mapping when those are the blocking layers;
|
||||
- do not broaden scope when the analyst says the defect is mainly `object_memory_gap`, `followup_action_resolution_gap`, `bundle_reuse_gap`, `field_mapping_gap`, `answer_shape_mismatch`, or `business_utility_gap`;
|
||||
- prioritize state continuity, selected-object persistence, stable `focus_object`, stable `answer_object`, reusable `provenance_bundle` / `sale_trace_bundle`, action-first answer behavior, compact micro-action answers, answer layering, temporal honesty, and field-truth mapping when those are the blocking layers;
|
||||
- do not broaden scope when the analyst says the defect is mainly `object_memory_gap`, `followup_action_resolution_gap`, `bundle_reuse_gap`, `field_mapping_gap`, `temporal_honesty_gap`, `answer_shape_mismatch`, or `business_utility_gap`;
|
||||
- when the verdict points to pronoun follow-ups or item-centric drilldowns, prefer a narrow object-state or follow-up-action fix over prompt inflation.
|
||||
|
||||
Required outputs:
|
||||
@@ -2318,6 +2325,9 @@ def evaluate_analyst_gate(
|
||||
regression_detected = bool(verdict.get("regression_detected"))
|
||||
direct_answer_ok = bool(verdict.get("direct_answer_ok", True))
|
||||
business_usefulness_ok = bool(verdict.get("business_usefulness_ok", True))
|
||||
temporal_honesty_ok = bool(verdict.get("temporal_honesty_ok", True))
|
||||
field_truth_ok = bool(verdict.get("field_truth_ok", True))
|
||||
answer_layering_ok = bool(verdict.get("answer_layering_ok", True))
|
||||
loop_decision = str(verdict.get("loop_decision") or "").strip() or "continue"
|
||||
requires_user_decision = bool(verdict.get("requires_user_decision"))
|
||||
user_decision_type = str(verdict.get("user_decision_type") or "").strip() or "none"
|
||||
@@ -2329,6 +2339,9 @@ def evaluate_analyst_gate(
|
||||
and not regression_detected
|
||||
and direct_answer_ok
|
||||
and business_usefulness_ok
|
||||
and temporal_honesty_ok
|
||||
and field_truth_ok
|
||||
and answer_layering_ok
|
||||
and loop_decision == "accepted"
|
||||
)
|
||||
return accepted, loop_decision, requires_user_decision, user_decision_type, user_decision_prompt
|
||||
|
||||
Reference in New Issue
Block a user