Repository navigation
feat(chat): ask once what Chat should focus on, starting from the person's work areas (W2-22) - #1914
Conversation
…son's work areas (W2-22) CHAT-24 §3: the focus picker opens once on the first Chat Home (marked shown as it opens) with the areas the person's work areas suggest, Home's pill reopens it, and Settings › General › Your focus keeps changes at once. Focus only changes suggestions; no migration (00400 focus, 00408 focus_prompted_at). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main hid Answer language, notifications and "Thought for N s" in Chat Settings (ansvisor#1903). Keep them hidden and keep the new Your focus row, in the component, the page comment and the help article. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… own settings saveChatFocus, skipChatFocus and markFocusPrompted write only the person's own chat_user_prefs row and cost nothing, like saveChatGeneralSettings, so they join the read-only coverage test's open list with their reasons. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… pill is cancelled From the pill the picker's way out still saved an empty focus, so changing your mind wiped the focus you had. Opened from the pill it now reads Cancel and only closes; Skip for now stays the first opening's answer.
gkhngyk
left a comment
There was a problem hiding this comment.
Approving, with 1 fix on top: commit 1793813 (on top of this branch merged with current main).
Fix: cancelling the picker from Home's pill wiped the focus. When the picker opened from the pill (Edit / Choose focus), its "Skip for now" still called skipChatFocus(), which saved focus: []. Someone who opened Edit and changed their mind lost their focus. Now, when the picker opens from the pill, the button reads Cancel and only closes it: nothing is saved, no chat_focus_skipped event fires, and the next Edit opens with the same picks. The first-open picker still shows Skip for now and saves no focus, as before. The change adds a chatShell.focus.cancel key and one line about it in help/chat/focus.md. focus-picker.test.tsx gets a test for it, which fails without the fix.
Checked and fine:
- The three new actions write only the person's own
chat_user_prefsrow. They go throughchatPerson(), so the CHAT_AGENTIC flag applies, and on prod the row's select/insert/update policies are alluser_id = auth.uid(). Keeping them open to read-only roles in the subscription-guard coverage list is right: focus only shapes suggestions. focusPicksvalidates each pick against the eight areas and rejects duplicates.focusOfdrops unknown values on read.focusandfocus_prompted_atexist on prod. The picker marks itself prompted as it opens, so it really shows only once.- Picker a11y: the cards are
aria-pressedtoggle buttons inside a labelled group. Home underneath isvisibility: hidden, so it is out of the tab order and the accessibility tree. help/chat/focus.md: every section is under 150 words. It is stillapproved: false, so the approved-articles snapshot doesn't change.
Follow-up (not blocking): focus isn't moved into the picker when it opens from the pill, or back to the pill when it closes. Keyboard and screen-reader users land on body.
Tests: vitest on src/components/chat, src/lib/chat, the chat pages, src/lib/actions, src/lib/guards (plan-row included), src/lib/help, subscription-guard-coverage and demo-gate(-routes): 228 files and 2578 tests pass. tsc --noEmit is clean, and eslint and prettier are clean on the touched files.
…e task strip's progress (#1942) * feat(chat): ask once what Chat should focus on, starting from the person's work areas (W2-22) CHAT-24 §3: the focus picker opens once on the first Chat Home (marked shown as it opens) with the areas the person's work areas suggest, Home's pill reopens it, and Settings › General › Your focus keeps changes at once. Focus only changes suggestions; no migration (00400 focus, 00408 focus_prompted_at). Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(chat): keep the focus actions open in read-only, as the person's own settings saveChatFocus, skipChatFocus and markFocusPrompted write only the person's own chat_user_prefs row and cost nothing, like saveChatGeneralSettings, so they join the read-only coverage test's open list with their reasons. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): leave a focus as it was when the picker opened from Home's pill is cancelled From the pill the picker's way out still saved an empty focus, so changing your mind wiped the focus you had. Opened from the pill it now reads Cancel and only closes; Skip for now stays the first opening's answer. * fix(chat): move focus into the focus picker and back, and announce the task strip's progress Follow-ups from the #1914 and #1900 reviews, for keyboard and screen-reader users. Focus picker (stacked on #1914): - Its question takes focus as it opens, from Home's pill or on the first Chat Home, instead of focus staying on body. - Cancel or Continue from the pill hands focus back to the pill; Skip for now or Continue on the first opening lands on Home's composer (on the pill when the composer can't be typed in). Task strip (/tasks, W2-11): - A polite live region says what changed, once: the rows whose status moved ("Add FAQPage schema: Writing"), then "3 of 4 ready" when the count moved. A reload or the strip's first tasks say nothing. - The progress bar has aria-valuetext ("2 of 4 ready"). - New text in en.json (chatRun.tasks.changed). Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
Summary
Chat W2-22: a focus picker asks what the person works on, so Chat can fit its Home, starter questions and skills to them (CHAT-24, mockup
CHAT-mockup-v2.html#s-dept). Built on main. No migration:chat_user_prefs.focus(00400) andfocus_prompted_at(00408) already exist. BehindCHAT_AGENTIC.Focus and work areas are separate. Work areas (00374) only hide sections of the left menu. Focus only shapes Chat's suggestions. Neither changes access, and the picker says so. The picker is prefilled from the person's work areas but doesn't save them. After that the two stay independent:
comphas no work area.What it does
lib/chat/focus.ts:focusFromWorkAreas),focusOf,focusLabel;chat-prefs.ts:saveChatFocus,skipChatFocus(sets{}) andmarkFocusPrompted. They never throw, and each writes only the person's own row._chat-page-access.ts→chatFocusState()returns{ focus, ask, prefill }.askmeans focus is null and the person was never prompted. If the read fails, Home opens without the picker.focus-picker.tsx) opens once, on Chat's first open:focus_prompted_atis written when it shows;invisible h-0 overflow-hidden), so a draft isn't lost and the composer measures its full height.chat_focus_picker_shown,saved,skipped.chatShell.focus.*andsettings.focus.*.help/chat/focus.md(approved: false);chat-settings.md.Left out on purpose
on delete cascade).Next: W2-23a fits Home to the focus (stacked on this). W2-23b adds the focus-tagged skills.
Related issue
None. Chat Wave 2 (W2-22).
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_AGENTIC=true. Use a person with work areas Product Development and Business Development, who has never been asked.focus,chat-prefs,_chat-page-access,focus-picker,chat-homeandchat-settings.Checked in the browser at 1024px, light and dark: the first open, Home's pill, Settings › Your focus, and the composer after Continue. The user approved the screens. Screenshots are available on request.
Checklist
yarn lintpasses (0 errors; 7 old warnings in files this PR doesn't touch)yarn typecheckpassesyarn format:checkpasseshelp/(or no user-visible change)Full checks on 0cdf02f (this branch with main merged in): web 800 of 801 files / 8,353 tests passed, and
yarn buildpasses. Serverformat:checkand lint are clean, and 351 files / 4,987 tests pass (3 skipped). The one failing file wassubscription-guard-coverage.test.ts, because the three focus actions weren't on its list. 9f3e727 adds them to the open list: likesaveChatGeneralSettings, they write only the person's own row and cost nothing. That file now passes (6/6).🤖 Generated with Claude Code