FN-5890: include task description in ntfy task-created notifications
Ensure agent-created ntfy notifications fall back to the task description when the title is still empty. - pass task descriptions through task-created notification payloads - cover empty-title task creation in notification service tests - verify ntfy task-created messages render the id+description fallback - add a patch changeset for the published CLI package Files changed: .changeset/fn-5890-task-created-title.md | 5 +++++ .../engine/src/__tests__/notification-service.test.ts | 12 +++++++++++- packages/engine/src/__tests__/ntfy-provider.test.ts | 16 ++++++++++++++++ packages/engine/src/notification/notification-service.ts | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) Fusion-Task-Id: FN-5890 Fusion-Task-Lineage: 4a67a4d0-c3a8-4923-a506-7a67a8836127
This commit is contained in:
5
.changeset/fn-5890-task-created-title.md
Normal file
5
.changeset/fn-5890-task-created-title.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@runfusion/fusion": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix agent-created ntfy task notifications so they include the task description when a title has not been assigned yet.
|
||||||
@@ -126,12 +126,22 @@ describe("NotificationService", () => {
|
|||||||
service.registerProvider(provider);
|
service.registerProvider(provider);
|
||||||
await service.start();
|
await service.start();
|
||||||
|
|
||||||
store.emit("task:created", task({ id: "FN-201", sourceAgentId: "agent-1", sourceType: "agent_heartbeat" as any }));
|
store.emit(
|
||||||
|
"task:created",
|
||||||
|
task({
|
||||||
|
id: "FN-201",
|
||||||
|
title: "",
|
||||||
|
description: "Investigate the notification payload fallback",
|
||||||
|
sourceAgentId: "agent-1",
|
||||||
|
sourceType: "agent_heartbeat" as any,
|
||||||
|
}),
|
||||||
|
);
|
||||||
await vi.waitFor(() => {
|
await vi.waitFor(() => {
|
||||||
expect(sendNotification).toHaveBeenCalledWith(
|
expect(sendNotification).toHaveBeenCalledWith(
|
||||||
"task-created",
|
"task-created",
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
taskId: "FN-201",
|
taskId: "FN-201",
|
||||||
|
taskDescription: "Investigate the notification payload fallback",
|
||||||
event: "task-created",
|
event: "task-created",
|
||||||
metadata: expect.objectContaining({ sourceAgentId: "agent-1", agentName: "Triage Bot" }),
|
metadata: expect.objectContaining({ sourceAgentId: "agent-1", agentName: "Triage Bot" }),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -135,6 +135,22 @@ describe("NtfyNotificationProvider", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("renders task-created with description fallback when title is empty", async () => {
|
||||||
|
await provider.sendNotification("task-created" as any, {
|
||||||
|
taskId: "FN-1",
|
||||||
|
taskTitle: "",
|
||||||
|
taskDescription: "Investigate the notification payload fallback",
|
||||||
|
event: "task-created" as any,
|
||||||
|
metadata: { agentName: "Triage Bot" },
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(mocks.sendNtfyNotificationWithResult).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
message: expect.stringContaining('Triage Bot created "FN-1: Investigate the notification payload fallback"'),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("builds click URL from config for task message events", async () => {
|
it("builds click URL from config for task message events", async () => {
|
||||||
await provider.sendNotification("message:agent-to-user" as any, {
|
await provider.sendNotification("message:agent-to-user" as any, {
|
||||||
taskId: "FN-1",
|
taskId: "FN-1",
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ export class NotificationService {
|
|||||||
this.maybeNotify(task.id, "task-created", {
|
this.maybeNotify(task.id, "task-created", {
|
||||||
taskId: task.id,
|
taskId: task.id,
|
||||||
taskTitle: task.title,
|
taskTitle: task.title,
|
||||||
|
taskDescription: task.description,
|
||||||
event: "task-created",
|
event: "task-created",
|
||||||
metadata: {
|
metadata: {
|
||||||
sourceAgentId,
|
sourceAgentId,
|
||||||
|
|||||||
Reference in New Issue
Block a user