fix(reasoning): preserve investigation ownership across selection and question rejection
This commit is contained in:
+15
-5
@@ -249,7 +249,7 @@ function semanticSignature(candidate) {
|
||||
);
|
||||
}
|
||||
|
||||
function classifyCandidateOrdering(candidates) {
|
||||
function classifyCandidateOrdering(candidates, activeNodeId = null) {
|
||||
const displayOrder = buildCandidateDisplayOrder(candidates);
|
||||
const best = displayOrder[0] ?? null;
|
||||
if (!best) {
|
||||
@@ -319,15 +319,21 @@ function classifyCandidateOrdering(candidates) {
|
||||
}
|
||||
|
||||
if (topStructuralCandidates.length > 0) {
|
||||
const activeTiedCandidate = activeNodeId
|
||||
? topStructuralCandidates.find((candidate) => candidate.nodeId === activeNodeId)
|
||||
: null;
|
||||
|
||||
return {
|
||||
displayOrder,
|
||||
best,
|
||||
best: activeTiedCandidate || best,
|
||||
leadingCandidates: topStructuralCandidates,
|
||||
status: "selected",
|
||||
tieType: "complete_unresolved_tie",
|
||||
usedAlphabeticalOrdering: true,
|
||||
usedAlphabeticalOrdering: activeTiedCandidate ? false : true,
|
||||
reason:
|
||||
"Leading candidates remained tied after score, structural, and semantic checks, so the stable deterministic display order was used as the final fallback.",
|
||||
activeTiedCandidate
|
||||
? "Leading candidates remained tied after score, structural, and semantic checks, so existing active investigation ownership was preserved."
|
||||
: "Leading candidates remained tied after score, structural, and semantic checks, so the stable deterministic display order was used as the final fallback.",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -624,6 +630,7 @@ export function selectActiveUnknownCandidate(graph, resolvedNodeIds) {
|
||||
...candidate,
|
||||
node,
|
||||
})),
|
||||
graph?.activeUnknownNodeId ?? null,
|
||||
);
|
||||
|
||||
if (selection.status === "ambiguous") {
|
||||
@@ -690,7 +697,10 @@ export function explainUnknownSelection(graph, resolvedNodeIds = []) {
|
||||
...scoreUnknownCandidate(graph, node, resolvedNodeIds),
|
||||
}));
|
||||
|
||||
const selection = classifyCandidateOrdering(candidates);
|
||||
const selection = classifyCandidateOrdering(
|
||||
candidates,
|
||||
graph?.activeUnknownNodeId ?? null,
|
||||
);
|
||||
const orderedCandidates = selection.displayOrder;
|
||||
const selected = selection.best;
|
||||
const competitors = orderedCandidates
|
||||
|
||||
Reference in New Issue
Block a user