From bbecadcec2f46a992923d7706ec8051a6142fe46 Mon Sep 17 00:00:00 2001 From: Mikhail Date: Wed, 26 Aug 2026 09:58:20 +0300 Subject: [PATCH] Allow review of backed research answers --- cmd/core-runtime/main.go | 8 +++++++- cmd/core-runtime/main_test.go | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/core-runtime/main.go b/cmd/core-runtime/main.go index 3b32028..8861df6 100644 --- a/cmd/core-runtime/main.go +++ b/cmd/core-runtime/main.go @@ -999,7 +999,13 @@ func main() { ConfidenceMillis: semantic.Interpretation.ConfidenceMillis, }) cancelReview() - stableSemanticReply := mediaAttempted || identityReply != "" || memoryInstructionReply != "" || creativeReply != "" || (creativeFallbackReply != "" && !cognitiveAvailable) || semantic.InformationRequestKind != "" || locationReply != "" || deterministicSpeechAct == interaction.SpeechActConversational || deterministicSpeechAct == interaction.SpeechActConfirmation || deterministicSpeechAct == interaction.SpeechActRejection + // A source-backed research result is owned by the research capability, + // but its wording is not canonical state. Let the cognitive editor turn + // it into a useful human answer while reviewPreservesResearchEvidence + // still requires the source evidence to remain present. Information + // requests without research (identity, channel state and so on) remain + // stable semantic replies and cannot be rewritten here. + stableSemanticReply := mediaAttempted || identityReply != "" || memoryInstructionReply != "" || creativeReply != "" || (creativeFallbackReply != "" && !cognitiveAvailable) || (semantic.InformationRequestKind != "" && !(researchAttempted && researchBacked)) || locationReply != "" || deterministicSpeechAct == interaction.SpeechActConversational || deterministicSpeechAct == interaction.SpeechActConfirmation || deterministicSpeechAct == interaction.SpeechActRejection if reviewErr != nil { log.Printf("cognitive response review unavailable: %v", reviewErr) } else if reviewMayReplacePlanningReply(stableSemanticReply, stableKnowledgeReply, researchAttempted, researchBacked, reviewedReply, planningReply) { diff --git a/cmd/core-runtime/main_test.go b/cmd/core-runtime/main_test.go index a0764d5..4a718e4 100644 --- a/cmd/core-runtime/main_test.go +++ b/cmd/core-runtime/main_test.go @@ -138,6 +138,11 @@ func TestResponseReviewPreservesAttemptedResearchOutcome(t *testing.T) { if !reviewMayReplacePlanningReply(true, true, false, false, "Санкт-Петербург — город в России.", "Меня зовут Домовой. Санкт-Петербург — город в России.") { t.Fatal("stable-knowledge draft must be eligible for semantic quality review") } + // The caller must not mark a source-backed research result as immutable + // semantic state: it may be rewritten, but only with its evidence retained. + if !reviewMayReplacePlanningReply(false, false, true, true, "Из Москвы в Сочи можно добраться самолётом или поездом. Источник: https://example.test", "Сырые результаты. Источник: https://example.test") { + t.Fatal("source-backed research draft must be eligible for human-facing review") + } } func TestBearerTokenRequiresBearerScheme(t *testing.T) { -- 2.54.0