From 2cd02453eccb3c564a488822ab332c3d77a880f6 Mon Sep 17 00:00:00 2001 From: Peter Zhang <18501667167@qq.com> Date: Tue, 2 Jun 2026 18:35:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20step1=20=E8=A6=86=E7=9B=96=E5=8F=8D?= =?UTF-8?q?=E9=A6=88=E9=87=8D=E8=AF=95=E5=A2=9E=E8=87=B3=203=20=E6=AC=A1?= =?UTF-8?q?=20+=20=E6=94=BE=E5=AE=BD=E8=B4=A8=E9=87=8F=E9=97=A8=E6=8E=A7?= =?UTF-8?q?=20-=20Closes=20#75?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重试次数 2→3,增加 LLM 补全机会 - 质量门控放宽:新增 sections 且无回归即采纳,不只严格要求覆盖率下降 Co-Authored-By: Claude Opus 4.7 --- skills/ir_generation_skill/step1_semantic_index.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/skills/ir_generation_skill/step1_semantic_index.py b/skills/ir_generation_skill/step1_semantic_index.py index bf38da6..c8a73cc 100644 --- a/skills/ir_generation_skill/step1_semantic_index.py +++ b/skills/ir_generation_skill/step1_semantic_index.py @@ -880,9 +880,9 @@ def run_ensemble_semantic_index(doc: dict) -> dict: if v: print(f" {k}: {len(v)} 个问题") - # Feedback retry: re-run with coverage feedback (up to 2 retries, quality-gated) + # Feedback retry: re-run with coverage feedback (up to 3 retries, quality-gated) retry_count = 0 - while retry_count < 2: + while retry_count < 3: feedback = _build_coverage_feedback(gaps) if not feedback: break @@ -906,13 +906,16 @@ def run_ensemble_semantic_index(doc: dict) -> dict: if src.get("section"): retry_sections.add(src["section"]) print(f" 重试新增 sections: {sorted(retry_sections)}", flush=True) - # Quality gate: only include retry if it improves coverage + # Quality gate: include retry if it adds new sections or doesn't regress coverage trial_indices = semantic_indices + [retry_result] trial_merged = ensemble_merge(trial_indices) trial_passed, trial_gaps = _quick_validate(trial_merged, doc, all_paths) trial_warnings = len(trial_gaps.get("coverage_warnings", [])) trial_missing = len(trial_gaps.get("missing_table_rows", [])) - if trial_warnings < pre_warnings or trial_missing < pre_missing_rows: + improved = trial_warnings < pre_warnings or trial_missing < pre_missing_rows + no_regression = trial_warnings <= pre_warnings and trial_missing <= pre_missing_rows + has_new_sections = len(retry_sections) > 0 + if improved or (no_regression and has_new_sections): semantic_indices.append(retry_result) merged = trial_merged passed, gaps = trial_passed, trial_gaps -- 2.52.0