diff --git a/cmd/core-runtime/main.go b/cmd/core-runtime/main.go index 9c627a6..c03e182 100644 --- a/cmd/core-runtime/main.go +++ b/cmd/core-runtime/main.go @@ -2029,7 +2029,12 @@ func stableKnowledgeAnswer(answer string) bool { // completed entirely in the reply. It excludes specialized routes and durable // work, so cognition can produce content but cannot stand in for an executor. func shouldGenerateNonMutatingTextDirective(semantic interactiondomain.SemanticResult, routes []chatRoute, helpPath work.HelpPath, creativeRequest bool) bool { - if semantic.Interpretation.SpeechAct != interaction.SpeechActDirective || creativeRequest || helpPath.Kind != "" || helpPath.NeedsDurableWork { + if semantic.Interpretation.SpeechAct != interaction.SpeechActDirective || creativeRequest || helpPath.NeedsDurableWork { + return false + } + // ANSWER and COGNITION are reply-only help paths. They do not execute an + // external action, unlike direct capabilities, gaps or durable work. + if helpPath.Kind != work.HelpPathAnswer && helpPath.Kind != work.HelpPathCognition && helpPath.Kind != "" { return false } return !hasChatRoute(routes, chatRouteResearch) && !hasChatRoute(routes, chatRouteMedia) && !hasChatRoute(routes, chatRouteAgent) diff --git a/cmd/core-runtime/main_test.go b/cmd/core-runtime/main_test.go index 4bbce78..3c0fd9d 100644 --- a/cmd/core-runtime/main_test.go +++ b/cmd/core-runtime/main_test.go @@ -151,6 +151,12 @@ func TestNonMutatingTextDirectiveCanUseCognitiveReply(t *testing.T) { if !shouldGenerateNonMutatingTextDirective(semantic, nil, work.HelpPath{}, false) { t.Fatal("ordinary formatting directive was not eligible for a cognitive reply") } + if !shouldGenerateNonMutatingTextDirective(semantic, nil, work.HelpPath{Kind: work.HelpPathCognition}, false) { + t.Fatal("reply-only cognition path was incorrectly rejected") + } + if shouldGenerateNonMutatingTextDirective(semantic, nil, work.HelpPath{Kind: work.HelpPathDirectCapability}, false) { + t.Fatal("direct capability was incorrectly replaced by a textual reply") + } if shouldGenerateNonMutatingTextDirective(semantic, []chatRoute{{Kind: chatRouteMedia}}, work.HelpPath{}, false) { t.Fatal("media route was incorrectly replaced by a textual reply") }