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.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
fix(action-center): leave a call to action task to the person, on its page (#1684)
Cihanefe71edb7fb6
diff --git a/server/src/lib/action-center/task-checks.js b/server/src/lib/action-center/task-checks.jsindex 5b05f9389..20922b821 100644--- a/server/src/lib/action-center/task-checks.js+++ b/server/src/lib/action-center/task-checks.js@@ -11,9 +11,10 @@* - robots.txt lets the AI crawlers in, and the page isn't noindex* (fix_crawler_access raised by the audit's ai-bot-access);* - it changed since the first look, by more than a date, a price or a- * rotating quote moving (optimize, refresh, strengthen, the call to- * action): the first look keeps a sketch of the page's words, and- * enough of them must have changed;+ * rotating quote moving (optimize, refresh, strengthen): the first look+ * keeps a sketch of the page's words, and enough of them must have+ * changed. A call to action is confirmed by hand: a re-fetch can't tell+ * (tasks/templates.js);* - a written task's new text is on it, and the text it replaces gone;* - a shopping links task's page links no product that no longer sells,* read as the catalog sync's shopping check reads it (shopping-check.js;@@ -53,7 +54,6 @@ export const CHECKS = Object.freeze({refresh_content: 'changed',strengthen_reference_asset: 'changed',strengthen_entity_content: 'changed',- improve_cta_path: 'changed',});/** The most open tasks one nightly sweep checks: pages are fetched one at a time. */diff --git a/server/src/lib/action-center/tasks/templates.js b/server/src/lib/action-center/tasks/templates.jsindex 9e0da4cfc..16c4479a6 100644--- a/server/src/lib/action-center/tasks/templates.js+++ b/server/src/lib/action-center/tasks/templates.js@@ -26,7 +26,6 @@ const TEMPLATES = Object.freeze({strengthen_entity_content: { check: 'auto', page: true },// Its links go on other pages: the action's page is the one they point to.add_internal_links: { check: 'auto', page: false },- improve_cta_path: { check: 'auto', page: true },publish_content: { check: 'auto', page: true },fix_crawler_access: { check: 'auto', page: true },fix_structured_data: { check: 'auto', page: true },@@ -43,6 +42,10 @@ const TEMPLATES = Object.freeze({validate_competitive_gap: { check: 'rerun' },validate_third_party_citation: { check: 'rerun' },measure_action_outcome: { check: 'rerun' },+ // A call to action rewritten: the person confirms it. A re-fetch can't+ // tell (#1565): a CTA band is often outside the page's content area, and+ // its words too few to read as the page changing.+ improve_cta_path: { check: 'manual', page: true },// Work outside the page: the person confirms it.create_content_brief: { check: 'manual' },create_content_draft: { check: 'manual' },diff --git a/server/src/lib/action-center/tasks/templates.test.js b/server/src/lib/action-center/tasks/templates.test.jsindex 2a27ef83b..52558a0c5 100644--- a/server/src/lib/action-center/tasks/templates.test.js+++ b/server/src/lib/action-center/tasks/templates.test.js@@ -1,8 +1,13 @@import { readFileSync } from 'node:fs';-import { describe, expect, it } from 'vitest';+import { describe, expect, it, vi } from 'vitest';import { TASKS } from './registry.js';import { TEMPLATED_TASKS, onePage, templateDetails } from './templates.js';import { TASK_CHECKS } from '../task-writer/quality.js';+import { CHECKS } from '../task-checks.js';++// task-checks.js reaches the supabase admin client at import time, whose+// config hard-exits when SUPABASE_* env is absent (as in CI).+vi.mock('../../../config/supabase.js', () => ({ default: {} }));/** How a library task is checked, and the page it is done on (AC-010). */@@ -58,6 +63,16 @@ describe('templateDetails', () => {expect(templateDetails('add_internal_links', one)).not.toHaveProperty('url');expect(templateDetails('prepare_outreach', one).check).toBe('manual');});++ it('leaves a call to action to the person, on its page: a re-fetch can’t tell it (#1565)', () => {+ const one = { targetEntity: 'pages', targetCount: 1, targets: [{ id: '/pricing' }] };+ expect(templateDetails('improve_cta_path', one)).toEqual({+ check: 'manual',+ url: '/pricing',+ source: 'template',+ });+ expect(CHECKS).not.toHaveProperty('improve_cta_path');+ });});describe('onePage', () => {diff --git a/web/messages/en.json b/web/messages/en.jsonindex 2cc67848b..d5bdde846 100644--- a/web/messages/en.json+++ b/web/messages/en.json@@ -2462,7 +2462,7 @@"strengthen_reference_asset": "The page is live with the facts, sources or tables added, and fetched again it has them","strengthen_entity_content": "The page describes the brand as its profile does, fetched again","add_internal_links": "The pages that should link to it do, fetched again",- "improve_cta_path": "The call to action is live on the page, fetched again",+ "improve_cta_path": "The call to action is live on the page: you confirm it","publish_content": "The page is published at its address and answers when fetched","fix_crawler_access": "robots.txt and the page let the AI crawlers in, fetched again","fix_structured_data": "The page has valid structured data (JSON-LD), fetched again",diff --git a/web/src/components/action-center/action-drawer.test.tsx b/web/src/components/action-center/action-drawer.test.tsxindex a9689366e..27bed143e 100644--- a/web/src/components/action-center/action-drawer.test.tsx+++ b/web/src/components/action-center/action-drawer.test.tsx@@ -5,6 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import type { ActionItem } from '@/lib/actions/action-center';import type { Signal } from '@/lib/signals/map';import { promptVolumeEstimate } from '@/lib/volume-estimate';+import { parseTaskDetails } from '@/lib/action-center/task-details';import messages from '../../../messages/en.json';/**@@ -278,6 +279,51 @@ describe('ActionDrawer', () => {});});+ describe('How we check (AC-010)', () => {+ const lastCheck = { at: '2026-10-20T00:00:00Z', passed: false, missing: ['not_changed'] };+ const task = (taskKey: string, title: string) => ({+ id: 't1',+ position: 1,+ status: 'todo',+ taskKey,+ title,+ titleParams: {},+ dependsOn: [],+ details: parseTaskDetails({+ url: 'https://acme.example/pricing',+ check: 'auto',+ autoCheck: lastCheck,+ }),+ });+ const open = async (taskKey: string, title: string) => {+ server.getActionDetail.mockResolvedValue({ ...emptyDetail, tasks: [task(taskKey, title)] });+ await renderDrawer();+ const button = (name: string) =>+ [...document.querySelectorAll<HTMLButtonElement>('button')].find(+ (b) => b.textContent?.trim() === name || b.textContent?.startsWith(`${name} (`),+ )!;+ await act(async () => button('Tasks').click());+ await act(async () => button(`1. ${title}`).click());+ return document.body.querySelector('[role="dialog"]')!.textContent ?? '';+ };++ it('shows a call-to-action task planned as Automatic as Manual, with no automatic check', async () => {+ const text = await open('improve_cta_path', 'Tighten the call to action');+ expect(text).toContain('Manual: you confirm it');+ expect(text).toContain('The call to action is live on the page: you confirm it');+ expect(text).not.toContain('Automatic: we fetch the page again');+ expect(text).not.toContain('Last check');+ expect(text).not.toContain('Check now');+ });++ it('still shows a page-checked task’s automatic check, its last one and Check now', async () => {+ const text = await open('refresh_content', 'Refresh the page');+ expect(text).toContain('Automatic: we fetch the page again');+ expect(text).toContain('Last check');+ expect(text).toContain('Check now');+ });+ });+describe('writing tasks (CE-022)', () => {const PRICING = 'https://acme.example/pricing';const FEATURES = 'https://acme.example/features';diff --git a/web/src/components/action-center/action-drawer.tsx b/web/src/components/action-center/action-drawer.tsxindex 65b7262cb..cb87c0ded 100644--- a/web/src/components/action-center/action-drawer.tsx+++ b/web/src/components/action-center/action-drawer.tsx@@ -93,6 +93,7 @@ import { RegenerateTasks, taskWriterEnabled } from './regenerate-tasks';import {hasTaskSpec,pageCheckable,+ withTemplateCheck,withTemplateDoneWhen,withoutTemplateDoneWhen,type TaskDetailsEdit,@@ -885,10 +886,14 @@ function TaskRow({() => !!task.details && !hasTaskSpec(task.details) && !!task.details.body,);const [editing, setEditing] = useState(false);- // A library task's Done when is its template's until someone writes one (AC-010).+ // A library task's Done when is its template's until someone writes one,+ // and its How we check Manual when its template is now (AC-010).const tDoneWhen = useTranslations('actionCenter.taskDoneWhen');- const details = withTemplateDoneWhen(task.details, task.taskKey, (key) =>- tDoneWhen.has(key) ? tDoneWhen(key) : null,+ const details = withTemplateCheck(+ withTemplateDoneWhen(task.details, task.taskKey, (key) =>+ tDoneWhen.has(key) ? tDoneWhen(key) : null,+ ),+ task.taskKey,);// Choosing Skipped opens a reason field rather than committing: a skip// without a reason cannot be told apart from an abandoned task later.diff --git a/web/src/lib/action-center/export.test.ts b/web/src/lib/action-center/export.test.tsindex efc8c6f18..54072a1a2 100644--- a/web/src/lib/action-center/export.test.ts+++ b/web/src/lib/action-center/export.test.ts@@ -412,6 +412,28 @@ describe('a library task’s Done when (AC-010)', () => {);expect(library(parseTaskDetails({ doneWhen: 'Our own check' }))).toBe('Our own check');});++ it('gives a task planned while its template was Automatic its Manual check', () => {+ const checkOf = (taskKey: string) =>+ buildActionExport(+ action,+ {+ ...detail,+ tasks: [+ {+ ...detail.tasks[1],+ taskKey,+ title: null,+ details: parseTaskDetails({ check: 'auto' }),+ },+ ],+ },+ texts,+ { origin: 'https://app.example', timeZone: 'Europe/Istanbul' },+ ).tasks[0].check;+ expect(checkOf('improve_cta_path')).toBe('check.manual');+ expect(checkOf('refresh_content')).toBe('check.auto');+ });});describe('a task with AC-004 fields', () => {diff --git a/web/src/lib/action-center/export.ts b/web/src/lib/action-center/export.tsindex 144b99142..a08120c03 100644--- a/web/src/lib/action-center/export.ts+++ b/web/src/lib/action-center/export.ts@@ -1,6 +1,7 @@import type { ActionDetail, ActionItem } from '@/lib/actions/action-center';import { toCsv } from '@/lib/csv';import { assigneeLabel } from '@/lib/action-center/display';+import { withTemplateCheck } from '@/lib/action-center/task-details';import { locationName, platformName } from '@/lib/signals/names';import { dayIn } from '@/lib/time-zone';import type { Sheet } from 'write-excel-file/browser';@@ -204,7 +205,8 @@ export function buildActionExport(link: `${origin}/dashboard/action-center/actions?action=${action.id}`,affected: texts.affected,tasks: detail.tasks.map((task, i) => {- const d = task.details;+ // How we check as the task's template has it now (AC-010).+ const d = withTemplateCheck(task.details, task.taskKey);const details: (string | null)[] = d? [d.body,diff --git a/web/src/lib/action-center/task-details.test.ts b/web/src/lib/action-center/task-details.test.tsindex 20dcebd83..ebb66f4fe 100644--- a/web/src/lib/action-center/task-details.test.ts+++ b/web/src/lib/action-center/task-details.test.ts@@ -2,6 +2,7 @@ import { readFileSync } from 'node:fs';import { join } from 'node:path';import { describe, expect, it } from 'vitest';import {+ MANUAL_TASKS,PAGE_CHECKED_TASKS,pageCheckable,type ActionTaskDetails,@@ -9,6 +10,7 @@ import {cleanTaskDetailsEdit,isTaskDetailsEdit,parseTaskDetails,+ withTemplateCheck,withTemplateDoneWhen,withoutTemplateDoneWhen,} from './task-details';@@ -342,3 +344,37 @@ describe('pageCheckable', () => {expect([...PAGE_CHECKED_TASKS].sort()).toEqual(keys.sort());});});++describe('withTemplateCheck', () => {+ const auto = parseTaskDetails({+ url: '/pricing',+ check: 'auto',+ autoCheck: { at: '2026-10-20T00:00:00Z', passed: false, missing: ['not_changed'] },+ });++ it('reads a task planned while its template was Automatic as Manual', () => {+ expect(withTemplateCheck(auto, 'improve_cta_path')).toMatchObject({+ check: 'manual',+ url: '/pricing',+ lastCheck: null,+ });+ });++ it("keeps a page-checked task's, a Site Audit fix's and a written task's check", () => {+ expect(withTemplateCheck(auto, 'refresh_content')).toBe(auto);+ expect(withTemplateCheck(auto, 'fix_technical_issue')).toBe(auto);+ expect(withTemplateCheck(auto, null)).toBe(auto);+ expect(withTemplateCheck(null, 'improve_cta_path')).toBeNull();+ });++ it("lists the templates' Manual tasks, no more and no fewer", () => {+ const server = readFileSync(+ join(__dirname, '../../../../server/src/lib/action-center/tasks/templates.js'),+ 'utf8',+ );+ const block = server.match(/const TEMPLATES = Object\.freeze\(\{([\s\S]*?)\n\}\);/)![1];+ const keys = [...block.matchAll(/^\s*([a-z_]+): \{ check: 'manual'/gm)].map((m) => m[1]);+ expect(keys).toContain('improve_cta_path');+ expect([...MANUAL_TASKS].sort()).toEqual(keys.sort());+ });+});diff --git a/web/src/lib/action-center/task-details.ts b/web/src/lib/action-center/task-details.tsindex 97f964f7b..2185e0a4b 100644--- a/web/src/lib/action-center/task-details.ts+++ b/web/src/lib/action-center/task-details.ts@@ -294,7 +294,6 @@ export const PAGE_CHECKED_TASKS: readonly string[] = ['refresh_content','strengthen_reference_asset','strengthen_entity_content',- 'improve_cta_path',];/**@@ -317,3 +316,35 @@ export function pageCheckable(if (task.taskKey) return PAGE_CHECKED_TASKS.includes(task.taskKey);return actionKind === 'shopping_links' || Boolean(d.change?.after);}++/**+ * The library tasks a person confirms (AC-010): their template's check is+ * Manual (server/src/lib/action-center/tasks/templates.js). Change both+ * together.+ */+export const MANUAL_TASKS: readonly string[] = [+ 'improve_cta_path',+ 'create_content_brief',+ 'create_content_draft',+ 'prepare_outreach',+ 'execute_outreach',+ 'prepare_contribution',+ 'track_third_party_status',+ 'validate_third_party_presence',+];++/**+ * A library task's details with How we check as its template has it now: a+ * task planned while its template was Automatic (improve_cta_path, made+ * Manual 2026-10-28) keeps check 'auto', which no check reads any more, and+ * reads as Manual, as its Done when says, with no Last check: what a+ * re-fetch found isn't how it's done now. Check now goes too+ * (pageCheckable).+ */+export function withTemplateCheck(+ details: ActionTaskDetails | null,+ taskKey: string | null,+): ActionTaskDetails | null {+ if (details?.check !== 'auto' || !taskKey || !MANUAL_TASKS.includes(taskKey)) return details;+ return { ...details, check: 'manual', lastCheck: null };+}diff --git a/web/src/lib/mcp/action-priority.test.ts b/web/src/lib/mcp/action-priority.test.tsindex 8cfbeadd7..b12f8e6f0 100644--- a/web/src/lib/mcp/action-priority.test.ts+++ b/web/src/lib/mcp/action-priority.test.ts@@ -199,6 +199,25 @@ describe('getActionFor', () => {}});+ it('gives a task planned while its template was Automatic its Manual check (AC-010)', async () => {+ taskRows = [+ {+ id: 't4',+ position: 1,+ task_key: 'improve_cta_path',+ title: null,+ status: 'todo',+ details: { check: 'auto', source: 'template' },+ },+ ];+ try {+ const action = await getActionFor(auth, 'a1');+ expect(action?.tasks[0].details).toMatchObject({ check: 'manual' });+ } finally {+ taskRows = [];+ }+ });+it('gives the action its priority', async () => {const action = await getActionFor(auth, 'a1');expect(action?.priority).toEqual({diff --git a/web/src/lib/mcp/data.ts b/web/src/lib/mcp/data.tsindex 55873f3a9..54502306e 100644--- a/web/src/lib/mcp/data.ts+++ b/web/src/lib/mcp/data.ts@@ -31,7 +31,11 @@ import {withEntityCounts,withoutTargetIds,} from '@/lib/action-center/entity-counts';-import { parseTaskDetails, withTemplateDoneWhen } from '@/lib/action-center/task-details';+import {+ parseTaskDetails,+ withTemplateCheck,+ withTemplateDoneWhen,+} from '@/lib/action-center/task-details';import { locationCode, isValidLocation } from '@/lib/region';import { promptVolumeEstimate, type EstimateConfidence } from '@/lib/volume-estimate';import { getOrgLocationUsage, locationLimitMessage } from '@/lib/prompt-locations';@@ -3001,7 +3005,10 @@ const templateDoneWhen = (taskKey: string) =>/** A task's details in the snake_case the rest of the MCP output uses. */function mcpTaskDetails(raw: unknown, taskKey: string | null = null) {- const d = withTemplateDoneWhen(parseTaskDetails(raw), taskKey, templateDoneWhen);+ const d = withTemplateCheck(+ withTemplateDoneWhen(parseTaskDetails(raw), taskKey, templateDoneWhen),+ taskKey,+ );if (!d) return null;return {// The exact page, the change to make there and how we check it (AC-010).