merge deterministic memory review fix
CI / test (push) Failing after 33s

This commit is contained in:
m
2026-08-30 00:48:30 +03:00
2 changed files with 13 additions and 7 deletions
+10 -4
View File
@@ -25,13 +25,19 @@ func TestShouldInvokeHumanResponseSkipsDeterministicFastPaths(t *testing.T) {
}
func TestShouldReviewResponseSkipsStableAnswers(t *testing.T) {
if shouldReviewResponse("Здравствуйте.", false, true) {
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("Меня зовут Домовой.", false, false, "Меня зовут Домовой.", "") {
t.Fatal("identity reply must not wait for response review")
}
if shouldReviewResponse("Ответ", true, false) {
if shouldReviewResponse("Запомнил.", false, false, "", "Запомнил.") {
t.Fatal("memory instruction reply must not wait for response review")
}
if !shouldReviewResponse("Ответ", false, false, "", "") {
t.Fatal("non-conversational answer remains reviewable")
}
if shouldReviewResponse("Ответ", true, false, "", "") {
t.Fatal("stable knowledge answer must not be reviewed twice")
}
}
+3 -3
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 shouldReviewResponse(planningReply, stableKnowledgeReply, stableConversational) {
if shouldReviewResponse(planningReply, stableKnowledgeReply, stableConversational, identityReply, memoryInstructionReply) {
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,8 +1735,8 @@ 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 shouldReviewResponse(planningReply string, stableKnowledgeReply, stableConversational bool, identityReply, memoryInstructionReply string) bool {
return strings.TrimSpace(planningReply) != "" && !stableKnowledgeReply && !stableConversational && identityReply == "" && memoryInstructionReply == ""
}
func shouldRunGeneralResearch(kind interaction.InformationRequestKind) bool {