Skip to content

fix(chat): read every open action by priority, say how many, and name actions by title - #2420

Merged
gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:fix/chat-reads-all-actions
Nov 16, 2026
Merged

gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:fix/chat-reads-all-actions

Conversation

@cihan-gyk

@cihan-gyk cihan-gyk commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Merged with main (16 Nov): main at d6ed27377 is merged in (it brought #2446, #2442, #2447, #2441 and #2377). The only conflict was the generated approved-articles.json, which was regenerated. In help/chat/chat.md, "Watch the work" keeps #2446's text (no row counts) plus this PR's line about action titles (132 words). Typecheck is clean, and 328 test files (4,710 tests) pass. The branch merges cleanly on main.

Summary

The owner reported this. They asked Chat "what are the most important actions?" on a brand with 53 actions. The step said Read Action Center · 10 rows, and the answer said it had looked at "the first 10 actions by priority score". It also named actions by bare numbers ("AC-251, 249, 250, 248 and 247 have looked stale…", "assign an owner to AC-251"). The Actions list doesn't show those numbers, so the owner couldn't tell what they were.

Causes:

  • Chat capped this read at 10 rows by default (ROW_LIMITS.list_action_center_tasks), and at 50 at most.
  • The read included closed actions and gave no total.
  • The rows had no title, only action_no and an opaque kind.

Now:

  • Chat ranks every open action on the server and reads them 50 to a page. Each page comes with the total and a "Showing N of M" note.
  • Each row carries the action's title.
  • The tool description and the writer's rules both require a title with a linked number.

Changes

  • New Chat read (listActionsPageFor, lib/mcp/action-center-reads.ts):
    • What it reads and how it ranks: open actions by default (New, In progress, On hold), or one status you ask for, and an optional category. It never reads deleted actions. It ranks them on the server by Priority Score, unscored last, then by last update and id. sort: "updated" is still available.
    • Pages: 50 rows by default, and 50 at most. It returns total, offset and next_offset, and offset gets the next page. An offset past the end returns an empty page with the total, including when PostgREST answers 416.
    • Compact rows: ref (from actionRef), title (worded as the Actions list words it, with what is left of its targets), category, status, priority, priority_level, stale_since, due, assignee, tasks (done/total) and updated. stale_since, due and assignee appear only when they are set. Each row also keeps its id for get_action.
    • note: for example, "Showing 1–50 of 53 open actions, highest Priority Score first. 3 more not shown: read them with offset 50, or say the answer covers the top 50 of 53. Name each by its title, with its ref."
    • Scope: the same as before. brandAllowed checks the brand against the caller's organization and brand access before anything is read.
  • list_action_center_tasks (Chat registry):
    • It calls the new read and takes status: "open" (the default), limit (50 at most) and offset.
    • Its description says to read the default page before judging "most important" or "what first". It says to give "the top 50 of 53", or read the next page, when there are more. It says to name each action by its title with its ref, never a ref alone.
    • The MCP Server's list_actions is unchanged.
  • Chat's scope and budget:
    • The row default for this read goes from 10 to 50.
    • The new PAGED_READS list skips the extra row Chat reads to check for more: this read counts its own rows.
    • The read gets its own share of the run's data budget, 20,000 characters (RESULT_CHARS in run-limits.ts), so all 50 rows reach the model. Other reads keep 12,000.
  • Writer rules (ACTION_NAME_RULES in rules.ts, part of the persona rules):
    • Name an action by its title, then its number in brackets, which the app links: Recover lost citations on 3 prompts (AC-12).
    • Never a number alone, never a run of bare numbers, never a range in place of the numbers.
    • Group similar actions by what they share, with each one's own number.
    • Say "the top 50 of 53" when a read showed fewer actions than its total.
  • One formatter for action codes:
    • The new actionRef(n) in lib/action-center/action-ref.ts now builds every action code Chat shows or links. That covers the tool rows, the link helper, the examples in the rules and the description, and the codes in Undo/Activity, the agent run scope, the Send to Action Center duplicate message and the Inbox suggestion cards.
    • When numbering moves to per-brand numbers, only the number passed to actionRef changes.
    • Outside Chat, these still build AC-${n} by hand: the action export, Content, reports and the review page. So do the AC-{no} message templates in en.json. The numbering PR can switch them.
  • 30-day plan skill: it names actions by title with their AC-n. library.json is regenerated.
  • Eval: the agents' and skills' eval gets a must check, "names actions by title". It flags an answer with a bare "AC-251", a run like "AC-251, 249, 250" or a range like "AC-247…AC-251". The eval fixture for this read now has the new shape.
  • Help: Use Chat gets a new section, "Ask about your actions", and the action-link line now mentions titles. Help is regenerated.
  • No migrations, no new dependencies, no lockfile changes. The server is untouched.

How to test

  1. Open a brand with more than 50 open actions and ask Chat "What are the most important actions?"
  2. Ask the same on a brand with fewer than 50 open actions. Chat reads them all in one step and never says it judged only some.
  3. Ask "Which actions are stale?" Similar actions are grouped by what they share, and each one keeps its own linked number.
  4. Click a number in the answer. It opens that action in Action Center.
  5. Switch to a person with Selected brands access and ask about a brand they don't have. Nothing of that brand is read.

Checks

  • Web typecheck: passed.
  • ESLint and Prettier on the changed files: clean.
  • Vitest, 324 files and 4,623 tests passed (1 skipped), covering:
    • src/lib/chat (all), src/lib/action-center, src/lib/mcp and Help;
    • use-server-exports and subscription-guard-coverage;
    • src/components/chat, the chat runs route and chat-action-center.
  • New tests:
    • Default read: returns 50 of 54, ranked by priority, with the total.
    • Note: says "Showing 1–50 of 54" and how to read the rest.
    • Paging: no gap and no repeat, unscored actions last, past the end (also on 416).
    • Filters and rows: status, category and sort; compact rows, including stale only while New, task counts that leave skipped tasks out, and titles with what is left of their targets.
    • Size: 50 rows fit the read's share.
    • Scoping: another brand's actions are never read, and nothing of a brand outside the organization or the person's access is read. The page read is also in the MCP brand-scope test.
    • Guidance: the rules and the tool description require titles with linked numbers, built with actionRef.
    • Eval check: it flags a bare "AC-251" and lets titled forms through.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9

… actions by title

The owner asked Chat "what are the most important actions?" on a brand
with 53 actions. Chat read 10 (its row default for the Action Center
read), judged only those, and named actions by bare numbers ("AC-251,
249, 250") that the Actions list doesn't show.

- list_action_center_tasks reads a page from a new Chat read,
  listActionsPageFor: every open action (New, In progress, On hold) is
  counted and ranked on the server by Priority Score, 50 to a page with
  the total, next_offset and a "Showing N of M" note; offset pages on.
  Rows are compact: ref, title (as the Actions list words it), category,
  status, score and level, stale_since, due, assignee, tasks, updated.
  Still scoped to the caller's organization and brand access.
- The page is never probed for one more row (it counts itself) and gets
  a 20,000-character result share, so all 50 rows reach the model.
- The writer's rules and the tool's description require a title with
  the linked number ("**Title** (AC-12)"), never a number alone, a run of
  bare numbers or a range, and saying "the top 50 of 53" when a read
  didn't cover them all. The 30-day plan skill names actions the same way.
- Every action code Chat shows or links comes from actionRef (the
  action-ref helper), examples included, so a change of numbering only
  changes its input.
- The agents' eval flags an answer with a bare "AC-251" (must check).
- Help: "Ask about your actions" in Use Chat.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
gkhngyk
gkhngyk previously approved these changes Nov 15, 2026

@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.

LGTM.

Conflicts:
- help/chat/chat.md: main's keywords (Settings in the chat menu) plus this
  branch's (most important actions, top actions, action title); main's new
  text and this branch's "Ask about your actions" section both kept.
- action-ref.test.ts: both sets of tests (actionRef from this branch;
  actionCode, searchedActionNo and matchesActionCode from main's ansvisor#2418).
  actionCode now builds its code with actionRef, so one formatter remains.
- web/src/lib/chat/skills/library.json: regenerated from skills/*/SKILL.md
  (yarn vitest run -u src/lib/chat/skills).
- approved-articles.json: regenerated (yarn vitest run -u src/lib/help).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
…umbers

Brings the updated ansvisor#2420, which carries upstream main.

Conflicts:
- action-ref.ts and action-ref.test.ts: this branch's versions (actionCode
  from the brand's number via actionCodeNo, with every test from both
  branches and ansvisor#2418).
- server/src/lib/action-center/from-chat.js: main's Ads source (`source`
  param, verifiedPlace without a conversation for Ads) and this branch's
  `brandNo` in the answer and actionCode in the duplicate message.
- from-chat.test.js: main's Ads test now expects the answer's brandNo
  for the same key again (this branch's answer shape).
- server/src/lib/demo/coverage.js: both SKIPPED entries,
  brand_number_counters (00534) and mentions_terms_packed_ready (00540).
- supabase/schema.sql: regenerated (bash supabase/build-schema.sh); 00534
  sits before 00535-00540 by file order.
- library.json and approved-articles.json: regenerated, unchanged from
  the automatic merge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
…-numbers

Brings the updated ansvisor#2422 (with ansvisor#2420 and upstream main). No conflicts;
schema.sql, library.json and approved-articles.json regenerated and
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
gkhngyk
gkhngyk previously approved these changes Nov 16, 2026

@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.

LGTM.

Brings in ansvisor#2446 (no row counts), ansvisor#2442, ansvisor#2447, ansvisor#2441 and ansvisor#2377.

Conflicts:
- approved-articles.json: regenerated (yarn vitest run -u src/lib/help).

help/chat/chat.md merged cleanly: main's "Watch the work" text (no row
counts) and this branch's action-title line are both kept (132 words);
updated stays 2026-11-16, last_checked 2026-11-15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
Takes the updated ansvisor#2420, which now includes upstream main (ansvisor#2446 no row
counts, ansvisor#2442, ansvisor#2447, ansvisor#2441, ansvisor#2377).

Conflicts:
- approved-articles.json: regenerated (yarn vitest run -u src/lib/help).

help/chat/chat.md merged cleanly: updated 2026-11-16, last_checked
2026-11-15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
Takes the updated ansvisor#2422, which now includes ansvisor#2420 and upstream main
(ansvisor#2446 no row counts, ansvisor#2442, ansvisor#2447, ansvisor#2441, ansvisor#2377). No conflicts;
approved-articles.json checked with yarn vitest run -u src/lib/help
(no change).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
Takes the updated ansvisor#2423, which now includes ansvisor#2422, ansvisor#2420 and upstream
main (ansvisor#2446 no row counts, ansvisor#2442, ansvisor#2447, ansvisor#2441, ansvisor#2377).

Conflicts:
- help/chat/chat.md: front matter only; took the later last_checked
  (2026-11-16). Both sides' text is kept: main's "Watch the work" (no
  row counts, 148 words) and this branch's look-up-by-code paragraph in
  "Ask about your actions" (146 words).
- approved-articles.json: regenerated (yarn vitest run -u src/lib/help).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9

@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.

LGTM.

@gkhngyk
gkhngyk merged commit 6852db0 into ansvisor:main Nov 16, 2026
12 checks passed
gkhngyk pushed a commit that referenced this pull request Nov 16, 2026
…ge shows

Chat read 10 of 451 signals, 25 prompts, 20 of each 100 mentions and 5
reports, with no total and no way to read on, and a result cut for size
came back as "{list}_more", which the model turned into "38 actions are
missing". Every list read now pages the way list_action_center_tasks
does since #2420:

- Each list read takes limit (50 by default and at most) and offset, and
  returns total (every match), offset, next_offset (null on the last
  page) and a note ("Showing 1–50 of 451 signals, newest first. Read the
  next page with offset 50, or say how many you judged."). Shared helpers
  in lib/mcp/list-page.ts and chat/registry/list-paging.ts.
- Reads: list_brands, list_prompts, get_prompt_performance,
  list_prompt_suggestions, get_prompt_volumes, list_topics, list_mentions,
  list_citations (one offset pages domains and pages), list_competitors,
  get_site_audit_summary, list_signals, get_action_history,
  list_content_opportunities, list_drafts, get_reports and
  get_ads_opportunities. Each keeps its filters; descriptions state the
  real default.
- Database lists count on the server and read a range (new …PageFor
  reads beside the MCP functions, which keep their shape); an offset past
  the end is an empty page with the total. list_mentions reads any answer
  by offset over mentions_list's own paging, not 20 of each 100.
- list_signals reads the Signals page's window (detected by its end, open
  or resolved after its start) over the run's period, in compact rows:
  title and description in the page's words, where, and the actions
  built on it (lib/mcp/signal-page.ts).
- scope.ts treats any read with an offset as paged: no probe row, 50 a
  page. Each page gets a 20,000-character share (PAGE_CHARS).
- fitResult cuts a page over its share into a shorter page whose
  next_offset and note say where to read on: never "{list}_more".
- Every read stays limited to the caller's organization and brand access
  (brand-scope test covers each new page read).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
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.

3 participants