diff --git a/index.js b/index.js index e7fa219..54e5d07 100644 --- a/index.js +++ b/index.js @@ -4581,11 +4581,7 @@ function updateProcessedHistorySnapshot(chat, lastProcessedAssistantFloor) { function shouldAdvanceProcessedHistory(batchStatus) { if (!batchStatus || typeof batchStatus !== "object") return false; - return ( - batchStatus.completed === true && - batchStatus.outcome === "success" && - batchStatus.consistency === "strong" - ); + return batchStatus?.stages?.core?.outcome === "success"; } function computePostProcessArtifacts( diff --git a/tests/p0-regressions.mjs b/tests/p0-regressions.mjs index 974d140..c265a89 100644 --- a/tests/p0-regressions.mjs +++ b/tests/p0-regressions.mjs @@ -2416,7 +2416,7 @@ async function testBatchStatusFinalizeFailureIsNotCompleteSuccess() { assert.equal(effects.vectorError, "vector finalize down"); } -async function testProcessedHistoryAdvanceRequiresCompleteStrongSuccess() { +async function testProcessedHistoryAdvanceTracksCoreExtractionSuccess() { const harness = await createBatchStageHarness(); const { createBatchStatusSkeleton, @@ -2441,7 +2441,7 @@ async function testProcessedHistoryAdvanceRequiresCompleteStrongSuccess() { assert.equal(structuralPartial.completed, true); assert.equal(structuralPartial.outcome, "partial"); assert.equal(structuralPartial.consistency, "weak"); - assert.equal(shouldAdvanceProcessedHistory(structuralPartial), false); + assert.equal(shouldAdvanceProcessedHistory(structuralPartial), true); const semanticFailed = createBatchStatusSkeleton({ processedRange: [5, 5], @@ -2454,7 +2454,23 @@ async function testProcessedHistoryAdvanceRequiresCompleteStrongSuccess() { assert.equal(semanticFailed.completed, true); assert.equal(semanticFailed.outcome, "failed"); assert.equal(semanticFailed.consistency, "strong"); - assert.equal(shouldAdvanceProcessedHistory(semanticFailed), false); + assert.equal(shouldAdvanceProcessedHistory(semanticFailed), true); + + const finalizeFailed = createBatchStatusSkeleton({ + processedRange: [6, 7], + extractionCountBefore: 0, + }); + setBatchStageOutcome(finalizeFailed, "core", "success"); + setBatchStageOutcome( + finalizeFailed, + "finalize", + "failed", + "vector finalize down", + ); + finalizeBatchStatus(finalizeFailed); + assert.equal(finalizeFailed.completed, false); + assert.equal(finalizeFailed.outcome, "failed"); + assert.equal(shouldAdvanceProcessedHistory(finalizeFailed), true); const fullSuccess = createBatchStatusSkeleton({ processedRange: [8, 9], @@ -3954,7 +3970,7 @@ await testReverseJournalRecoveryPlanMixedLegacyAndCurrentRetainsRepairSet(); await testBatchStatusStructuralPartialRemainsRecoverable(); await testBatchStatusSemanticFailureDoesNotHideCoreSuccess(); await testBatchStatusFinalizeFailureIsNotCompleteSuccess(); -await testProcessedHistoryAdvanceRequiresCompleteStrongSuccess(); +await testProcessedHistoryAdvanceTracksCoreExtractionSuccess(); await testGenerationRecallTransactionDedupesDoubleHookBySameKey(); await testGenerationRecallTransactionDedupesReverseHookOrder(); await testGenerationRecallHistoryModesUseSameBindingAcrossHooks();