Repository navigation
feat(chat): add the Inbox's tabs and the daily suggestion rows (W2-25) - #1892
Merged
gkhngyk merged 6 commits intoOct 31, 2026
Merged
Conversation
Behind CHAT_AGENTIC (and CHAT_AGENTIC_ORGS): with it off the Inbox page
answers as it does today, and a read that says chat_off keeps the Inbox as
it was, with no tabs.
- Topic tabs (CHAT-26 §2.1, mockup #d-inbox) with their counts: All, Daily
suggestions, Needs you and Runs. Reports and Alerts stay hidden until
they have a source (CHAT-12, CHAT-22). The subtitle keeps its counts and
adds "N suggestions this week". An Analyst, who gets none, has no Daily
suggestions tab.
- Daily suggestion rows (§2.2): the last 7 days (sent_at > now − 7 days,
not removed), newest first. The title comes from actionTexts and the
priority from the Action Center's own levels, read from the summary W2-24
keeps (version 1). The row also shows AC-number, how it is done
("Content Editor or Chat · about 20 min", "started in Content Editor
Oct 27") and the day it was sent ("Today · Oct 29"). Its dot is new
(blue), seen or started (green), with dark-mode colors.
- Rows on screen (All or Daily suggestions) are marked seen, which isn't a
use. Opening one marks it opened and its feed's last_used_at, then opens
the action in the Action Center on its brand (until W2-26's page).
- The line above the rows with Pause daily suggestions (every feed of the
person off), and the paused banner (§2.4, #d-paused) with Turn back on
(status on, paused_at null). The job's next-morning rule still reads
updated_at.
- An Agency partner's first Inbox makes their feeds, on, for the
workspace's active non-demo brands, with a line saying so (DECISIONS V).
Admins' and Managers' feeds stay the job's to make; Analysts get none.
- Writes go through server actions in lib/actions/chat-suggestions.ts.
Each checks the plan first (assertWritable), writes with the service role
on the person's own rows only, and answers { ok, failure } without
throwing (ansvisor#1777). Reads go through the person's session (00422 RLS). In
a read-only workspace the list shows, nothing is written, and Pause or
Turn back on opens the plan dialog.
- The page's live part (chat-inbox-page.tsx) is kept apart from
chat-inbox.tsx, so the Chat shell, Home and All chats don't import the
server actions.
- Help: a Daily suggestions article (approved: false) and the Inbox's tabs
in the Chat article.
No Settings › Notifications switch: the mockup has none, so only the
Inbox's link turns them off.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d respect Action Center access in the Inbox (W2-25) Review fixes for the Inbox's daily suggestions (CHAT-26), on top of 2bbd08c. - A suggestion whose action was deleted leaves the list: the read joins its action through the person's session (actions!chat_suggestions_action_id_fkey!inner), whose policy hides deleted actions. Opening one checks the same (actions.deleted_at null) and writes nothing. An action done or dismissed since keeps its row, faded, with Done or Dismissed in place of how it can be done, and no filled Open. - The paused banner shows while any brand's feed is paused (§2.4, §5); Turn back on already turns every brand's on. - No Daily suggestions tab or rows for someone without Action Center on their menu (§6, 00374), and Pause, Turn back on and the first Inbox make or turn on no feed for them. Action Center is on every menu today (ALWAYS_ON_SECTION); the check follows the menu's own rule. - A suggestion put off (snoozed_until) stays out until its day. The first Inbox's feed read is the workspace's only. - "Today" is dated in the zone the nightly job dates sent_on in (its resolveZones: the person's latest Chat answer's zone, else the workspace's most read one, else UTC), not the browser's clock. - The read counts every suggestion it would list (count: exact): the tab, the subtitle and All count them all, and a line says "Showing the newest 100 of N." when the list stops at 100. - A row names its brand when the person has more than one; a row whose brand isn't in their brand list doesn't open (it would open on the brand on screen). An action with no kind still has a title. Open runs once on a double click, and still navigates when marking it fails. Open goes to the Action Center until W2-26's page (a comment says so). - Tabs: one tab stop, the arrow keys, Home and End, aria-controls and a tabpanel. The open tab is kept in the address (?tab=), so coming back from a row opens the same one. - Help: who gets them (Action Center in the menu), closed and deleted actions, brand names, pause per brand; the Inbox count in the Chat article leaves suggestions out (their tab has its own count). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t trigger (W2-25) Follow-up to 2cd1000. Action Center is on every menu (menu access, 00374: ALWAYS_ON_SECTION, which hiddenMenuSections never hides), so the suggestions' menu check was dead code that cost a read of the role's menu on every Inbox. It goes, and a test keeps the assumption: it fails, saying "W2-25 daily suggestions must then respect Action Center access (CHAT-26 §6)", once Action Center can leave a menu. - Help: daily suggestions come from the Action Center, which is in everyone's menu, so menu settings don't turn them off. - The "Today" zone rule says it copies W2-24's resolveZones, ZONE_DAYS and ZONE_ANSWERS (server/src/lib/chat-suggestions), to keep in step. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…son's session (W2-25) Starting or turning on daily suggestions made feeds for every active brand of the workspace, read with the service role; opening one read the row the same way. Both now read through the person's session, so they follow the brands they can see (brands: member select, and chat_suggestions' own policy) as brand access narrows them. The writes stay the server's, on the person's own rows. The help page says Admins and Managers get them for every brand they can see.
gkhngyk
approved these changes
Oct 31, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Approving, with 1 fix on top: commit 9782b0a ( a fast-forward of c5915af with origin/main merged in).
Fix
- 9782b0a: starting or turning on daily suggestions read the workspace's brands with the service role, so feeds were made for every active brand. That read now goes through the person's session (
brands: member select), and so does the read before opening a suggestion. Both now follow the brands the person can see as brand access narrows them (00389, 00424). The writes stay the server's, on the person's own rows. Two tests cover this, and both fail without the fix. The help page now says Admins and Managers get suggestions "for every brand they can see".
Checked, fine as is
- Counts: All = chats + every suggestion, Daily suggestions = the full count, and Needs you + Runs split the chats. "Showing the newest 100 of N" appears when the list stops at 100. The count respects the inner join, so a deleted action's suggestion isn't counted.
- Reads: the list and the feeds go through the session (00422's own-row policies, and 00424 adds brand access later). The time-zone read uses the service role, scoped to the workspace, and only the day leaves the server. It matches W2-24's
resolveZones,ZONE_DAYSandZONE_ANSWERS. - Embeds: both hints name an existing single FK (
chat_suggestions_action_id_fkey,chat_messages_conversation_id_fkey). - Query cost: one read per Inbox load. Nothing polls, and seen ids are de-duplicated. The time-zone query uses the conversation-org and message-created indexes (EXPLAIN on prod).
- Flag off: the page 404s, and every action answers
chat_offand touches nothing. - Read-only workspace: every write calls
assertWritablefirst and answersread_only. The UI then opens the plan dialog.subscription-guard-coveragepasses. - Demo brand: no feeds for it.
- Write actions: they are idempotent (
seen_at/opened_atare only set while null, and the upserts useignoreDuplicates), and a double click runs Open once. ?tab=falls back to All for an unknown tab.- Tabs: one tab stop, arrow keys plus Home/End, and
aria-selected,aria-controlsand a labelled tabpanel. - en.json: every key the new components use is there.
plan-rowpasses, so the client components don't import the server's Supabase client.- Help: the 150-word section check passes.
- Open PRs: merges cleanly with #1876, #1885, #1889 and #1890.
Follow-ups (not blocking)
startDailySuggestionschecks whether the person already has feeds with the service role, across all brands. Once brand access is on, someone whose only feeds are for brands they can no longer see would get none made for their visible ones. Reading that check through the session would close this.- Turning suggestions back on also turns on feeds for brands the person no longer sees. The nightly job should skip those (the brand access PR 8 follow-up already listed).
Tests run (on that commit)
- vitest: src/components/chat, src/lib/chat, the chat-suggestions actions, the chat pages, src/lib/guards, src/lib/help, src/lib/demo and
subscription-guard-coverage. 1,313 of 1,314 pass. The one failure is the knownchat-menu.test.tsxclock case, fixed in #1876. tsc --noEmitis clean. eslint and prettier pass on the touched TS files.
8 of 13 tasks
gkhngyk
approved these changes
Oct 31, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Merging in order with the other approved PRs. This head merges current main; its tree is what main will be after this squash, checked with the full server and web suites, tsc, lint, format and next build.
Merged
5 of 13 tasks
gkhngyk
added a commit
that referenced
this pull request
Oct 31, 2026
…tor, Do it with Chat, Not now and Remove (W2-26) (#1898) * feat(chat): add the Inbox's topic tabs and daily suggestion rows (W2-25) Behind CHAT_AGENTIC (and CHAT_AGENTIC_ORGS): with it off the Inbox page answers as it does today, and a read that says chat_off keeps the Inbox as it was, with no tabs. - Topic tabs (CHAT-26 §2.1, mockup #d-inbox) with their counts: All, Daily suggestions, Needs you and Runs. Reports and Alerts stay hidden until they have a source (CHAT-12, CHAT-22). The subtitle keeps its counts and adds "N suggestions this week". An Analyst, who gets none, has no Daily suggestions tab. - Daily suggestion rows (§2.2): the last 7 days (sent_at > now − 7 days, not removed), newest first. The title comes from actionTexts and the priority from the Action Center's own levels, read from the summary W2-24 keeps (version 1). The row also shows AC-number, how it is done ("Content Editor or Chat · about 20 min", "started in Content Editor Oct 27") and the day it was sent ("Today · Oct 29"). Its dot is new (blue), seen or started (green), with dark-mode colors. - Rows on screen (All or Daily suggestions) are marked seen, which isn't a use. Opening one marks it opened and its feed's last_used_at, then opens the action in the Action Center on its brand (until W2-26's page). - The line above the rows with Pause daily suggestions (every feed of the person off), and the paused banner (§2.4, #d-paused) with Turn back on (status on, paused_at null). The job's next-morning rule still reads updated_at. - An Agency partner's first Inbox makes their feeds, on, for the workspace's active non-demo brands, with a line saying so (DECISIONS V). Admins' and Managers' feeds stay the job's to make; Analysts get none. - Writes go through server actions in lib/actions/chat-suggestions.ts. Each checks the plan first (assertWritable), writes with the service role on the person's own rows only, and answers { ok, failure } without throwing (#1777). Reads go through the person's session (00422 RLS). In a read-only workspace the list shows, nothing is written, and Pause or Turn back on opens the plan dialog. - The page's live part (chat-inbox-page.tsx) is kept apart from chat-inbox.tsx, so the Chat shell, Home and All chats don't import the server actions. - Help: a Daily suggestions article (approved: false) and the Inbox's tabs in the Chat article. No Settings › Notifications switch: the mockup has none, so only the Inbox's link turns them off. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): hide deleted actions' suggestions, show a paused brand, and respect Action Center access in the Inbox (W2-25) Review fixes for the Inbox's daily suggestions (CHAT-26), on top of 2bbd08c. - A suggestion whose action was deleted leaves the list: the read joins its action through the person's session (actions!chat_suggestions_action_id_fkey!inner), whose policy hides deleted actions. Opening one checks the same (actions.deleted_at null) and writes nothing. An action done or dismissed since keeps its row, faded, with Done or Dismissed in place of how it can be done, and no filled Open. - The paused banner shows while any brand's feed is paused (§2.4, §5); Turn back on already turns every brand's on. - No Daily suggestions tab or rows for someone without Action Center on their menu (§6, 00374), and Pause, Turn back on and the first Inbox make or turn on no feed for them. Action Center is on every menu today (ALWAYS_ON_SECTION); the check follows the menu's own rule. - A suggestion put off (snoozed_until) stays out until its day. The first Inbox's feed read is the workspace's only. - "Today" is dated in the zone the nightly job dates sent_on in (its resolveZones: the person's latest Chat answer's zone, else the workspace's most read one, else UTC), not the browser's clock. - The read counts every suggestion it would list (count: exact): the tab, the subtitle and All count them all, and a line says "Showing the newest 100 of N." when the list stops at 100. - A row names its brand when the person has more than one; a row whose brand isn't in their brand list doesn't open (it would open on the brand on screen). An action with no kind still has a title. Open runs once on a double click, and still navigates when marking it fails. Open goes to the Action Center until W2-26's page (a comment says so). - Tabs: one tab stop, the arrow keys, Home and End, aria-controls and a tabpanel. The open tab is kept in the address (?tab=), so coming back from a row opens the same one. - Help: who gets them (Action Center in the menu), closed and deleted actions, brand names, pause per brand; the Inbox count in the Chat article leaves suggestions out (their tab has its own count). Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(chat): drop the Inbox's Action Center menu check, which can't trigger (W2-25) Follow-up to 2cd1000. Action Center is on every menu (menu access, 00374: ALWAYS_ON_SECTION, which hiddenMenuSections never hides), so the suggestions' menu check was dead code that cost a read of the role's menu on every Inbox. It goes, and a test keeps the assumption: it fails, saying "W2-25 daily suggestions must then respect Action Center access (CHAT-26 §6)", once Action Center can leave a menu. - Help: daily suggestions come from the Action Center, which is in everyone's menu, so menu settings don't turn them off. - The "Today" zone rule says it copies W2-24's resolveZones, ZONE_DAYS and ZONE_ANSWERS (server/src/lib/chat-suggestions), to keep in step. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): read the brands and the suggestion to open through the person's session (W2-25) Starting or turning on daily suggestions made feeds for every active brand of the workspace, read with the service role; opening one read the row the same way. Both now read through the person's session, so they follow the brands they can see (brands: member select, and chat_suggestions' own policy) as brand access narrows them. The writes stay the server's, on the person's own rows. The help page says Admins and Managers get them for every brand they can see. * feat(chat): open a daily suggestion on its own page, with Content Editor, Do it with Chat, Not now and Remove (W2-26) CHAT-26 §2.3, mockup #d-detail, built as "Why did it move?" (#f-why): - /dashboard/chat/inbox/[id]: the action's title as the question, "Picked for you today · no AI cost", what was read (the action, the ranking, its pages' last Site Audit), why this / why now / what it takes from the action's own texts, and the "From your Action Center" card. - Content Editor (only with writing to do) opens the action's draft on its first page; Do it with Chat starts a chat scoped to the action (page, brand and action chips) in the workspace's mode; the composer under the page does the same. Both mark the suggestion started (chat | editor). - Not now (7 days) and Remove go back to the Inbox; the action stays. - readDailySuggestion, snooze/remove/started actions sharing one use path with openDailySuggestion; each checks the plan first. - The Inbox's Open goes to the page, which marks it opened; the breadcrumb reads Chat › Inbox › Daily suggestion · Oct 29. - No data row line until P-1 writes play.dataRow. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): end the suggestion page's "Why now" with one full stop (W2-26) The priority reason is already a sentence (priority.reason.sentence.end), so "Why now: {reason}" adds no stop of its own; seen in the preview. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(chat): read the suggestion page's rows through the person's session, after #1892's fix (W2-26) #1892 (9782b0a) reads a suggestion to open, and the brands, through the person's session, and its test client answers a maybeSingle() read from a '….select.single' default. The page's read and its uses now follow it: - readDailySuggestion's tests drop that default, so the page reads its whole row as before; - the uses (Not now, Remove, started) set their read on the session's single answer, and a new test checks the read goes through the session. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): make one move of a double click on a suggestion's page, and keep it busy while its page opens (W2-26) Not now, Remove, Do it with Chat and Content Editor set busy through state, so a second click in the same frame started the move again, and a move that succeeded freed the buttons while its page was still opening (a Remove after a Not now). A ref now holds the move from the first click; one that fails frees the buttons, one that succeeds stays busy. * test(chat): give the suggestion page's composer setup its skills, as main's type now asks (W2-26) main added skills to ChatComposerSetup (W2-04's / menu), so the test's setup no longer type-checked after the merge. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
8 of 13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Chat W2-25: the Inbox's tabs and the daily suggestion rows (CHAT-26, mockups
#d-inboxand#d-paused). BehindCHAT_AGENTIC. W2-24 (#1872) picks one suggestion per person and brand each morning; this shows them. The owner approved the screen in a preview, and the review fixes were checked again in the browser (1024px, light and dark).The Inbox (
/dashboard/chat/inbox)aria-controlswith atabpanel.?tab=), so coming back from a row opens the same one.AC-n, priority, where it can be done and how long it takes;sent_onin;snoozed_until) stays out until its day.Server actions (
web/src/lib/actions/chat-suggestions.ts)user_id+ organization) and checks the plan first (assertWritable), returning{ ok, failure }.ALWAYS_ON_SECTION), so menu access doesn't turn suggestions off. A test fails once that changes: the Inbox must then respect Action Center access (CHAT-26 §6).Help:
help/chat/daily-suggestions.md(approved: false): who gets them, the rows, closed and deleted actions, brand names, pause and resume.help/chat/chat.mdsays the Inbox count in the menu leaves suggestions out; their tab has its own.Related issue
None. Chat Wave 2 (W2-25, CHAT-26).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
chat_suggestions, open Chat › Inbox:chat_suggestion_feeds.status = 'paused'): the banner shows on Daily suggestions; Turn back on clears it.yarn vitest run src/lib/chat/daily-suggestions.test.ts src/lib/actions/chat-suggestions.test.ts src/components/chat/chat-inbox.test.tsx.Checklist
yarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)help/(or no user-visible change)On c5915af:
format:checkandtypecheckpass,linthas 0 errors (7 old warnings),yarn buildpasses, and the chat, lib/chat and app suites pass 3,068 of 3,069. The one failure ischat-menu.test.tsx's clock case, fixed in #1876.Review: the pre-push review found no blocker. Its shoulds are fixed in 2cd1000 and c5915af:
Its smaller items are in too:
Follow-ups, not in this PR
#d-detail); Open will go there.resolveZones,ZONE_DAYSandZONE_ANSWERS(server/src/lib/chat-suggestions). The two must stay in step; a comment says so.🤖 Generated with Claude Code