Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(web): revert channel-wide reads without breaking channel opens (#7136)
Sean Aye29490a82b5cb
diff --git a/apps/web/src/features/channels-view/channels-view.test.tsx b/apps/web/src/features/channels-view/channels-view.test.tsxindex a501117fca..ac3e9018e8 100644--- a/apps/web/src/features/channels-view/channels-view.test.tsx+++ b/apps/web/src/features/channels-view/channels-view.test.tsx@@ -296,11 +296,7 @@ describe('channel selection loading and recovery', () => {setQuery('isFetching', false);});expect(screen.getByTestId('channel-detail').textContent).toBe('one');- expect(mocks.markRead).toHaveBeenCalledExactlyOnceWith(- expect.objectContaining({ id: 'one' }),- expect.anything(),- { scopeChannelThreads: false }- );+ expect(mocks.markRead).toHaveBeenCalledOnce();});it('never marks cached data while a reopened selection is refreshing', async () => {diff --git a/apps/web/src/features/channels-view/channels-view.tsx b/apps/web/src/features/channels-view/channels-view.tsxindex fb3eb1a6d4..8611d8fea4 100644--- a/apps/web/src/features/channels-view/channels-view.tsx+++ b/apps/web/src/features/channels-view/channels-view.tsx@@ -267,9 +267,7 @@ function ChannelDetailRouteContent() {on(readyId, () => {const channel = hydrated();if (channel && channel.isParticipant !== false)- markChannelNotificationsSeenOnOpen(channel, notificationSource, {- scopeChannelThreads: false,- });+ markChannelNotificationsSeenOnOpen(channel, notificationSource);}));diff --git a/apps/web/src/features/channels-view/components/ChannelDetailView.test.tsx b/apps/web/src/features/channels-view/components/ChannelDetailView.test.tsxindex 46582b5485..601737c8c0 100644--- a/apps/web/src/features/channels-view/components/ChannelDetailView.test.tsx+++ b/apps/web/src/features/channels-view/components/ChannelDetailView.test.tsx@@ -59,12 +59,10 @@ beforeEach(() => {afterEach(cleanup);describe('Chat detail navigation', () => {- it('requests a channel-wide target for unstamped route and favorite selections', () => {+ it('requests a thread-scoped target for unstamped route and favorite selections', () => {render(() => <ChannelDetailView channel={channel} />);- expect(mocks.getTarget).toHaveBeenCalledExactlyOnceWith(channel, {- scopeChannelThreads: false,- });+ expect(mocks.getTarget).toHaveBeenCalledExactlyOnceWith(channel);expect(screen.getByTestId('target').textContent).toBe(JSON.stringify(replyTarget));@@ -93,8 +91,7 @@ describe('Chat detail navigation', () => {setSelected({ ...channel, target: explicit });expect(mocks.getTarget).toHaveBeenLastCalledWith(- expect.objectContaining({ target: explicit }),- { scopeChannelThreads: false }+ expect.objectContaining({ target: explicit }));expect(screen.getByTestId('target').textContent).toBe(JSON.stringify(target)diff --git a/apps/web/src/features/channels-view/components/ChannelDetailView.tsx b/apps/web/src/features/channels-view/components/ChannelDetailView.tsxindex 6d86a12aae..30502a780c 100644--- a/apps/web/src/features/channels-view/components/ChannelDetailView.tsx+++ b/apps/web/src/features/channels-view/components/ChannelDetailView.tsx@@ -34,9 +34,7 @@ export function ChannelDetailView(props: { channel: ChannelEntity }) {}`;if (lastTargetKey !== undefined && key === lastTargetKey) return previous;lastTargetKey = key;- const clickTarget = getChannelEntityTarget(props.channel, {- scopeChannelThreads: false,- });+ const clickTarget = getChannelEntityTarget(props.channel);if (!clickTarget) return undefined;return clickTarget.kind === 'latest'? { kind: 'latest' }diff --git a/apps/web/src/features/channels-view/components/ChannelsMobileView.test.tsx b/apps/web/src/features/channels-view/components/ChannelsMobileView.test.tsxnew file mode 100644index 0000000000..ee7a333af8--- /dev/null+++ b/apps/web/src/features/channels-view/components/ChannelsMobileView.test.tsx@@ -0,0 +1,188 @@+import type { ChannelEntity } from '@entity/types/entity';+import type {+ Notification,+ WithNotification,+} from '@entity/types/notification';+import {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from '@solidjs/testing-library';+import { For, type JSX } from 'solid-js';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import type { ChannelsDataSource } from '../queries';+import type { ChannelsQueryScope } from '../types';++const mocks = vi.hoisted(() => ({+ pass: (props: { children?: JSX.Element }) => props.children,+ hydrate:+ vi.fn<+ typeof import('@queries/channel/notification-selection').hydrateChannelNotificationSelection+ >(),+ openSplit:+ vi.fn<+ typeof import('@app/features/next-soup/utils').openEntityInSplitFromUnifiedList+ >(),+ source: {+ withLocalOverrides: (notification: Notification) => notification,+ mutedEntities: () => [],+ },+ handle: {},+}));+vi.mock('@app/components/list', () => ({ createListController: () => ({}) }));+vi.mock('@app/features/next-soup/actions', () => ({+ toEntityActionListState: () => ({}),+}));+vi.mock('@app/features/next-soup/utils', () => ({+ openEntityInSplitFromUnifiedList: mocks.openSplit,+}));+vi.mock('@app/features/soup', () => ({ SoupEntityContextMenu: mocks.pass }));+vi.mock('@app/lib/debugSettings', () => ({+ DEBUG_SETTING_KEYS: {},+ useDebugSetting: () => () => false,+}));+vi.mock('@components/app/GlobalAppState', () => ({+ useGlobalNotificationSource: () => mocks.source,+}));+vi.mock('@components/app/mobile/PillTabs', () => ({ PillTabs: () => null }));+vi.mock('@components/app/mobile/PullToRefresh', () => ({+ PullToRefresh: () => null,+}));+vi.mock('@components/app/split-layout/components/SplitHeader', () => ({+ SplitHeaderLeft: mocks.pass,+}));+vi.mock('@components/app/split-layout/layoutUtils', () => ({+ useSplitPanelOrThrow: () => ({ handle: mocks.handle }),+}));+vi.mock('@core/component/Toast/Toast', () => ({ toast: { failure: vi.fn() } }));+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'viewer' }));+vi.mock('@entity/utils/notification', () => ({ isMutedItem: () => false }));+vi.mock('@queries/channel/notification-selection', () => ({+ hydrateChannelNotificationSelection: mocks.hydrate,+}));+vi.mock('@solid-primitives/resize-observer', () => ({+ createElementSize: () => ({ height: 0 }),+}));+vi.mock('@ui', () => ({ Button: () => null, EmptyStatePanel: () => null }));+vi.mock('virtua/solid', () => ({+ Virtualizer: (props: {+ data: ChannelEntity[];+ children: (channel: ChannelEntity) => JSX.Element;+ }) => <For each={props.data}>{props.children}</For>,+}));+vi.mock('./ChannelsEmptyState', () => ({ ChannelsEmptyState: () => null }));+vi.mock('./rail/ChannelRailItems', () => ({+ CHANNEL_ACTION_VIEW_CONTEXT: {},+ CONVERSATION_CARD_HEIGHT: 80,+ ConversationCard: (props: {+ channel: ChannelEntity;+ onActivate: () => void;+ }) => <button onClick={props.onActivate}>{props.channel.name}</button>,+}));+vi.mock('./rail/hooks/useChannelCalls', () => ({+ useChannelCalls: () => ({}),+}));+vi.mock('./rail/hooks/useChannelRailActivity', () => ({+ useChannelRailActivity: () => ({+ unreadChannelIds: () => new Set(['one']),+ callStatuses: () => new Map(),+ incomingCallIds: () => new Map(),+ }),+}));++import { ChannelsMobileView } from './ChannelsMobileView';++const channel: ChannelEntity = {+ id: 'one',+ type: 'channel',+ name: 'One',+ ownerId: 'viewer',+ channelType: 'private',+ isParticipant: true,+ unreadNotifications: [+ { id: 'reply-notification', state: 'unseen', createdAt: '2026-01-01' },+ ],+};+const hydrated: WithNotification<ChannelEntity> = {+ ...channel,+ unreadNotifications: undefined,+ notifications: () => [+ {+ id: 'reply-notification',+ entity_id: channel.id,+ entity_type: 'channel',+ notification_event_type: 'channel_message_reply',+ notification_metadata: {+ tag: 'channel_message_reply',+ content: {+ messageId: 'reply',+ messageContent: 'Unread reply',+ threadId: 'root',+ channelType: 'private',+ },+ },+ sent: true,+ state: 'unseen',+ created_at: '2026-01-01',+ updated_at: '2026-01-01',+ },+ ],+};+const source: ChannelsDataSource = {+ items: () => [channel],+ isLoading: () => false,+ isFetching: () => false,+ error: () => undefined,+ hasMore: () => false,+ isLoadingMore: () => false,+ loadMore: async () => {},+ refresh: async () => {},+};++beforeEach(() => {+ vi.clearAllMocks();+ HTMLElement.prototype.scrollTo = vi.fn();+});+afterEach(cleanup);++describe('mobile channel activation', () => {+ it.each<ChannelsQueryScope>(['recents', 'channels', 'direct_messages'])(+ 'hydrates and includes unread reply targets when opening from %s',+ async (tab) => {+ let resolve!: (channel: WithNotification<ChannelEntity>) => void;+ mocks.hydrate.mockReturnValueOnce(+ new Promise((done) => {+ resolve = done;+ })+ );+ render(() => (+ <ChannelsMobileView+ source={source}+ searchQuery=""+ onClearSearch={() => {}}+ tab={tab}+ onTabChange={() => {}}+ />+ ));++ fireEvent.click(screen.getByRole('button', { name: 'One' }));+ expect(mocks.hydrate).toHaveBeenCalledExactlyOnceWith(+ channel,+ mocks.source.withLocalOverrides+ );+ expect(mocks.openSplit).not.toHaveBeenCalled();+ resolve(hydrated);++ await waitFor(() =>+ expect(mocks.openSplit).toHaveBeenCalledExactlyOnceWith(hydrated, {+ splitHandle: mocks.handle,+ referredFrom: 'channels',+ notificationSource: mocks.source,+ scopeChannelThreads: false,+ })+ );+ }+ );+});diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsxindex cebc77fa5f..b7af46eb19 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.test.tsx@@ -208,27 +208,18 @@ beforeEach(() => {});afterEach(cleanup);-describe('explicit channel activation read marking', () => {- it('marks the full channel on every accepted click, including the already-selected route', async () => {+describe('explicit channel activation', () => {+ it('navigates on repeated clicks without marking notifications in the rail', async () => {mocks.selected = { type: 'channel', id: channel.id };mount();fireEvent.click(screen.getByRole('button'));- await waitFor(() =>- expect(mocks.markRead).toHaveBeenCalledExactlyOnceWith(- hydrated,- mocks.source,- { scopeChannelThreads: false }- )- );- expect(mocks.navigate).toHaveBeenCalledOnce();+ await waitFor(() => expect(mocks.navigate).toHaveBeenCalledOnce());const refreshed = { ...hydrated, notifications: () => [] };mocks.hydrate.mockReturnValue(refreshed);fireEvent.click(screen.getByRole('button'));- await waitFor(() => expect(mocks.markRead).toHaveBeenCalledTimes(2));- expect(mocks.markRead).toHaveBeenLastCalledWith(refreshed, mocks.source, {- scopeChannelThreads: false,- });- expect(mocks.navigate).toHaveBeenCalledTimes(2);+ await waitFor(() => expect(mocks.navigate).toHaveBeenCalledTimes(2));+ expect(mocks.select).toHaveBeenCalledTimes(2);+ expect(mocks.markRead).not.toHaveBeenCalled();});it('awaits native async hydration when telemetry replaces the global Promise constructor', async () => {@@ -249,11 +240,10 @@ describe('explicit channel activation read marking', () => {expect(mocks.markRead).not.toHaveBeenCalled();resolve(hydrated);await waitFor(() =>- expect(mocks.markRead).toHaveBeenCalledExactlyOnceWith(- hydrated,- mocks.source,- { scopeChannelThreads: false }- )+ expect(mocks.select).toHaveBeenCalledExactlyOnceWith({+ type: 'channel',+ id: channel.id,+ }));} finally {resolve(hydrated);@@ -273,27 +263,40 @@ describe('explicit channel activation read marking', () => {expect(mocks.markRead).not.toHaveBeenCalled();});- it('does not mark a superseded hydration; only the latest click is accepted', async () => {+ it.each([false, true])(+ 'ignores superseded hydration (shift-click: %s)',+ async (shiftKey) => {+ let resolve!: (channel: WithNotification<ChannelEntity>) => void;+ mocks.hydrate.mockReturnValueOnce(+ new Promise((value) => {+ resolve = value;+ })+ );+ mount();+ fireEvent.click(screen.getByRole('button'), { shiftKey });+ expect(mocks.select).not.toHaveBeenCalled();+ expect(mocks.openSplit).not.toHaveBeenCalled();+ fireEvent.click(screen.getByRole('button'));+ await waitFor(() => expect(mocks.select).toHaveBeenCalledOnce());+ resolve(hydrated);+ await Promise.resolve();+ expect(mocks.select).toHaveBeenCalledOnce();+ expect(mocks.openSplit).not.toHaveBeenCalled();+ expect(mocks.markRead).not.toHaveBeenCalled();+ }+ );++ it('hydrates shift-clicks and includes unread replies in split navigation targets', async () => {let resolve!: (channel: WithNotification<ChannelEntity>) => void;mocks.hydrate.mockReturnValueOnce(- new Promise((value) => {- resolve = value;+ new Promise((done) => {+ resolve = done;}));- mount();- fireEvent.click(screen.getByRole('button'));- expect(mocks.markRead).not.toHaveBeenCalled();- fireEvent.click(screen.getByRole('button'));- await waitFor(() => expect(mocks.markRead).toHaveBeenCalledOnce());- resolve(hydrated);- await Promise.resolve();- expect(mocks.select).toHaveBeenCalledOnce();- expect(mocks.markRead).toHaveBeenCalledOnce();- });-- it('hydrates shift-clicks and requests channel-wide marking in the split-open path', async () => {mount();fireEvent.click(screen.getByRole('button'), { shiftKey: true });+ expect(mocks.openSplit).not.toHaveBeenCalled();+ resolve(hydrated);await waitFor(() =>expect(mocks.openSplit).toHaveBeenCalledExactlyOnceWith(hydrated, {openInNewSplit: true,@@ -305,17 +308,21 @@ describe('explicit channel activation read marking', () => {expect(mocks.select).not.toHaveBeenCalled();});- it('reports hydration failures without marking or selecting a partial edge', async () => {- const log = vi.spyOn(console, 'error').mockImplementation(() => {});- mocks.hydrate.mockRejectedValueOnce(new Error('failed'));- try {- mount();- fireEvent.click(screen.getByRole('button'));- await waitFor(() => expect(mocks.failure).toHaveBeenCalledOnce());- expect(mocks.markRead).not.toHaveBeenCalled();- expect(mocks.select).not.toHaveBeenCalled();- } finally {- log.mockRestore();+ it.each([false, true])(+ 'reports hydration failures without opening a partial edge (shift-click: %s)',+ async (shiftKey) => {+ const log = vi.spyOn(console, 'error').mockImplementation(() => {});+ mocks.hydrate.mockRejectedValueOnce(new Error('failed'));+ try {+ mount();+ fireEvent.click(screen.getByRole('button'), { shiftKey });+ await waitFor(() => expect(mocks.failure).toHaveBeenCalledOnce());+ expect(mocks.markRead).not.toHaveBeenCalled();+ expect(mocks.select).not.toHaveBeenCalled();+ expect(mocks.openSplit).not.toHaveBeenCalled();+ } finally {+ log.mockRestore();+ }}- });+ );});diff --git a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsxindex 289c02ce55..13e2ae6825 100644--- a/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx+++ b/apps/web/src/features/channels-view/components/rail/ChannelsRail.tsx@@ -12,7 +12,6 @@ import {type ChannelPreviewSelection,channelPreviewSelection,getChannelEntityTarget,- markChannelNotificationsSeenOnOpen,navigateChannelEntityToTarget,openEntityInSplitFromUnifiedList,} from '@app/features/next-soup/utils';@@ -178,13 +177,6 @@ export function ChannelsRail(props: ChannelsRailProps) {});const previous = selectedChannel();if (!setSelectedChannel(selection)) return;- // Mark on every accepted activation, including re-clicks of the same- // route. The detail's ready-id effect only handles initial/route opens.- if (channel.isParticipant !== false) {- markChannelNotificationsSeenOnOpen(entity, notificationSource, {- scopeChannelThreads: false,- });- }// Repeated clicks must navigate even when the route stays the same.if (previous?.id === selection.id &&diff --git a/apps/web/src/features/next-soup/utils.test.ts b/apps/web/src/features/next-soup/utils.test.tsindex c09f445b09..dfe51eda27 100644--- a/apps/web/src/features/next-soup/utils.test.ts+++ b/apps/web/src/features/next-soup/utils.test.ts@@ -1038,7 +1038,7 @@ describe('getChannelEntityTarget', () => {});it.each(['channel_mention', 'channel_message_reply'] as const)(- 'marks %s when Chat opens the whole channel without reading the global feed',+ 'leaves thread %s unread when Chat opens the parent channel without reading the global feed',(tag) => {const notification = {...sendNotification('thread-notification', 'message'),@@ -1055,16 +1055,16 @@ describe('getChannelEntityTarget', () => {{...notificationSourceWithBulkMarkAsRead(bulkMarkAsRead),notificationsByEntity,- },- { scopeChannelThreads: false }+ });- expect(bulkMarkAsRead).toHaveBeenCalledExactlyOnceWith([notification]);+ expect(bulkMarkAsRead).not.toHaveBeenCalled();expect(notificationsByEntity).not.toHaveBeenCalled();});- it('marks mixed channel notifications on repeated Chat opens, skipping local reads', () => {- const send = sendNotification('send', 'root');+ it('marks unstacked notifications on repeated Chat opens, skipping thread stacks and local reads', () => {+ const send = sendNotification('send', 'top-level');+ const root = sendNotification('root', 'root');const reply = replyNotification('reply', 'reply-message', 'root');const mention = {...sendNotification('mention', 'mentioned-message'),@@ -1090,21 +1090,19 @@ describe('getChannelEntityTarget', () => {withLocalOverrides: (notification) =>readIds.has(notification.id) ? asRead(notification) : notification,};- const notifications = [send, reply, mention, read, done];+ const notifications = [send, root, reply, mention, read, done];const channel = channelRow({ notifications });- const open = () =>- markChannelNotificationsSeenOnOpen(channel, source, {- scopeChannelThreads: false,- });+ const open = () => markChannelNotificationsSeenOnOpen(channel, source);open();- expect(bulkMarkAsRead).toHaveBeenCalledExactlyOnceWith([- send,- reply,- mention,- ]);+ expect(bulkMarkAsRead).toHaveBeenCalledExactlyOnceWith([send]);open();expect(bulkMarkAsRead).toHaveBeenCalledTimes(1);- const incoming = replyNotification('incoming', 'new-reply', 'root');+ notifications.push(+ replyNotification('incoming-reply', 'new-reply', 'root')+ );+ open();+ expect(bulkMarkAsRead).toHaveBeenCalledTimes(1);+ const incoming = sendNotification('incoming', 'new-message');notifications.push(incoming);open();expect(bulkMarkAsRead).toHaveBeenCalledTimes(2);@@ -1144,6 +1142,34 @@ describe('getChannelEntityTarget', () => {expect(bulkMarkAsRead).toHaveBeenCalledWith([notification]);});+ it('preserves the non-member guard after mobile selection hydration', async () => {+ const notification = sendNotification('non-member-unread', 'message');+ fetchChannelNotifications.mockResolvedValueOnce([notification]);+ const openWithSplit = vi.fn(() => ({ status: 'opened' }));+ setGlobalSplitManager({ openWithSplit } as unknown as SplitManager);+ const bulkMarkAsRead = vi.fn(async () => {});+ const channel = await hydrateChannelNotificationSelection({+ type: 'channel',+ id: 'channel-1',+ name: 'Join-only channel',+ ownerId: 'owner',+ channelType: 'team',+ isParticipant: false,+ unreadNotifications: [+ { id: notification.id, state: 'unseen', createdAt: '2026-01-01' },+ ],+ });++ await openEntityInSplitFromUnifiedList(channel, {+ referredFrom: 'channels',+ notificationSource: notificationSourceWithBulkMarkAsRead(bulkMarkAsRead),+ });++ expect(fetchChannelNotifications).toHaveBeenCalledOnce();+ expect(openWithSplit).not.toHaveBeenCalled();+ expect(bulkMarkAsRead).not.toHaveBeenCalled();+ });+it('keeps an explicit channel search target without navigating to latest', async () => {const getBlockHandle = vi.fn(async () => undefined);const openWithSplit = vi.fn(() => ({ status: 'navigating' }));@@ -1188,7 +1214,7 @@ describe('getChannelEntityTarget', () => {}))))(- 'only marks the whole GraphQL channel after a successful Chat open (new split=$openInNewSplit, status=$status)',+ 'only marks top-level GraphQL notifications after a successful Chat open (new split=$openInNewSplit, status=$status)',async ({ openInNewSplit, status }) => {const unread = sendNotification('mobile-unread', 'message');const read = asRead(sendNotification('mobile-read', 'read-message'));@@ -1226,12 +1252,16 @@ describe('getChannelEntityTarget', () => {if (status === 'unavailable' || status === 'navigating') {expect(bulkMarkAsRead).not.toHaveBeenCalled();} else {- expect(bulkMarkAsRead).toHaveBeenCalledExactlyOnceWith([unread, reply]);+ expect(bulkMarkAsRead).toHaveBeenCalledExactlyOnceWith([unread]);+ expect(openWithSplit.mock.invocationCallOrder[0]).toBeLessThan(+ bulkMarkAsRead.mock.invocationCallOrder[0]+ );}});- it('marks routed channel notifications only after the destination is applied', async () => {+ it('marks only top-level routed channel notifications after the destination is applied', async () => {+ const unread = sendNotification('deferred-send', 'message');const reply = replyNotification('deferred', 'reply-message', 'root');const bulkMarkAsRead = vi.fn(async () => {});let onApplied: (() => void) | undefined;@@ -1247,7 +1277,7 @@ describe('getChannelEntityTarget', () => {} as unknown as SplitManager);await openEntityInSplitFromUnifiedList(- channelRow({ notifications: [reply] }),+ channelRow({ notifications: [unread, reply] }),{notificationSource:notificationSourceWithBulkMarkAsRead(bulkMarkAsRead),@@ -1257,10 +1287,10 @@ describe('getChannelEntityTarget', () => {expect(bulkMarkAsRead).not.toHaveBeenCalled();expect(onApplied).toBeDefined();onApplied!();- expect(bulkMarkAsRead).toHaveBeenCalledExactlyOnceWith([reply]);+ expect(bulkMarkAsRead).toHaveBeenCalledExactlyOnceWith([unread]);});- it('chooses the unread reply target before marking a Chat conversation read', async () => {+ it('keeps the unread reply target without marking the thread read on a Chat open', async () => {const reply = replyNotification('reply-target', 'reply-message', 'root');const openWithSplit = vi.fn(() => ({ status: 'opened' }));setGlobalSplitManager({@@ -1286,7 +1316,8 @@ describe('getChannelEntityTarget', () => {messageId: ['reply-message'],threadId: ['root'],});- expect(bulkMarkAsRead).toHaveBeenCalledExactlyOnceWith([reply]);+ expect(bulkMarkAsRead).not.toHaveBeenCalled();+ expect(reply.state).toBe('unseen');});it('uses the global source for channels without an attached notification edge', () => {@@ -1333,39 +1364,54 @@ describe('getChannelEntityTarget', () => {expect(bulkMarkAsRead).not.toHaveBeenCalled();});- it('does not mark a thread-stack notification when opening its parent channel row', async () => {- const parentNotification = sendNotification('parent-send', 'message');- const threadNotification = replyNotification(- 'thread-reply',- 'reply',- 'thread-root'- );- setGlobalSplitManager({- activeSplit: vi.fn(),- getOrchestrator: vi.fn(() => ({- getBlockHandle: vi.fn(async () => undefined),- })),- getSplitByContent: vi.fn(),- findOpenView: vi.fn(),- openWithSplit: vi.fn(() => ({ status: 'opened' })),- } as unknown as SplitManager);+ it.each([true, false])(+ 'keeps parent-channel reads thread-scoped regardless of target scope (%s)',+ async (scopeChannelThreads) => {+ const parentNotification = {+ ...sendNotification('parent-send', 'message'),+ created_at: '2026-09-23T12:00:00Z',+ };+ const threadNotification = {+ ...replyNotification('thread-reply', 'reply', 'thread-root'),+ created_at: '2026-09-24T12:00:00Z',+ };+ const openWithSplit = vi.fn(() => ({ status: 'opened' }));+ setGlobalSplitManager({+ activeSplit: vi.fn(),+ getOrchestrator: vi.fn(() => ({+ getBlockHandle: vi.fn(async () => undefined),+ })),+ openWithSplit,+ } as unknown as SplitManager);- const bulkMarkAsRead = vi.fn(async () => {});- await openEntityInSplitFromUnifiedList(- channelRow({- notifications: [parentNotification, threadNotification],- }),- {- notificationSource:- notificationSourceWithBulkMarkAsRead(bulkMarkAsRead),- }- );+ const bulkMarkAsRead = vi.fn(async () => {});+ await openEntityInSplitFromUnifiedList(+ channelRow({ notifications: [parentNotification, threadNotification] }),+ {+ openInNewSplit: true,+ scopeChannelThreads,+ notificationSource:+ notificationSourceWithBulkMarkAsRead(bulkMarkAsRead),+ }+ );- expect(bulkMarkAsRead).toHaveBeenCalledWith([parentNotification]);- expect(bulkMarkAsRead).not.toHaveBeenCalledWith(- expect.arrayContaining([threadNotification])- );- });+ expect(openWithSplit).toHaveBeenCalledWith(+ expect.objectContaining({ type: 'channel', id: 'channel-1' }),+ expect.objectContaining({ preferNewSplit: true })+ );+ const search = targetSearch(openWithSplit, 'channels');+ expect(search).toMatchObject({+ messageId: [scopeChannelThreads ? 'message' : 'reply'],+ seek: [expect.any(String)],+ });+ expect(search?.threadId).toEqual(+ scopeChannelThreads ? undefined : ['thread-root']+ );+ expect(bulkMarkAsRead).toHaveBeenCalledExactlyOnceWith([+ parentNotification,+ ]);+ }+ );it('reports failures to mark an attached channel notification read', async () => {const error = new Error('mark failed');diff --git a/apps/web/src/features/next-soup/utils.ts b/apps/web/src/features/next-soup/utils.tsindex c10f102832..b74642e1ea 100644--- a/apps/web/src/features/next-soup/utils.ts+++ b/apps/web/src/features/next-soup/utils.ts@@ -379,7 +379,7 @@ interface OpenEntityOptions {* opening a channel row. Callers that can open channels must provide it.*/notificationSource?: NotificationSource;- /** False for Chat conversations; Inbox rows keep their thread-scoped reads. */+ /** False to target unread replies in Chat; read marking stays thread-scoped. */scopeChannelThreads?: boolean;}@@ -762,9 +762,7 @@ export const openEntityInSplitFromUnifiedList = async (const markNotificationsSeen = () => {if (options.notificationSource) {- markChannelNotificationsSeenOnOpen(entity, options.notificationSource, {- scopeChannelThreads: options.scopeChannelThreads,- });+ markChannelNotificationsSeenOnOpen(entity, options.notificationSource);}};const result = splitManager.openWithSplit(splitContent, {@@ -808,13 +806,11 @@ export const openEntityInSplitFromUnifiedList = async (* array (mobile Channels) or a list accessor. Only rows without an edge fall* back to the separately paginated global source. Passing these notifications* through the source keeps its REST cache and durable seen overrides in sync- * while the configured mutation updates GraphQL edges. Chat opens the whole- * conversation (scopeChannelThreads: false); Inbox opens only the row's stack.+ * while the configured mutation updates GraphQL edges.*/export function markChannelNotificationsSeenOnOpen(entity: EntityWithRawNotifications<EntityData>,- notificationSource: NotificationSource,- options: { scopeChannelThreads?: boolean } = {}+ notificationSource: NotificationSource) {if (entity.type !== 'channel' &&@@ -825,7 +821,7 @@ export function markChannelNotificationsSeenOnOpen(}const notifications = getEntityNotifications(entity, notificationSource, {- scopeChannelThreads: options.scopeChannelThreads !== false,+ scopeChannelThreads: true,}).filter((notification) => !notificationIsRead(notification));if (notifications.length === 0) return;diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.mdindex 29919c13d9..11267badc8 100644--- a/docs/AGENT_GUIDE/channels.md+++ b/docs/AGENT_GUIDE/channels.md@@ -371,7 +371,13 @@ optional `Favorites` section and theindependently paginated `Channels` and `DMs` sections. Favorites appears whenthe user has channel favorites and only lists channels. Channel favorites openin the shared channel detail. Shift-clicking a favorite, channel, or DM opens that-conversation in a new split instead.+conversation in a new split instead. For loaded rows, shift-click refreshes the+notification selection and carries the most recent unread message or reply target+into the split. A read conversation opens at latest. Split opens mark only the+row's thread-scoped notifications, and only after the split is opened or reused.+Deferred navigation waits until the destination is applied; an unavailable split+must leave unread state unchanged. Join-only channels remain+blocked after hydration, including on mobile.### Channel labels@@ -559,25 +565,19 @@ request must not show a load-error message over valid search hits or replace**No results**, including during debounce and short local-only queries. Searchfailures still show their own error; clearing search restores the browse error.With `enable-graphql-soup` enabled, open an unread conversation from each tab-and return to the list: all its message notifications should be read, including-mentions, replies, and ones older than the global notification feed's loaded page.-Chat opens the whole conversation; opening a parent channel row in Inbox still-leaves separate thread-stack notifications unread.+and return to the list: its top-level notifications should be read, including+ones older than the global notification feed's loaded page. Notifications for+separate thread stacks remain unread until that thread is opened. From each mobile+tab, also tap a conversation whose only unread notification is a reply: it should+open that reply, not latest. Navigation uses the full hydrated edge while read+marking remains thread-scoped, matching desktop rail and shift-click opens.On desktop, each click on a conversation in the Chat rail opens its most recentcurrently unread notification, including replies in threads. Read notificationsare not retained as click targets: once a channel has no unreadnotifications, clicking it opens the latest message. Explicit search hits still-open their matched message. Each accepted click marks the complete loaded channel-edge read, even when the same conversation is already selected. Shift-clicks use-the same channel-wide read behavior, but mark notifications only after the split-opens or reuses an existing conversation. Route opens, reloads, and uncached-favorites also target the newest unread notification across the channel,-including thread replies; an explicit message target still wins. Verify repeated-clicks after read-state updates, a failed read, and a new notification; previously-read targets must not loop around. A rejected selection or unavailable split must-not mark the conversation read. Hydrating an unread non-participant row must-preserve its membership status and must not mark its notifications read.+open their matched message. Verify repeated clicks after read-state updates and+after a new notification arrives; previously read targets must not loop around.With GraphQL enabled, the app-shell Chat badge uses `ChannelUnreadPresence`: onlychannel IDs and at most one unread notification ID/state per channel, with a@@ -599,8 +599,7 @@ per channel through an aliased, filtered `notifications` edge. An empty edge meano unread messages; invites and call notifications do not light the dot. Recentcards still use the latest-message preview. Full notification edges load only foran opened unread conversation, so mark-read and message targeting retain their-complete channel-wide inputs in Chat and thread-scoped inputs in Inbox. Reopening-a conversation must refresh that full+complete thread-scoped inputs. Reopening a conversation must refresh that fulledge even within 30 seconds; mark-read waits for the refresh rather than usingolder cached notifications. Failed lookups and successful lookups with no matchingchannel show **Conversation unavailable** with **Retry**, never permanent loading.