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:
@@ -126,12 +126,22 @@ describe("NotificationService", () => {
|
||||
service.registerProvider(provider);
|
||||
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(() => {
|
||||
expect(sendNotification).toHaveBeenCalledWith(
|
||||
"task-created",
|
||||
expect.objectContaining({
|
||||
taskId: "FN-201",
|
||||
taskDescription: "Investigate the notification payload fallback",
|
||||
event: "task-created",
|
||||
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 () => {
|
||||
await provider.sendNotification("message:agent-to-user" as any, {
|
||||
taskId: "FN-1",
|
||||
|
||||
@@ -179,6 +179,7 @@ export class NotificationService {
|
||||
this.maybeNotify(task.id, "task-created", {
|
||||
taskId: task.id,
|
||||
taskTitle: task.title,
|
||||
taskDescription: task.description,
|
||||
event: "task-created",
|
||||
metadata: {
|
||||
sourceAgentId,
|
||||
|
||||
Reference in New Issue
Block a user