ГЛОБАЛЬНЫЙ РЕФАКТОРИНГ АРХИТЕКТУРЫ - Рефакторинг этапов Stage 3.2 В оркестрации добавлено семантический арбитраж fallbackов (учет guard_hints и extraction) и followup-override для aggregate/unsupported кейсов. \ Убрано залипание в address_lane при carryover-контексте для кейса типа какие обороты ... за 2020, но сохранил защиту поддержанных интентов (list_open_contracts и т.п.), кроме strict deep-диагностики.

This commit is contained in:
2026-04-11 17:04:50 +03:00
parent a7ccc92a9c
commit c2fa360eb9
5 changed files with 332 additions and 16 deletions
@@ -228,6 +228,50 @@ describe("assistant orchestration contract", () => {
]).toContain(String(decision.livingReason));
});
it("routes unsupported turnover query to deep even with followup context carryover", () => {
const decision = resolveAssistantOrchestrationDecision({
rawUserMessage: "\u043a\u0430\u043a\u0438\u0435 \u043e\u0431\u043e\u0440\u043e\u0442\u044b \u043f\u043e \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0435 \u0437\u0430 2020 \u0433\u043e\u0434",
effectiveAddressUserMessage: "\u041e\u0431\u043e\u0440\u043e\u0442\u044b \u043f\u043e \u0441\u0447\u0435\u0442\u0443 '\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430' \u0437\u0430 2020 \u0433\u043e\u0434.",
followupContext: {
previous_intent: "list_documents_by_contract",
previous_filters: {
organization: "\u041e\u041e\u041e \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u041f\u043b\u044e\u0441"
}
},
llmPreDecomposeMeta: {
applied: true,
llmCanonicalCandidateDetected: true,
predecomposeContract: {
mode: "unsupported",
mode_confidence: "low",
intent: "account_balance_snapshot",
intent_confidence: "high"
},
semanticExtractionContract: {
extraction: {
query_shape: "AGGREGATE_LOOKUP",
aggregation_profile: "management_profile"
},
guard_hints: {
deep_investigation_signal_detected: false
}
}
} as any,
useMock: false
});
expect(decision.runAddressLane).toBe(false);
expect(decision.toolGateDecision).toBe("skip_address_lane");
expect(decision.livingMode).toBe("deep_analysis");
expect([
"address_signal_unsupported_intent_fallback_to_deep",
"aggregate_analytics_signal_fallback_to_deep"
]).toContain(String(decision.toolGateReason));
expect(
decision.orchestrationContract?.semantic_route_arbitration?.followup_semantic_override_to_deep_allowed
).toBe(true);
});
it("routes profitability ranking query to deep analysis instead of address lane", () => {
const decision = resolveAssistantOrchestrationDecision({
rawUserMessage: "\u043a\u0430\u043a\u043e\u0439 \u0441\u0430\u043c\u044b\u0439 \u0434\u043e\u0445\u043e\u0434\u043d\u044b\u0439 \u0433\u043e\u0434?",