Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

fix(action-center): show added, renamed and deleted tasks in an action's history (#1078)

Cihan0751e9658bd9
diff --git a/web/messages/en.json b/web/messages/en.json
index 99100a094..4f95b580f 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -710,6 +710,9 @@
"assigned": "Assignee changed",
"due_date_set": "Due date updated",
"task_status": "Task updated",
+ "task_added": "Task added: “{title}”",
+ "task_renamed": "Task renamed to “{title}”",
+ "task_deleted": "Task deleted",
"task_ran": "{task} — carried out automatically ({tool})",
"task_run_failed": "{task} — the automatic attempt failed; it needs doing by hand",
"task_awaiting_approval": "{task} — waiting for your approval before it reaches outside Ansvisor",
diff --git a/web/src/components/action-center/action-drawer.tsx b/web/src/components/action-center/action-drawer.tsx
index 8902db8e7..68a50b08d 100644
--- a/web/src/components/action-center/action-drawer.tsx
+++ b/web/src/components/action-center/action-drawer.tsx
@@ -471,6 +471,9 @@ export function ActionDrawer({
tool: String(event.data.tool ?? ''),
improved: Number(event.data.improved ?? 0),
measurable: Number(event.data.measurable ?? 0),
+ // A task someone added or renamed is named in their
+ // own words, as they typed it.
+ title: String(event.data.title ?? ''),
})}
</p>
<p className="text-xs text-muted-foreground">
diff --git a/web/src/lib/action-center/display.test.ts b/web/src/lib/action-center/display.test.ts
index 3b0577bcb..dd7098926 100644
--- a/web/src/lib/action-center/display.test.ts
+++ b/web/src/lib/action-center/display.test.ts
@@ -1,3 +1,6 @@
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { createTranslator } from 'next-intl';
import { describe, expect, it } from 'vitest';
import {
actionContextTags,
@@ -222,3 +225,56 @@ describe('eventTaskText', () => {
expect(eventTaskText(42, withHas)).toBe('');
});
});
+
+/**
+ * Every event the server actions write to an action's trail is a line in the
+ * drawer's History tab, and an event with no message there shows next-intl's
+ * missing-message text instead. The events are read from the server actions'
+ * own source, so one added there without copy fails here, not in the drawer.
+ */
+describe('History events', () => {
+ const source = readFileSync(join(__dirname, '../actions/action-center.ts'), 'utf8');
+ const logged = [...source.matchAll(/logEvent\(\s*\w+,\s*\w+,\s*'(\w+)'/g)].map(
+ (match) => match[1],
+ );
+
+ const tPage = createTranslator({
+ locale: 'en',
+ messages,
+ namespace: 'actionCenter.actionsPage',
+ onError: (error) => {
+ throw error;
+ },
+ });
+ /** The values the drawer formats every event with. */
+ const values = {
+ to: 'done',
+ count: 2,
+ task: 'Validate the change',
+ tool: 'site_audit',
+ improved: 1,
+ measurable: 2,
+ title: 'Ask the agency',
+ };
+ const eventText = (event: string) =>
+ tPage(`drawer.events.${event}` as Parameters<typeof tPage>[0], values);
+
+ /** A pattern that stopped matching would pass every check below by
+ * checking nothing. */
+ it('reads the events the server actions log', () => {
+ expect(logged).toEqual(
+ expect.arrayContaining(['status_changed', 'task_added', 'task_renamed', 'task_deleted']),
+ );
+ });
+
+ it.each(logged)('has a History line for %s', (event) => {
+ expect(() => eventText(event)).not.toThrow();
+ });
+
+ /** A task someone added or renamed is named as they typed it. */
+ it('names the task in its own words', () => {
+ expect(eventText('task_added')).toBe('Task added: “Ask the agency”');
+ expect(eventText('task_renamed')).toBe('Task renamed to “Ask the agency”');
+ expect(eventText('task_deleted')).toBe('Task deleted');
+ });
+});