fix(rectification): pass birthDate into the choice-path gate
The post-choice decision used a looser plan than the followup builder. Load compute once in persistApplied and feed the same birthDate to both. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -252,6 +252,7 @@ async function persistNextInterviewAfterChoice(input: {
|
||||
dossier: Parameters<typeof decideAfterInferenceChange>[0]["dossier"];
|
||||
decisionState: InferenceState | null;
|
||||
nextAction: ReturnType<typeof publicNextAction>;
|
||||
birthDate?: string | null;
|
||||
}): Promise<{ hostNarration: string | null; choiceReady: boolean }> {
|
||||
const latest = input.dossier.latestResult
|
||||
? {
|
||||
@@ -264,13 +265,7 @@ async function persistNextInterviewAfterChoice(input: {
|
||||
: {
|
||||
decisionReceipt: input.decisionState ? { inference_state: input.decisionState } : null,
|
||||
};
|
||||
let birthDate: string | null = null;
|
||||
try {
|
||||
const compute = await loadV9CaseCompute(input.accounting, input.userId, input.caseId);
|
||||
birthDate = String(compute.baselineBirthSnapshot.birth_date ?? "") || null;
|
||||
} catch {
|
||||
// Ranking stays fail-open when compute is unavailable.
|
||||
}
|
||||
const birthDate = input.birthDate ?? null;
|
||||
const catalog = rectificationFollowupCatalog(latest, input.dossier.evidence);
|
||||
const sessionOutcome = typeof input.nextAction.session_outcome === "string"
|
||||
? input.nextAction.session_outcome as SessionOutcomeKind
|
||||
@@ -404,10 +399,18 @@ async function persistApplied(
|
||||
inference: input.inference,
|
||||
});
|
||||
|
||||
let birthDate: string | null = null;
|
||||
try {
|
||||
const compute = await loadV9CaseCompute(accounting, command.userId, command.caseId);
|
||||
birthDate = String(compute.baselineBirthSnapshot.birth_date ?? "") || null;
|
||||
} catch {
|
||||
// Ranking stays fail-open when compute is unavailable.
|
||||
}
|
||||
const nextAction = publicNextAction(decideAfterInferenceChange({
|
||||
dossier: input.dossier,
|
||||
state: input.decisionState ?? null,
|
||||
userStopped: input.userStopped === true,
|
||||
birthDate,
|
||||
}));
|
||||
|
||||
let narrationPersisted = false;
|
||||
@@ -422,6 +425,7 @@ async function persistApplied(
|
||||
dossier: input.dossier,
|
||||
decisionState: input.decisionState ?? null,
|
||||
nextAction,
|
||||
birthDate,
|
||||
});
|
||||
nextChoiceReady = nextInterview.choiceReady;
|
||||
if (nextInterview.hostNarration) {
|
||||
|
||||
Reference in New Issue
Block a user