From 3d43f34d3b3134c7c2e1a44e3d85a37daeb6de7a Mon Sep 17 00:00:00 2001 From: kami Date: Wed, 10 Jun 2026 21:31:34 +0400 Subject: [PATCH] fix(narration): use plan_rejected kind and include source in instruction --- .../com/correx/apps/server/narration/NarrationSubscriber.kt | 2 +- .../correx/apps/server/narration/NarrationSubscriberTest.kt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/server/src/main/kotlin/com/correx/apps/server/narration/NarrationSubscriber.kt b/apps/server/src/main/kotlin/com/correx/apps/server/narration/NarrationSubscriber.kt index c58de559..93a46cf6 100644 --- a/apps/server/src/main/kotlin/com/correx/apps/server/narration/NarrationSubscriber.kt +++ b/apps/server/src/main/kotlin/com/correx/apps/server/narration/NarrationSubscriber.kt @@ -68,7 +68,7 @@ class NarrationSubscriber( ) is ExecutionPlanRejectedEvent -> enqueue( sid, - NarrationTrigger(kind = "execution_plan_rejected", instruction = "The execution plan was rejected: ${p.reason}. Explain to the user what happened and what they can do next."), + NarrationTrigger(kind = "plan_rejected", instruction = "The execution plan was rejected (${p.source}): ${p.reason}. Explain to the user what happened and what they can do next."), ) is OrchestrationPausedEvent -> enqueue( sid, diff --git a/apps/server/src/test/kotlin/com/correx/apps/server/narration/NarrationSubscriberTest.kt b/apps/server/src/test/kotlin/com/correx/apps/server/narration/NarrationSubscriberTest.kt index c0136a19..3bdf5515 100644 --- a/apps/server/src/test/kotlin/com/correx/apps/server/narration/NarrationSubscriberTest.kt +++ b/apps/server/src/test/kotlin/com/correx/apps/server/narration/NarrationSubscriberTest.kt @@ -221,10 +221,14 @@ class NarrationSubscriberTest { } assertEquals(1, facade.calls.size) - assertEquals("execution_plan_rejected", facade.calls[0].second.kind) + assertEquals("plan_rejected", facade.calls[0].second.kind) assertTrue( facade.calls[0].second.instruction.contains("Missing required artifact"), "instruction must include the rejection reason", ) + assertTrue( + facade.calls[0].second.instruction.contains("missing_content"), + "instruction must include the source", + ) } }