merge stable response review fix
CI / test (push) Failing after 32s

This commit is contained in:
m
2026-08-30 00:30:05 +03:00
2 changed files with 17 additions and 1 deletions
@@ -23,3 +23,15 @@ func TestShouldInvokeHumanResponseSkipsDeterministicFastPaths(t *testing.T) {
})
}
}
func TestShouldReviewResponseSkipsStableAnswers(t *testing.T) {
if shouldReviewResponse("Здравствуйте.", false, true) {
t.Fatal("stable conversational reply must not wait for response review")
}
if shouldReviewResponse("Запомнил.", false, false) != true {
t.Fatal("non-conversational deterministic reply remains reviewable")
}
if shouldReviewResponse("Ответ", true, false) {
t.Fatal("stable knowledge answer must not be reviewed twice")
}
}
+5 -1
View File
@@ -1063,7 +1063,7 @@ func main() {
// route with compact, source-aware context. Re-reviewing the same answer
// serially can exhaust the household request budget on a loaded local
// provider and turn a valid answer into a degraded response.
if strings.TrimSpace(planningReply) != "" && !stableKnowledgeReply {
if shouldReviewResponse(planningReply, stableKnowledgeReply, stableConversational) {
reviewContext, cancelReview := context.WithTimeout(r.Context(), 12*time.Second)
reviewedReply, reviewErr := cognitiveClient.ReviewResponse(reviewContext, session, utterance.Content, planningReply, gen2Context.Text, cognitive.TaskMeaning{
SpeechAct: string(semantic.Interpretation.SpeechAct),
@@ -1735,6 +1735,10 @@ func shouldInvokeHumanResponse(stableConversational bool, identityReply, memoryI
return !stableConversational && identityReply == "" && memoryInstructionReply == ""
}
func shouldReviewResponse(planningReply string, stableKnowledgeReply, stableConversational bool) bool {
return strings.TrimSpace(planningReply) != "" && !stableKnowledgeReply && !stableConversational
}
func shouldRunGeneralResearch(kind interaction.InformationRequestKind) bool {
return kind == "" || kind == interaction.InformationRequestTimeDifference
}