fix(rectification): pass birthDate into the choice-path gate
Independent Staging Quality Gate / validate (push) Successful in 10m27s
Independent Staging Quality Gate / publish (push) Successful in 8m35s

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:
Jesse_Chen
2026-08-29 12:57:10 +08:00
co-authored by Cursor
parent 57e5f92d40
commit c960691ee5
3 changed files with 27 additions and 9 deletions
@@ -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) {