From fed60ecff67cc5b3ce2c53f341921d6ceeb708aa Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Wed, 1 Jul 2026 08:50:29 -0700 Subject: [PATCH] FN-7364: hide task chats from common feed by default Hide task-detail planner chats from the common Chat feed unless a project opts in. - Add a project setting and Settings UI toggle for showing populated task chats in the common feed. - Filter task-planner sessions on chat list routes and avoid stale cached/SSE planner rows in the Chat hook. - Cover default-hidden and opt-in behavior with route, hook, settings, and parity tests. - Document the Chat feed behavior and include a patch changeset. Files changed: .changeset/fn-7364-task-chat-feed-setting.md | 7 ++ docs/dashboard-guide.md | 2 + .../core/src/__tests__/settings-parity.test.ts | 8 +++ packages/core/src/settings-schema.ts | 5 ++ packages/core/src/types.ts | 5 ++ .../__tests__/SettingsModal.general.test.tsx | 18 +++++ .../settings/sections/GeneralSection.tsx | 9 +++ .../dashboard/app/hooks/__tests__/useChat.test.ts | 65 +++++++++++++++++ packages/dashboard/app/hooks/useChat.ts | 22 ++++-- .../dashboard/src/__tests__/chat-routes.test.ts | 82 +++++++++++++++++++++- .../dashboard/src/routes/register-chat-routes.ts | 13 +++- 11 files changed, 227 insertions(+), 9 deletions(-) Fusion-Task-Id: FN-7364 Fusion-Task-Lineage: 79a0706c-ba7f-4417-b88b-c5282ae7877c Co-authored-by: Fusion (runfusion.ai) --- .changeset/fn-7364-task-chat-feed-setting.md | 7 ++ docs/dashboard-guide.md | 2 + .../src/__tests__/settings-parity.test.ts | 8 ++ packages/core/src/settings-schema.ts | 5 ++ packages/core/src/types.ts | 5 ++ .../__tests__/SettingsModal.general.test.tsx | 18 ++++ .../settings/sections/GeneralSection.tsx | 9 ++ .../app/hooks/__tests__/useChat.test.ts | 65 +++++++++++++++ packages/dashboard/app/hooks/useChat.ts | 22 +++-- .../src/__tests__/chat-routes.test.ts | 82 ++++++++++++++++++- .../src/routes/register-chat-routes.ts | 13 ++- 11 files changed, 227 insertions(+), 9 deletions(-) create mode 100644 .changeset/fn-7364-task-chat-feed-setting.md diff --git a/.changeset/fn-7364-task-chat-feed-setting.md b/.changeset/fn-7364-task-chat-feed-setting.md new file mode 100644 index 0000000000..911258fe63 --- /dev/null +++ b/.changeset/fn-7364-task-chat-feed-setting.md @@ -0,0 +1,7 @@ +--- +"@runfusion/fusion": patch +--- + +summary: Hide task planner chats from the common Chat feed unless enabled in Settings. +category: fix +dev: Adds project setting `showTaskChatsInCommonFeed` and filters task-planner sessions in chat list APIs/client refresh. diff --git a/docs/dashboard-guide.md b/docs/dashboard-guide.md index bbe96f3857..e07cf5cfa1 100644 --- a/docs/dashboard-guide.md +++ b/docs/dashboard-guide.md @@ -403,6 +403,8 @@ Chat view provides project-scoped conversations with agents. - On mobile direct-chat threads, entering a thread and restoring Chat after tab/page visibility returns re-anchors to the newest message (`scrollTop = scrollHeight`) so the view always opens at the live tail. - On mobile direct-chat threads, tapping the active title/identity in the thread header opens a lightweight conversation dropdown so you can switch to another direct session or start a New Chat without backing out to the sidebar list first; long conversation titles now stay readable in the dropdown via wrapped option text and taller touch-friendly rows. - Direct chat sessions can be renamed from the desktop conversation context menu and from the mobile session switcher; blank rename submissions clear the custom title so the default session label is shown again. + +- Task-detail planner Chat conversations stay available from each task's **Chat** tab. They are hidden from the common Direct/common Chat feed by default; enable **Settings → Project General → Show task chats in common Chat feed** to include populated task chats again. Empty task chat sessions stay hidden either way. - On desktop/tablet Direct chat, the thread header shows an estimated token count against the active model's known context window (for example `~12.3k / 200k`). It is hidden on mobile, narrow floating chat, rooms, and unknown-context-window models. diff --git a/packages/core/src/__tests__/settings-parity.test.ts b/packages/core/src/__tests__/settings-parity.test.ts index 9faee3587a..801abaedb6 100644 --- a/packages/core/src/__tests__/settings-parity.test.ts +++ b/packages/core/src/__tests__/settings-parity.test.ts @@ -112,6 +112,14 @@ describe("settings key parity", () => { expect(isGlobalSettingsKey("autoClaimCandidatesInPrompt")).toBe(false); }); + it("defaults task chats out of the common feed and keeps the opt-in project-scoped", () => { + expect(DEFAULT_PROJECT_SETTINGS.showTaskChatsInCommonFeed).toBe(false); + expect(isProjectSettingsKey("showTaskChatsInCommonFeed")).toBe(true); + expect(isGlobalSettingsKey("showTaskChatsInCommonFeed")).toBe(false); + expect(PROJECT_SETTINGS_KEYS).toContain("showTaskChatsInCommonFeed"); + expect(GLOBAL_SETTINGS_KEYS).not.toContain("showTaskChatsInCommonFeed"); + }); + it("defaults chatAutoCleanupDays to off and keeps it project-scoped", () => { expect(DEFAULT_PROJECT_SETTINGS.chatAutoCleanupDays).toBe(0); expect(isProjectSettingsKey("chatAutoCleanupDays")).toBe(true); diff --git a/packages/core/src/settings-schema.ts b/packages/core/src/settings-schema.ts index 9831ed2499..c3c992f03e 100644 --- a/packages/core/src/settings-schema.ts +++ b/packages/core/src/settings-schema.ts @@ -546,6 +546,11 @@ export const DEFAULT_PROJECT_SETTINGS = { */ quickChatCloseOnOutsideClick: true, showQuickChatFAB: false, + /* + FNXC:ChatModal 2026-07-01-00:00: + Task-scoped planner chats stay available from each task's Chat tab, but the common Chat feed hides them by default. This project-level opt-in preserves the previous populated-task-chat feed behavior only for operators who request it. + */ + showTaskChatsInCommonFeed: false, chatAutoCleanupDays: 0, mailAutoCleanupDays: 0, operationalLogRetentionDays: 30, diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 510ef05e65..6997a7d093 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -4431,6 +4431,11 @@ export interface ProjectSettings { quickChatCloseOnOutsideClick?: boolean; /** Legacy Quick Chat FAB toggle. Prefer quickChatButtonMode for new callers. */ showQuickChatFAB?: boolean; + /** + * FNXC:ChatModal 2026-07-01-00:00: + * Task planner sessions (`task-planner:`) are hidden from the common Chat feed by default to keep task-detail planning conversations out of Direct chat clutter. Operators can opt back into the previous shared-feed behavior with this project setting. + */ + showTaskChatsInCommonFeed?: boolean; /** Number of days of chat inactivity before old chat sessions/rooms are auto-cleaned. * Allowed values: 0 (off, default), 7, 14, 30, 60, 90. Uses updatedAt inactivity age. */ chatAutoCleanupDays?: number; diff --git a/packages/dashboard/app/components/__tests__/SettingsModal.general.test.tsx b/packages/dashboard/app/components/__tests__/SettingsModal.general.test.tsx index b87436242e..a48aba47f6 100644 --- a/packages/dashboard/app/components/__tests__/SettingsModal.general.test.tsx +++ b/packages/dashboard/app/components/__tests__/SettingsModal.general.test.tsx @@ -729,6 +729,15 @@ describe("SettingsModal", () => { expect(onQuickChatButtonModeChange).toHaveBeenCalledWith("footer"); }); + it("defaults task chats common-feed opt-in to unchecked", async () => { + renderModal({ initialSection: "general" }); + await waitForSettingsModalReady(); + + const toggle = screen.getByLabelText("Show task chats in common Chat feed") as HTMLInputElement; + expect(toggle).toBeInTheDocument(); + expect(toggle.checked).toBe(false); + }); + it.each([ { section: "Project General", @@ -754,6 +763,14 @@ describe("SettingsModal", () => { scope: "project", expectedKey: "quickChatCloseOnOutsideClick", }, + { + section: "Project General", + label: "Show task chats in common Chat feed", + kind: "checkbox", + value: true, + scope: "project", + expectedKey: "showTaskChatsInCommonFeed", + }, { section: "Project General", label: "Operational log retention", @@ -824,6 +841,7 @@ describe("SettingsModal", () => { const ephemeralToggle = screen.getByLabelText("Use ephemeral task-worker agents") as HTMLInputElement; expect(ephemeralToggle).toBeInTheDocument(); expect(ephemeralToggle.checked).toBe(true); + expect(screen.getByLabelText("Show task chats in common Chat feed")).toBeInTheDocument(); Object.defineProperty(window, "matchMedia", { writable: true, diff --git a/packages/dashboard/app/components/settings/sections/GeneralSection.tsx b/packages/dashboard/app/components/settings/sections/GeneralSection.tsx index f546b9eebc..ccf1894e32 100644 --- a/packages/dashboard/app/components/settings/sections/GeneralSection.tsx +++ b/packages/dashboard/app/components/settings/sections/GeneralSection.tsx @@ -152,6 +152,15 @@ export function GeneralSection({ scopeBanner, form, setForm, projectId, addToast {t("settings.general.quickChatCloseOnOutsideClickHint", "When enabled, clicking outside the Quick Chat window closes it. Disable to keep it open until you close it explicitly.")}

{t("settings.general.chatHistory", "Chat history")}

+ {/* + FNXC:ChatModal 2026-07-01-00:00: + Users asked for task-planner chats to stop cluttering the common Direct feed without forcing a new Direct/Rooms/Tasks tab split. Keep the default hidden and expose this project opt-in for operators who want the previous shared-feed behavior. + */} +
+ + {t("settings.general.showTaskChatsInCommonFeedHint", "When enabled, populated task-detail Chat conversations appear in the common Direct feed. Empty task chats stay hidden.")} +