Skip to content

feat(action-center): give tasks the exact page, the change to make and how we check it (AC-010, part 1) - #1561

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/ac-010-task-fields
Oct 27, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/ac-010-task-fields

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

AC-010 ("Done when" on every task), part 1 of 4: the fields.

AC-010 asks every Action Center task to carry four fields:

  • Exact URL: the page the change is made on.
  • Suggested change: before and after.
  • Done when: a measurable check. AC-004 already has it.
  • How we check: Automatic (page re-fetch / Site Audit), Re-run (prompts run again) or Manual (the person confirms).

This PR adds the three new ones, lets people edit them, and has the AI task writer fill all four.

Plan for the rest:

  • (a2) a review queue for AI- and agent-written tasks missing a field (migration);
  • (a3) the nightly engine's library tasks get How we check and Done when from their template, and the URL when the action has one page;
  • (b) automatic checks that close a task and say what's missing.

Where the fields live. They go in action_tasks.details (jsonb, 00121) beside AC-004's, so there's no migration.

  • url: a full URL or a path.
  • change: { before, after }. before is null when the change adds text.
  • check: auto, rerun or manual.
  • parseTaskDetails reads each one defensively. A change without after text, or an unknown check, reads as none.

The task card (task-detail.tsx).

  • It shows URL (a link when it's a full URL), Change ("Before: … / After: …", or "Add: …") and How we check.
  • Edit has a URL field, Before and After boxes, and a How we check select. Saving keeps what the task already carries, as before.

The AI task writer (task-writer/, behind ACTION_TASKS_AI).

  • The schema and the prompt ask for url, change and check.
  • The quality rule refuses a task with no URL, a URL that isn't a page address, a change with no after text, or an unknown check. A refused task is asked for once more, as today; review queuing comes in a2.
  • A page address is a full URL, a path, or a host and path as the evidence shows pages (acme.example/blog/x). The last is stored with https://, and check is stored lowercase.
  • The URL also counts as naming the task's target, beside the title and Where.

Where the fields travel.

  • Exports: Copy Data lines, CSV columns url, change and check, and workbook columns.
  • MCP: get_action task details.
  • Send to webhook (action_task.sent).
  • Send to Content: the opportunity still works on the page Where names. When Where names none, it works on the URL if the change replaces text there (the page exists). A URL whose change only adds may be a page still to write, so that becomes a new page, as before. The Content opportunity's "From a task" card and its Markdown show URL and Change.
  • MCP get_action's description names the new fields. The coach skill's field list follows in a separate docs PR once this merges.
  • Docs: the Action Center guide's field list, and the webhook example.

Related issue

AC-010 (roadmap), part 1 of 4. Extends AC-004.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Action Center › Actions: open an action, open a task, click Edit. Fill URL (/pricing), Before/After and How we check, then save. The card shows URL, Change and How we check. A full https:// URL is a link.
  2. Export the action (Copy Data, CSV, Excel). The task has URL, Change and How we check.
  3. cd server && npx vitest run src/lib/action-center/task-writer src/lib/action-center/task-send.test.js
  4. cd web && yarn vitest run src/lib/action-center src/components/action-center src/lib/mcp/action-priority.test.ts

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Also run: server npm run format, npm run lint, npm test (225 files, 2,895 tests); web yarn test (427 files, 4,086 tests) and yarn build, all pass.

Checked in the browser (light and dark, 1440 and 1024 px) on a dev task. I edited it, saw URL, Change and How we check on the card (a long URL wraps), then restored the task's details.

🤖 Generated with Claude Code

…d how we check it, and have the task writer fill them (AC-010)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Oct 26, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 83f7588.

Approve preview

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with follow-ups.
I'll merge it together with #1562 once 00293 is fixed, so the writer's new checks and the review queue reach the API in the same deploy: with this alone, a written task missing a field is dropped rather than held.

What I checked:

  • Where the fields live. url, change and check go in action_tasks.details (jsonb), beside AC-004's fields. On main that column has no check constraint and action_tasks has no trigger, so the database neither refuses nor rewrites them. There's no migration, and schema.sql is untouched.
  • Editing.
    • The drawer saves through updateTaskDetails. That's the same server action, under the same member policy, as the other task fields.
    • isTaskDetailsEdit checks the new fields' types, and checks check against the three values.
    • cleanTaskDetailsEdit trims and clips each field to the inputs' maxLength: 500 for the URL, 1,000 each for Before and After.
    • The cleaned fields are merged into the stored details. An Improve task's body and evidence, source, refs and sent all stay.
    • The How we check <Select> has its items.
  • Rendering.
    • The URL is a link only when it starts with http:// or https://, and the link has target="_blank" and rel="noopener noreferrer". A path, or anything else, shows as text.
    • Before and After render as plain JSX text, with no dangerouslySetInnerHTML. whitespace-pre-line keeps their line breaks.
    • The Content opportunity's "From a task" card shows the URL as text.
  • The task writer.
    • The schema asks for url (500), change.before and change.after (1,000 each) and check (10), all as strings.
    • The quality rule refuses a missing URL, a URL that isn't a page address, an empty After and an unknown check. A refused task is asked for once more, as today.
    • replaceTasks stores a host and path with https://, an empty Before as null and the check in lower case.
    • The answer is longer now. No output cap is set, and both calls are charged at their real usage on the same budget hold, so the extra tokens are metered as before.
  • Webhook and exports.
    • action_task.sent gains url, change and check, each null when the task has none. No key is renamed or removed. The docs match the code: change.before is null when the change adds text.
    • The CSV gets url, change and check columns between existing ones. Readers that go by header name are unaffected. Readers that go by position see the columns shift, as they did with AC-004's columns. toCsv still escapes cells that start with a formula character.
    • The workbook's 13 widths match its 13 columns.
    • The MCP export builds its translators from EXPORT_NAMESPACES, so it gets taskChecks too. get_action gains the three keys, and its description names them.
  • Speed. PAGE_ADDRESS and pageAddress are anchored and have no overlapping repeats. On 100 KB adversarial inputs, each test takes under 1 ms. The schema also holds the model's URL to 500 characters before either one runs.
  • Tests. These fail without the change:
    • the quality cases (URL, change, check, and the URL naming the target);
    • pageAddress;
    • the task-send cases (the URL's page when Where names none, and the webhook's null keys);
    • the writer's stored details;
    • parseTaskDetails and cleanTaskDetailsEdit;
    • the drawer's view and form;
    • the exports and MCP get_action.
  • Merge.
    • The branch is one commit on c00e0f0. Since then main has gained only #1544, which touches other files.
    • git merge-tree with main (3b650fb) is clean, and CI passes. CI's web job doesn't run vitest; the PR body says the web suite passes locally.
  • Before the API deploy.
    • The drawer shows and edits URL, Change and How we check right away. The exports and MCP carry them too, since all of that runs in the web app.
    • Tasks the writer adds have none of the three fields until the API is deployed. The card shows nothing extra for them.
    • URL and Change filled in by hand don't travel yet:
      • Send to webhook posts today's payload, though the docs already list the new keys.
      • Send to Content ignores the URL, and its card shows no URL or Change.
    • "Automatic: we fetch the page again" is only a label until #1565's checks run on the API.
    • Nothing that works today breaks.
    • Deploy the writer together with #1562. With this PR alone, a written task that misses one of the new fields is refused, and dropped after the second ask. #1562 holds such tasks for review instead.

Follow-ups:

  1. The writer's Before (server/src/lib/action-center/task-writer/prompt.js:45, server/src/lib/action-center/task-send.js:107-109).
    • The evidence carries no page text. Each page comes with its URL, prompts, positions, visits and audit issue labels only. So "quoted from the evidence" can't be met: any non-empty before is the model's own wording, and the card shows it as the page's text.
    • before now also decides Send to Content's page. A written task whose Where names no page and whose before is filled becomes "optimize" on its URL, and that URL may be a page still to write.
    • Until the evidence carries the page's text, ask for the new text only and store no Before:
      // prompt.js
      - change: the change itself, written out. after: the new text, e.g. …. before: always "" (the evidence doesn't carry the page's text yet).
      
      // index.js, replaceTasks
      change: { before: null, after: task.change.after.trim() },
    • The same prompt leaves no URL for a page still to write. "From the evidence" can't name such a page, so the task is refused. Say what to give instead, e.g. "for a new page, the path it should have on the brand's site". That's what quality.test.js's prompt-aimed task already uses.
  2. The Content brief doesn't get the change (server/src/routes/content.js:1257-1267). briefTaskContext gives the brief Where, Why, Steps and Done when, but not the URL or the change. A task sent to Content shows its change on the card, but the brief and the draft are written without it. Add:
    task.url && `- Page: ${task.url}`,
    task.change?.after &&
      (task.change.before
        ? `- Change: replace "${task.change.before}" with "${task.change.after}"`
        : `- Change: add "${task.change.after}"`),
  3. Schema bounds (server/src/lib/action-center/task-writer/prompt.js:18-25).
    • The comment above the schema says it is looser than the quality rule on purpose, so one bad task doesn't throw the whole answer away. The new limits work against that: after at 1,000 characters (an outreach pitch or a written-out table can pass it) and check at 10 ("auto (re-fetch)" is 15) are hard limits.
    • One over-long field fails the whole answer. Both attempts are charged, and the action keeps its template tasks.
    • Raise the limits (e.g. before and after 4,000, check 40, url 2,000). Then have taskProblems refuse what's over the stored limits, so an over-long field costs one task, not the whole answer.
  4. The drawer's URL and Change (web/src/lib/action-center/task-details.ts:211-216).
    • The URL isn't checked.
      • acme.example/pricing stays as typed and shows as text, while the writer stores https://acme.example/pricing and shows it as a link.
      • Any text goes out as the webhook's url, which the docs call the exact page.
      • Keep a URL that is http(s)://… or /…, add https:// to a host and path as pageAddress does, and show a message on the field for anything else.
    • A Before with no After is dropped on save without a word. Add a hint on After saying the change is kept only when After has text.
  5. Bound the work on a long Where or URL in ownPageOf (server/src/lib/action-center/task-send.js:80-81, on main too). The trim at line 81 grows faster than the token's length. Clip the text to 500 characters before splitting, the same limit the drawer uses:
    for (const token of text(where).slice(0, 500).split(/[\s·,;()]+/)) {

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with follow-ups.
I'll merge it together with #1562 once 00293 is fixed, so the writer's new checks and the review queue reach the API in the same deploy: with this alone, a written task missing a field is dropped rather than held.

What I checked:

  • Where the fields live. url, change and check go in action_tasks.details (jsonb), beside AC-004's fields. On main that column has no check constraint and action_tasks has no trigger, so the database neither refuses nor rewrites them. There's no migration, and schema.sql is untouched.
  • Editing.
    • The drawer saves through updateTaskDetails. That's the same server action, under the same member policy, as the other task fields.
    • isTaskDetailsEdit checks the new fields' types, and checks check against the three values.
    • cleanTaskDetailsEdit trims and clips each field to the inputs' maxLength: 500 for the URL, 1,000 each for Before and After.
    • The cleaned fields are merged into the stored details. An Improve task's body and evidence, source, refs and sent all stay.
    • The How we check <Select> has its items.
  • Rendering.
    • The URL is a link only when it starts with http:// or https://, and the link has target="_blank" and rel="noopener noreferrer". A path, or anything else, shows as text.
    • Before and After render as plain JSX text, with no dangerouslySetInnerHTML. whitespace-pre-line keeps their line breaks.
    • The Content opportunity's "From a task" card shows the URL as text.
  • The task writer.
    • The schema asks for url (500), change.before and change.after (1,000 each) and check (10), all as strings.
    • The quality rule refuses a missing URL, a URL that isn't a page address, an empty After and an unknown check. A refused task is asked for once more, as today.
    • replaceTasks stores a host and path with https://, an empty Before as null and the check in lower case.
    • The answer is longer now. No output cap is set, and both calls are charged at their real usage on the same budget hold, so the extra tokens are metered as before.
  • Webhook and exports.
    • action_task.sent gains url, change and check, each null when the task has none. No key is renamed or removed. The docs match the code: change.before is null when the change adds text.
    • The CSV gets url, change and check columns between existing ones. Readers that go by header name are unaffected. Readers that go by position see the columns shift, as they did with AC-004's columns. toCsv still escapes cells that start with a formula character.
    • The workbook's 13 widths match its 13 columns.
    • The MCP export builds its translators from EXPORT_NAMESPACES, so it gets taskChecks too. get_action gains the three keys, and its description names them.
  • Speed. PAGE_ADDRESS and pageAddress are anchored and have no overlapping repeats. On 100 KB adversarial inputs, each test takes under 1 ms. The schema also holds the model's URL to 500 characters before either one runs.
  • Tests. These fail without the change:
    • the quality cases (URL, change, check, and the URL naming the target);
    • pageAddress;
    • the task-send cases (the URL's page when Where names none, and the webhook's null keys);
    • the writer's stored details;
    • parseTaskDetails and cleanTaskDetailsEdit;
    • the drawer's view and form;
    • the exports and MCP get_action.
  • Merge.
    • The branch is one commit on c00e0f0. Since then main has gained only #1544, which touches other files.
    • git merge-tree with main (3b650fb) is clean, and CI passes. CI's web job doesn't run vitest; the PR body says the web suite passes locally.
  • Before the API deploy.
    • The drawer shows and edits URL, Change and How we check right away. The exports and MCP carry them too, since all of that runs in the web app.
    • Tasks the writer adds have none of the three fields until the API is deployed. The card shows nothing extra for them.
    • URL and Change filled in by hand don't travel yet:
      • Send to webhook posts today's payload, though the docs already list the new keys.
      • Send to Content ignores the URL, and its card shows no URL or Change.
    • "Automatic: we fetch the page again" is only a label until #1565's checks run on the API.
    • Nothing that works today breaks.
    • Deploy the writer together with #1562. With this PR alone, a written task that misses one of the new fields is refused, and dropped after the second ask. #1562 holds such tasks for review instead.

Follow-ups:

  1. The writer's Before (server/src/lib/action-center/task-writer/prompt.js:45, server/src/lib/action-center/task-send.js:107-109).
    • The evidence carries no page text. Each page comes with its URL, prompts, positions, visits and audit issue labels only. So "quoted from the evidence" can't be met: any non-empty before is the model's own wording, and the card shows it as the page's text.
    • before now also decides Send to Content's page. A written task whose Where names no page and whose before is filled becomes "optimize" on its URL, and that URL may be a page still to write.
    • Until the evidence carries the page's text, ask for the new text only and store no Before:
      // prompt.js
      - change: the change itself, written out. after: the new text, e.g. …. before: always "" (the evidence doesn't carry the page's text yet).
      
      // index.js, replaceTasks
      change: { before: null, after: task.change.after.trim() },
    • The same prompt leaves no URL for a page still to write. "From the evidence" can't name such a page, so the task is refused. Say what to give instead, e.g. "for a new page, the path it should have on the brand's site". That's what quality.test.js's prompt-aimed task already uses.
  2. The Content brief doesn't get the change (server/src/routes/content.js:1257-1267). briefTaskContext gives the brief Where, Why, Steps and Done when, but not the URL or the change. A task sent to Content shows its change on the card, but the brief and the draft are written without it. Add:
    task.url && `- Page: ${task.url}`,
    task.change?.after &&
      (task.change.before
        ? `- Change: replace "${task.change.before}" with "${task.change.after}"`
        : `- Change: add "${task.change.after}"`),
  3. Schema bounds (server/src/lib/action-center/task-writer/prompt.js:18-25).
    • The comment above the schema says it is looser than the quality rule on purpose, so one bad task doesn't throw the whole answer away. The new limits work against that: after at 1,000 characters (an outreach pitch or a written-out table can pass it) and check at 10 ("auto (re-fetch)" is 15) are hard limits.
    • One over-long field fails the whole answer. Both attempts are charged, and the action keeps its template tasks.
    • Raise the limits (e.g. before and after 4,000, check 40, url 2,000). Then have taskProblems refuse what's over the stored limits, so an over-long field costs one task, not the whole answer.
  4. The drawer's URL and Change (web/src/lib/action-center/task-details.ts:211-216).
    • The URL isn't checked.
      • acme.example/pricing stays as typed and shows as text, while the writer stores https://acme.example/pricing and shows it as a link.
      • Any text goes out as the webhook's url, which the docs call the exact page.
      • Keep a URL that is http(s)://… or /…, add https:// to a host and path as pageAddress does, and show a message on the field for anything else.
    • A Before with no After is dropped on save without a word. Add a hint on After saying the change is kept only when After has text.
  5. Bound the work on a long Where or URL in ownPageOf (server/src/lib/action-center/task-send.js:80-81, on main too). The trim at line 81 grows faster than the token's length. Clip the text to 500 characters before splitting, the same limit the drawer uses:
    for (const token of text(where).slice(0, 500).split(/[\s·,;()]+/)) {

@gkhngyk
gkhngyk merged commit 1e024fb into ansvisor:main Oct 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants