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.

feat(action-center): ask why an action is dismissed, and keep the reason (learning A5) (#1692)

Cihan817ac16cc4db
diff --git a/docs/guides/action-center.mdx b/docs/guides/action-center.mdx
index 1f35e2eb8..c42f55d07 100644
--- a/docs/guides/action-center.mdx
+++ b/docs/guides/action-center.mdx
@@ -67,7 +67,7 @@ The cards at the top count and filter the list. Click one to narrow the table to
Below them, filter by category, **Priority**, **Status** and **Assignee**, or search. **Sort** by Priority (the default), Newest, Due date or Recently updated. Filters live in the URL, so a filtered view can be shared.
-An action's status is **New**, **In Progress**, **On Hold**, **Completed** or **Dismissed**. The row menu sets In Progress, Completed or Dismiss without opening the action. **Delete** (admins and managers only) removes it for everyone, and it won't come back on its own the next day.
+An action's status is **New**, **In Progress**, **On Hold**, **Completed** or **Dismissed**. The row menu sets In Progress, Completed or Dismiss without opening the action. Dismissing, from the row menu or the action's status, asks why: it doesn't matter to us, it's already done, the data behind it is wrong, or not now (or none). History shows the reason. **Delete** (admins and managers only) removes it for everyone, and it won't come back on its own the next day.
### Inside an action
diff --git a/supabase/migrations/00366_action_dismiss_reason.sql b/supabase/migrations/00366_action_dismiss_reason.sql
new file mode 100644
index 000000000..574013e17
--- /dev/null
+++ b/supabase/migrations/00366_action_dismiss_reason.sql
@@ -0,0 +1,27 @@
+-- ============================================================================
+-- 00366: why an action was dismissed (learning A5)
+-- ============================================================================
+-- Dismissing an Action Center action asked nothing, so a dismissal taught
+-- nothing: the same definition could open again 14 days later for the same
+-- reason it was turned down. The person now says why, as a content
+-- opportunity's dismissal does (CONTENT-006): the reason is kept while the
+-- action stays dismissed, and cleared when it's set to another status.
+-- Nothing reads it to rank or rest actions yet (phase B).
+
+alter table public.actions
+ add column if not exists dismiss_reason text;
+
+alter table public.actions
+ drop constraint if exists actions_dismiss_reason_check;
+
+alter table public.actions
+ add constraint actions_dismiss_reason_check
+ check (
+ dismiss_reason is null
+ or dismiss_reason in ('not_relevant', 'already_done', 'wrong_data', 'not_now')
+ );
+
+comment on column public.actions.dismiss_reason is
+ 'Why the action was dismissed (00366, learning A5): not_relevant, already_done, wrong_data or not_now; null when no reason was given or the action is not dismissed.';
+
+notify pgrst, 'reload schema';
diff --git a/supabase/schema.sql b/supabase/schema.sql
index eba5c3b50..06a937358 100644
--- a/supabase/schema.sql
+++ b/supabase/schema.sql
@@ -41889,6 +41889,37 @@ alter table public.actions
notify pgrst, 'reload schema';
+-- ─────────────────────────────────────────────────────────────────────────
+-- migrations/00366_action_dismiss_reason.sql
+-- ─────────────────────────────────────────────────────────────────────────
+-- ============================================================================
+-- 00366: why an action was dismissed (learning A5)
+-- ============================================================================
+-- Dismissing an Action Center action asked nothing, so a dismissal taught
+-- nothing: the same definition could open again 14 days later for the same
+-- reason it was turned down. The person now says why, as a content
+-- opportunity's dismissal does (CONTENT-006): the reason is kept while the
+-- action stays dismissed, and cleared when it's set to another status.
+-- Nothing reads it to rank or rest actions yet (phase B).
+
+alter table public.actions
+ add column if not exists dismiss_reason text;
+
+alter table public.actions
+ drop constraint if exists actions_dismiss_reason_check;
+
+alter table public.actions
+ add constraint actions_dismiss_reason_check
+ check (
+ dismiss_reason is null
+ or dismiss_reason in ('not_relevant', 'already_done', 'wrong_data', 'not_now')
+ );
+
+comment on column public.actions.dismiss_reason is
+ 'Why the action was dismissed (00366, learning A5): not_relevant, already_done, wrong_data or not_now; null when no reason was given or the action is not dismissed.';
+
+notify pgrst, 'reload schema';
+
-- ─────────────────────────────────────────────────────────────────────────
-- migrations/00367_content_suggestion_decisions.sql
-- ─────────────────────────────────────────────────────────────────────────
diff --git a/web/messages/en.json b/web/messages/en.json
index 240f43c74..a9ce859a0 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -133,6 +133,27 @@
"toggleSubmenu": "Show or hide {label}"
},
"actionCenter": {
+ "dismissReason": {
+ "title": "Why dismiss it?",
+ "description": "This helps Ansvisor suggest the work that fits you.",
+ "not_relevant": {
+ "label": "It doesn't matter to us",
+ "hint": "What it's about isn't something the brand works on."
+ },
+ "already_done": {
+ "label": "It's already done",
+ "hint": "The work was done before, or somewhere Ansvisor doesn't see."
+ },
+ "wrong_data": {
+ "label": "The data behind it is wrong",
+ "hint": "The signals, prompts or pages it's built on don't hold."
+ },
+ "not_now": {
+ "label": "Not now",
+ "hint": "It's right, but other work comes first."
+ },
+ "skip": "Dismiss without saying why"
+ },
"tabs": {
"label": "Action Center sections",
"review": "Needs review",
@@ -2594,6 +2615,7 @@
"goal": "What was the goal?",
"whatHappened": "What happened?",
"triggeredBy": "Consolidated from {count, plural, one {# signal} other {# signals}}",
+ "dismissedBecause": "Dismissed: {reason}.",
"measuredOn": "Measured on the {entity, select, pages {{count, plural, one {page} other {# pages}}} other {{count, plural, one {prompt} other {# prompts}}}} it named.",
"brandWide": "Brand-wide over the same days: {list}",
"primary": "Judged by {metric}, its main metric.",
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/action-center/actions/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/action-center/actions/page.tsx
index e5cc59d76..69068b791 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/action-center/actions/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/action-center/actions/page.tsx
@@ -40,6 +40,7 @@ import {
ACTION_STATUSES,
OPEN_ACTION_STATUSES,
type ActionCategory,
+ type ActionDismissReason,
type ActionSort,
type ActionStatus,
} from '@/lib/action-center/registry';
@@ -364,10 +365,14 @@ function ActionsContent({ brand }: { brand: Brand }) {
});
}
};
- const changeStatus = (action: ActionItem, next: ActionStatus) =>
+ const changeStatus = (
+ action: ActionItem,
+ next: ActionStatus,
+ reason: ActionDismissReason | null = null,
+ ) =>
void runRowChange(
action,
- () => updateActionStatus(brand.id, action.id, next),
+ () => updateActionStatus(brand.id, action.id, next, reason),
t('rowMenu.statusChanged', { status: t(`status.${next}`) }),
);
const removeAction = (action: ActionItem) => {
diff --git a/web/src/components/action-center/action-drawer.tsx b/web/src/components/action-center/action-drawer.tsx
index cb87c0ded..0eb996f93 100644
--- a/web/src/components/action-center/action-drawer.tsx
+++ b/web/src/components/action-center/action-drawer.tsx
@@ -40,6 +40,7 @@ import {
type ActionTask,
} from '@/lib/actions/action-center';
import type { TeamMember } from '@/lib/actions/team';
+import { DismissReasonDialog } from './dismiss-reason-dialog';
import {
ACTION_STATUSES,
TASK_STATUSES,
@@ -158,6 +159,8 @@ export function ActionDrawer({
const tTaskCard = useTranslations('actionCenter.actionsPage.drawer.task');
const missingText = useMissingText();
const [checking, setChecking] = useState<string | null>(null);
+ // Dismissed from the status select: why, first (learning A5).
+ const [dismissing, setDismissing] = useState(false);
// The drafts written for the action's writing tasks (CE-022), once read.
const [drafts, setDrafts] = useState<ActionDraft[]>([]);
@@ -400,6 +403,17 @@ export function ActionDrawer({
return (
<Sheet open={Boolean(action)} onOpenChange={onOpenChange}>
+ {action && (
+ <DismissReasonDialog
+ open={dismissing}
+ onOpenChange={setDismissing}
+ onChoose={(reason) =>
+ void changeField({ status: 'dismissed' }, () =>
+ updateActionStatus(brandId, action.id, 'dismissed', reason),
+ )
+ }
+ />
+ )}
<SheetContent className="flex flex-col gap-0 p-0 data-[side=right]:w-full data-[side=right]:sm:max-w-xl">
{/* pt-3: the top row's buttons line up with the sheet's close button. */}
<SheetHeader className="border-b px-6 pt-3 pb-4 pr-12">
@@ -469,9 +483,12 @@ export function ActionDrawer({
<Select
value={action.status}
onValueChange={(value) =>
- void changeField({ status: value as ActionStatus }, () =>
- updateActionStatus(brandId, action.id, value as ActionStatus),
- )
+ // Dismissing asks why first (learning A5).
+ value === 'dismissed'
+ ? setDismissing(true)
+ : void changeField({ status: value as ActionStatus }, () =>
+ updateActionStatus(brandId, action.id, value as ActionStatus),
+ )
}
items={ACTION_STATUSES.map((status) => ({
value: status,
diff --git a/web/src/components/action-center/action-table.test.tsx b/web/src/components/action-center/action-table.test.tsx
index f49db384b..92c9f03ee 100644
--- a/web/src/components/action-center/action-table.test.tsx
+++ b/web/src/components/action-center/action-table.test.tsx
@@ -98,6 +98,25 @@ describe('ActionTable row menu', () => {
expect(onSelect).not.toHaveBeenCalled();
});
+ it('asks why before dismissing, and dismisses with the reason, or none (learning A5)', async () => {
+ render();
+ let items = await openMenu();
+ await act(async () => items[2].click());
+ expect(onStatusChange).not.toHaveBeenCalled();
+ const dialog = () => document.querySelector('[role="dialog"]')!;
+ expect(dialog().textContent).toContain('Why dismiss it?');
+ const choice = (label: string) =>
+ [...dialog().querySelectorAll('button')].find((b) => b.textContent?.startsWith(label))!;
+ await act(async () => choice("It's already done").click());
+ expect(onStatusChange).toHaveBeenCalledWith(action, 'dismissed', 'already_done');
+
+ onStatusChange.mockClear();
+ items = await openMenu();
+ await act(async () => items[2].click());
+ await act(async () => choice('Dismiss without saying why').click());
+ expect(onStatusChange).toHaveBeenCalledWith(action, 'dismissed', null);
+ });
+
it('asks before deleting, and deletes on Delete', async () => {
render();
const items = await openMenu();
diff --git a/web/src/components/action-center/action-table.tsx b/web/src/components/action-center/action-table.tsx
index 86eaa9209..6f445a1ec 100644
--- a/web/src/components/action-center/action-table.tsx
+++ b/web/src/components/action-center/action-table.tsx
@@ -48,7 +48,13 @@ import {
TableRow,
} from '@/components/ui/table';
import type { ActionItem } from '@/lib/actions/action-center';
-import type { ActionCategory, ActionKind, ActionStatus } from '@/lib/action-center/registry';
+import type {
+ ActionCategory,
+ ActionDismissReason,
+ ActionKind,
+ ActionStatus,
+} from '@/lib/action-center/registry';
+import { DismissReasonDialog } from './dismiss-reason-dialog';
import {
actionContextTags,
actionTexts,
@@ -215,13 +221,24 @@ function ActionMenu({
title: string;
canDelete: boolean;
disabled: boolean;
- onStatusChange: (action: ActionItem, status: ActionStatus) => void;
+ onStatusChange: (
+ action: ActionItem,
+ status: ActionStatus,
+ reason?: ActionDismissReason | null,
+ ) => void;
onDelete: (action: ActionItem) => void;
}) {
const t = useTranslations('actionCenter.actionsPage');
const [confirming, setConfirming] = useState(false);
+ // Dismissing asks why first (learning A5).
+ const [dismissing, setDismissing] = useState(false);
return (
<>
+ <DismissReasonDialog
+ open={dismissing}
+ onOpenChange={setDismissing}
+ onChoose={(reason) => onStatusChange(action, 'dismissed', reason)}
+ />
<DropdownMenu>
<DropdownMenuTrigger
className="rounded p-1 text-muted-foreground hover:bg-muted disabled:pointer-events-none disabled:opacity-50"
@@ -235,7 +252,9 @@ function ActionMenu({
<DropdownMenuItem
key={status}
disabled={action.status === status}
- onClick={() => onStatusChange(action, status)}
+ onClick={() =>
+ status === 'dismissed' ? setDismissing(true) : onStatusChange(action, status)
+ }
>
<Icon className="h-4 w-4" />
{t(`rowMenu.${status}`)}
@@ -282,7 +301,11 @@ export function ActionTable({
actions: ActionItem[];
onSelect: (action: ActionItem) => void;
/** With these, each row gets its menu (status changes and Delete). */
- onStatusChange?: (action: ActionItem, status: ActionStatus) => void;
+ onStatusChange?: (
+ action: ActionItem,
+ status: ActionStatus,
+ reason?: ActionDismissReason | null,
+ ) => void;
onDelete?: (action: ActionItem) => void;
canDelete?: boolean;
/** Actions with a change in flight: their menu waits. */
diff --git a/web/src/components/action-center/dismiss-reason-dialog.tsx b/web/src/components/action-center/dismiss-reason-dialog.tsx
new file mode 100644
index 000000000..810bb4f06
--- /dev/null
+++ b/web/src/components/action-center/dismiss-reason-dialog.tsx
@@ -0,0 +1,62 @@
+'use client';
+
+import { useTranslations } from 'next-intl';
+import { Button } from '@/components/ui/button';
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from '@/components/ui/dialog';
+import { ACTION_DISMISS_REASONS, type ActionDismissReason } from '@/lib/action-center/registry';
+
+/**
+ * Why an action is being dismissed (learning A5), as a content opportunity
+ * asks (CONTENT-006): a reason, or none. Choosing dismisses it; closing the
+ * dialog doesn't.
+ */
+export function DismissReasonDialog({
+ open,
+ onOpenChange,
+ onChoose,
+}: {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ onChoose: (reason: ActionDismissReason | null) => void;
+}) {
+ const t = useTranslations('actionCenter.dismissReason');
+ const choose = (reason: ActionDismissReason | null) => {
+ onOpenChange(false);
+ onChoose(reason);
+ };
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent className="sm:max-w-md">
+ <DialogHeader>
+ <DialogTitle>{t('title')}</DialogTitle>
+ <DialogDescription>{t('description')}</DialogDescription>
+ </DialogHeader>
+ <div className="grid gap-2">
+ {ACTION_DISMISS_REASONS.map((reason) => (
+ <button
+ key={reason}
+ type="button"
+ onClick={() => choose(reason)}
+ className="rounded-md border px-3 py-2.5 text-left transition-colors hover:bg-muted/50"
+ >
+ <p className="text-sm font-medium">{t(`${reason}.label`)}</p>
+ <p className="text-xs text-muted-foreground">{t(`${reason}.hint`)}</p>
+ </button>
+ ))}
+ </div>
+ <DialogFooter>
+ <Button variant="ghost" size="sm" onClick={() => choose(null)}>
+ {t('skip')}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+}
diff --git a/web/src/components/action-center/history-drawer.test.tsx b/web/src/components/action-center/history-drawer.test.tsx
index 80d830ba8..d6cdb3cd9 100644
--- a/web/src/components/action-center/history-drawer.test.tsx
+++ b/web/src/components/action-center/history-drawer.test.tsx
@@ -252,6 +252,19 @@ describe('HistoryDrawer', () => {
);
});
+ it('says why a dismissed action was dismissed (learning A5)', async () => {
+ getActionSignals.mockResolvedValue([]);
+ render(
+ <HistoryDrawer
+ brandId="b1"
+ item={{ ...item, status: 'dismissed', dismissReason: 'wrong_data' }}
+ onOpenChange={() => {}}
+ />,
+ );
+ await act(async () => {});
+ expect(under('Result')).toContain('Dismissed: The data behind it is wrong.');
+ });
+
it('says a dismissed action was not measured, not that nothing could be read', async () => {
getActionSignals.mockResolvedValue([]);
for (const outcome of ['not_measurable', 'pending_measurement'] as const) {
diff --git a/web/src/components/action-center/history-drawer.tsx b/web/src/components/action-center/history-drawer.tsx
index 9ead85245..72e464c67 100644
--- a/web/src/components/action-center/history-drawer.tsx
+++ b/web/src/components/action-center/history-drawer.tsx
@@ -91,6 +91,7 @@ export function HistoryDrawer({
const tTaskStatus = useTranslations('actionCenter.taskStatus');
const tSources = useTranslations('actionCenter.signalsPage.sources');
const tRegistry = useTranslations('actionCenter.registry');
+ const tDismiss = useTranslations('actionCenter.dismissReason');
const tAffected = useTranslations('actionCenter.historyPage.affected');
const router = useRouter();
@@ -208,6 +209,13 @@ export function HistoryDrawer({
<section>
<p className="text-xs font-medium text-muted-foreground">{t('drawer.result')}</p>
+ {item.status === 'dismissed' && item.dismissReason && (
+ <p className="mt-1 text-xs">
+ {t('drawer.dismissedBecause', {
+ reason: tDismiss(`${item.dismissReason}.label`),
+ })}
+ </p>
+ )}
{item.primaryMetric && (
<p className="mt-1 text-xs text-muted-foreground">
{t('drawer.primary', { metric: tRegistry(`${item.primaryMetric}.name`) })}
diff --git a/web/src/lib/action-center/history.ts b/web/src/lib/action-center/history.ts
index d6178c647..d5d9cd312 100644
--- a/web/src/lib/action-center/history.ts
+++ b/web/src/lib/action-center/history.ts
@@ -23,7 +23,13 @@
* populating these, not reshaping them.
*/
-import type { ActionCategory, ActionOutcome, ActionStatus, TaskStatus } from './registry';
+import type {
+ ActionCategory,
+ ActionDismissReason,
+ ActionOutcome,
+ ActionStatus,
+ TaskStatus,
+} from './registry';
import { highestPriorityLevel, type PriorityLevel } from './priority';
import type { SignalSource } from '@/lib/signals/registry';
import type { ImproveOutcome } from '@/lib/improve-outcome';
@@ -115,6 +121,8 @@ export interface ActionHistoryItem {
affected: AffectedEntity[];
/** Empty until something measures an action's effect. */
results: ActionResultMetric[];
+ /** Why it was dismissed, when someone said (learning A5). */
+ dismissReason?: ActionDismissReason | null;
/** Its signals when it was measured; absent before, or with no signal behind it. */
signalsAfter?: SignalOutcome | null;
/**
diff --git a/web/src/lib/action-center/registry.ts b/web/src/lib/action-center/registry.ts
index 290b00b35..a9c0c4233 100644
--- a/web/src/lib/action-center/registry.ts
+++ b/web/src/lib/action-center/registry.ts
@@ -157,6 +157,19 @@ export const ACTION_OUTCOMES: readonly ActionOutcome[] = [
'not_measurable',
];
+/**
+ * Why an action was dismissed, as the person says it (00366, learning A5):
+ * it doesn't matter to the brand, the work is already done, the data behind
+ * it is wrong, or not now.
+ */
+export const ACTION_DISMISS_REASONS = [
+ 'not_relevant',
+ 'already_done',
+ 'wrong_data',
+ 'not_now',
+] as const;
+export type ActionDismissReason = (typeof ACTION_DISMISS_REASONS)[number];
+
/** An action whose cycle is over: it is history, and its kind's slot is free. */
export const CLOSED_ACTION_STATUSES: readonly ActionStatus[] = ['completed', 'dismissed'];
diff --git a/web/src/lib/actions/action-center-status.test.ts b/web/src/lib/actions/action-center-status.test.ts
new file mode 100644
index 000000000..289579cba
--- /dev/null
+++ b/web/src/lib/actions/action-center-status.test.ts
@@ -0,0 +1,56 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+/** An action's status, and why it was dismissed (learning A5). */
+
+const writes: { table: string; op: string; payload: unknown }[] = [];
+vi.mock('@/lib/supabase/server', () => ({
+ createClient: vi.fn(async () => ({
+ auth: { getUser: async () => ({ data: { user: { id: 'u1' } } }) },
+ from: (table: string) => {
+ const chain: Record<string, unknown> = {};
+ const record = (op: string) => (payload: unknown) => {
+ writes.push({ table, op, payload });
+ return chain;
+ };
+ Object.assign(chain, {
+ update: record('update'),
+ insert: record('insert'),
+ eq: () => chain,
+ then: (resolve: (v: unknown) => void) => resolve({ data: null, error: null }),
+ });
+ return chain;
+ },
+ })),
+}));
+
+vi.mock('@/lib/supabase/admin', () => ({ supabaseAdmin: {} }));
+
+const { updateActionStatus } = await import('./action-center');
+
+const update = () => writes.find((w) => w.table === 'actions' && w.op === 'update')!.payload;
+const event = () => writes.find((w) => w.table === 'action_events')!.payload;
+
+beforeEach(() => {
+ writes.length = 0;
+});
+
+describe('updateActionStatus', () => {
+ it('keeps why an action was dismissed, and says it on its History line', async () => {
+ await updateActionStatus('b1', 'a1', 'dismissed', 'not_now');
+ expect(update()).toMatchObject({ status: 'dismissed', dismiss_reason: 'not_now' });
+ expect(event()).toMatchObject({
+ event: 'status_changed',
+ data: { to: 'dismissed', reason: 'not_now' },
+ });
+ });
+
+ it('clears the reason on any other status, and keeps none it doesn’t know', async () => {
+ await updateActionStatus('b1', 'a1', 'in_progress', 'not_now');
+ expect(update()).toMatchObject({ status: 'in_progress', dismiss_reason: null });
+ expect(event()).toMatchObject({ data: { to: 'in_progress' } });
+
+ writes.length = 0;
+ await updateActionStatus('b1', 'a1', 'dismissed', 'bored' as never);
+ expect(update()).toMatchObject({ dismiss_reason: null });
+ });
+});
diff --git a/web/src/lib/actions/action-center.ts b/web/src/lib/actions/action-center.ts
index ab9f90755..e023c0db7 100644
--- a/web/src/lib/actions/action-center.ts
+++ b/web/src/lib/actions/action-center.ts
@@ -13,7 +13,9 @@
import { createClient } from '@/lib/supabase/server';
import { API_BASE_URL } from '@/config/api';
import {
+ ACTION_DISMISS_REASONS,
type ActionCategory,
+ type ActionDismissReason,
type ActionImpact,
taskProgress,
type ActionStatus,
@@ -317,23 +319,34 @@ async function touchAction(
.eq('id', actionId);
}
+/**
+ * Sets an action's status. A dismissal keeps why, when the person said
+ * (learning A5); any other status clears it, as a dismissal it no longer is.
+ */
export async function updateActionStatus(
brandId: string,
actionId: string,
status: ActionStatus,
+ reason: ActionDismissReason | null = null,
): Promise<void> {
const supabase = await createClient();
+ const dismissReason =
+ status === 'dismissed' && reason && ACTION_DISMISS_REASONS.includes(reason) ? reason : null;
const { error } = await supabase
.from('actions')
.update({
status,
completed_at: status === 'completed' ? new Date().toISOString() : null,
+ dismiss_reason: dismissReason,
updated_at: new Date().toISOString(),
})
.eq('brand_id', brandId)
.eq('id', actionId);
if (error) throw new Error(error.message);
- await logEvent(supabase, actionId, 'status_changed', { to: status });
+ await logEvent(supabase, actionId, 'status_changed', {
+ to: status,
+ ...(dismissReason ? { reason: dismissReason } : {}),
+ });
}
/**
diff --git a/web/src/lib/actions/action-history.ts b/web/src/lib/actions/action-history.ts
index 54c888d2f..1d07e112b 100644
--- a/web/src/lib/actions/action-history.ts
+++ b/web/src/lib/actions/action-history.ts
@@ -16,7 +16,13 @@
import { createClient } from '@/lib/supabase/server';
import type { ActionCategory } from '@/lib/action-center/registry';
-import type { ActionOutcome, ActionStatus, TaskStatus } from '@/lib/action-center/registry';
+import {
+ ACTION_DISMISS_REASONS,
+ type ActionDismissReason,
+ type ActionOutcome,
+ type ActionStatus,
+ type TaskStatus,
+} from '@/lib/action-center/registry';
import { SIGNAL_SOURCES, type SignalSource } from '@/lib/signals/registry';
import { parseImproveOutcome } from '@/lib/improve-outcome';
import { storedPriorityLevel } from '@/lib/action-center/priority';
@@ -50,10 +56,11 @@ interface HistoryRow {
updated_at: string;
priority_score: number | null;
priority_level: string | null;
+ dismiss_reason: string | null;
}
const HISTORY_COLUMNS =
- 'id, action_no, category, kind, status, outcome, validation, position_outcome, payload, kpi_keys, assignee_id, due_date, created_at, completed_at, updated_at, priority_score, priority_level';
+ 'id, action_no, category, kind, status, outcome, validation, position_outcome, payload, kpi_keys, assignee_id, due_date, created_at, completed_at, updated_at, priority_score, priority_level, dismiss_reason';
/** What the validation sweep stores on an action. */
interface ValidationSnapshot {
@@ -322,6 +329,11 @@ export async function getActionHistory(
triggerSignals,
affected: affectedFrom(row.kind, row.payload ?? {}, triggerSignals.length),
results,
+ dismissReason: (ACTION_DISMISS_REASONS as readonly string[]).includes(
+ row.dismiss_reason ?? '',
+ )
+ ? (row.dismiss_reason as ActionDismissReason)
+ : null,
signalsAfter: signalsFrom(row.validation),
measuredOn: measuredOnFrom(row.validation),
auditAfter: auditFrom(row.validation),
diff --git a/web/src/types/supabase.ts b/web/src/types/supabase.ts
index a6b3e5422..9f1cfb69f 100644
--- a/web/src/types/supabase.ts
+++ b/web/src/types/supabase.ts
@@ -243,6 +243,7 @@ export type Database = {
completed_at: string | null
created_at: string
dedup_key: string
+ dismiss_reason: string | null
due_date: string | null
id: string
impact: string
@@ -271,6 +272,7 @@ export type Database = {
completed_at?: string | null
created_at?: string
dedup_key: string
+ dismiss_reason?: string | null
due_date?: string | null
id?: string
impact: string
@@ -299,6 +301,7 @@ export type Database = {
completed_at?: string | null
created_at?: string
dedup_key?: string
+ dismiss_reason?: string | null
due_date?: string | null
id?: string
impact?: string