refactor: share INFRA stop-reason set from core.evolution

This commit is contained in:
2026-07-16 07:18:14 -04:00
parent b3ba11c7a5
commit 6911c83d66
4 changed files with 20 additions and 10 deletions
+6 -6
View File
@@ -27,6 +27,7 @@ from loguru import logger
from app.harness.gate_ladder import BaselineCache, skill_hash
from app.harness.question_units import build_units, flatten_units, unit_correctness_view
from core.evolution import (
INFRA_STOP_REASONS,
GateParams,
GateVerdict,
RejectedEdit,
@@ -35,6 +36,10 @@ from core.evolution import (
pair_block,
)
# INFRA_STOP_REASONS 复用 core.evolution.diagnose 的单一定义(M-2):INFRA 故障
# stop_reason(推理侧基础设施错误,非模型答错)在诊断与 gate 两处必须同口径,
# 避免各自维护副本致未来漂移。
if TYPE_CHECKING:
from app.harness.inference import InferenceResult
from app.harness.log import HarnessLog
@@ -231,11 +236,6 @@ def _load_run_rows(
return normalized
# INFRA 故障 stop_reason(推理侧基础设施错误,非模型答错):这些题的对错无信号意义,
# 基线臂遇到时不得写入 BaselineCache(否则一次瞬时故障永久污染基线快照)。
_INFRA_STOP_REASONS = frozenset({"error", "parse_error"})
def _infra_question_ids_from_db(
log: HarnessLog,
run_id: str,
@@ -255,7 +255,7 @@ def _infra_question_ids_from_db(
return {
q.question_id
for q in chunk
if rows.get(q.question_id, {}).get("stop_reason") in _INFRA_STOP_REASONS
if rows.get(q.question_id, {}).get("stop_reason") in INFRA_STOP_REASONS
}