fix(rectification): re-ask superseded collect ids instead of fake delivery (BUG-644/645)

A superseded collect row still occupied the unique question id, so the last
"没有" skipped the unasked domain and spoke delivery copy while can_adopt stayed false.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-10 21:03:12 +08:00
co-authored by Cursor
parent d40f2032fc
commit a3a51c32c2
11 changed files with 621 additions and 79 deletions
@@ -45,7 +45,7 @@ import {
} from "@/lib/rectification-agentic/v9/turn-intent-classifier";
import { persistServerOwnedFocus, openQuestionFromPersistedFocus, isCollectFocusSchema, isRenderableChoiceOpenQuestion } from "@/lib/rectification-agentic/v9/server-focus";
import { buildMethodFollowupPlan } from "@/lib/rectification-agentic/v9/method-followup";
import { isNonConvergingRangeOffer, nonConvergingRangeNarration } from "@/lib/rectification-agentic/core/rectification-decision";
import { deliveryNarrationAllowed, isNonConvergingRangeOffer, nonConvergingRangeNarration } from "@/lib/rectification-agentic/core/rectification-decision";
import { RECTIFICATION_USER_COPY } from "@/lib/rectification-agentic/user-copy";
import { parseDeclaredBirthWindow } from "@/lib/rectification-agentic/v9/declared-window-utterance";
import {
@@ -607,7 +607,15 @@ export async function POST(request: Request) {
caseId,
narrateAdopt,
});
const assistantMessage = idle.hostNarration || nonConvergingRangeNarration(decision);
const allowDelivery = deliveryNarrationAllowed(decision, decision.nextAction);
const intermediate = nonConvergingRangeNarration({
credibleRange: decision.credibleRange,
representativeTime: decision.representativeTime,
variant: "intermediate",
});
const assistantMessage = allowDelivery
? (idle.hostNarration || nonConvergingRangeNarration(decision))
: ((idle.terminalNote ? "" : idle.hostNarration) || intermediate);
const turn = await persistV9DeterministicTurn(accounting, userId, caseId, {
requestId,
userMessage: parsed.data.message ?? null,