浏览代码

refactor(review): remove post-revision normalize from loop

Normalize is a pre-loop dedicated step only. If REVISED_CONTENT
drifts on length, isPassed catches it via lengthInRange → bestSnapshot
selects the earlier in-range version. No normalize inside the loop.
Ma 7 月之前
父节点
当前提交
77107e7ffe
共有 1 个文件被更改,包括 5 次插入 和 7 次删除
  1. 5 7
      packages/core/src/pipeline/chapter-review-cycle.ts

+ 5 - 7
packages/core/src/pipeline/chapter-review-cycle.ts

@@ -237,14 +237,12 @@ export async function runChapterReviewCycle(params: {
       }
       }
 
 
       params.assertChapterContentNotEmpty(reviseOutput.revisedContent, `repair iteration ${iteration + 1}`);
       params.assertChapterContentNotEmpty(reviseOutput.revisedContent, `repair iteration ${iteration + 1}`);
+      const revisedContent = reviseOutput.revisedContent;
+      const revisedWordCount = countChapterLength(revisedContent, params.lengthSpec.countingMode);
 
 
-      // Re-normalize after revision (REVISED_CONTENT can blow up length)
-      const postReviseNorm = await normalizeUntilInRange(reviseOutput.revisedContent);
-      normalizeApplied = normalizeApplied || postReviseNorm.applied;
-      const revisedContent = postReviseNorm.content;
-      const revisedWordCount = postReviseNorm.wordCount;
-
-      // Re-assess the revised + normalized content
+      // Re-assess revised content. If REVISED_CONTENT drifted on length,
+      // lengthInRange will be false → isPassed fails → bestSnapshot picks
+      // the earlier in-range version. No in-loop normalize needed.
       const nextAssessment = await assess(revisedContent, { temperature: 0 });
       const nextAssessment = await assess(revisedContent, { temperature: 0 });
 
 
       snapshots.push({
       snapshots.push({