fix(reasoning): ask for missing sufficiency confirmation

This commit is contained in:
2026-08-14 18:01:27 +01:00
parent c335bf0a9a
commit 8311a176a5
2 changed files with 289 additions and 0 deletions
+41
View File
@@ -1,3 +1,8 @@
import {
hasRemainingMaterialFactors,
isUserConfirmationOfNoRemainingUncertainty,
} from "./decision-sufficiency.js";
function normaliseText(value) {
return String(value || "")
.toLowerCase()
@@ -1997,6 +2002,42 @@ export function formulateQuestion({ node, graph, context = {} }) {
};
}
// ── State B: unresolved decision with zero remaining factors but
// no explicit sufficiency confirmation yet ────────────────
// Detected transiently from existing state; no persisted field required.
if (
reasoningPatternSelection.pattern === "decision" &&
node.kind !== "unknown" &&
node.status !== "known" &&
node.status !== "resolved" &&
node.status !== "contradicted" &&
hasRemainingMaterialFactors(node.id, graph) === false
) {
const resolved = context.resolvedValues || [];
const hasConfirmation = resolved.some((v) =>
isUserConfirmationOfNoRemainingUncertainty(v),
);
if (!hasConfirmation) {
return {
question:
"Is there anything else material that could change which option is better?",
reason:
"All represented material factors are resolved but explicit sufficiency confirmation has not yet been provided.",
strategy: null,
investigationStrategy: null,
reasoningPattern: reasoningPatternSelection.pattern,
reasoningPatternReason: reasoningPatternSelection.reason,
questionFamily: "decision_threshold",
allowedQuestionFamilies,
rejectedQuestionFamilies,
selectedQuestionTemplate: "decision_threshold_sufficiency_confirmation",
questionComplexity: null,
plainLanguageNormalisations: [],
};
}
}
const investigationStrategy = selectInvestigationStrategy({
node,
graph,