Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(home): preserve reply sender after document mentions (#8594)

gbirman8b035c44bb82
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index ab018ff786..08c08e60a6 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -116,6 +116,7 @@ ownership. Cancel, logout, and the ten-minute timeout retire pending callbacks.
uncertain enqueues. See `docs/graphql-normalized-cache-plan.md`.
- Mobile dock customization shares the navigation island’s measured capacity; persist ordering per user with `mobile-dock-order.ts`, preserve gated destinations, and keep Search and More fixed. Reorder handles drag without a hold delay; the rest of each row scrolls.
- Share sidebar and mobile dock unread presence through `components/app/use-navigation-unread.ts`; keep badges reactive to read/done changes, guard all query data with `queryReadyGate` so pending preferences or paused queries cannot suspend the shell, and avoid fetching extra pages for counts.
+- Name Home thread rows from their latest scoped notification, including document mentions and reactions; use the thread author only when no notification exists.
- Mobile dock search owns transient category/mode state in `features/command/mobile`; reuse the shared entity source and explicit full-text adapter rather than overlaying the dock query on view tabs or saved facets. See `docs/agent-guide/search.md` at the repository root.
- Include known Macro users in typed All/People name searches without requiring a DM or CRM contact; resolve a matching person to their existing one-to-one DM while preserving name/email matching.
- Key mobile name-result history ordering and scroll anchors by the other participant for one-to-one DMs, preserving a person's position when their conversation is created; keep group DMs keyed by channel.
diff --git a/apps/web/src/features/home/components/HomeListEntity.tsx b/apps/web/src/features/home/components/HomeListEntity.tsx
index f29da0f668..ba54806684 100644
--- a/apps/web/src/features/home/components/HomeListEntity.tsx
+++ b/apps/web/src/features/home/components/HomeListEntity.tsx
@@ -147,14 +147,16 @@ function HomeThreadTitle(
const entity = props.entity;
if (entity.type !== 'channel_thread') return undefined;
const notification = entity.notifications?.()?.[0];
- if (
- notification?.notification_metadata?.tag === 'channel_message_reply' ||
- notification?.notification_metadata?.tag === 'channel_mention'
- ) {
+ if (notification) {
+ // The row's scoped notifications also include document mentions and
+ // reactions; none should fall back to the thread's original author.
+ const content = notification.notification_metadata.content;
return {
id: notification.sender_id,
displayName:
- notification.notification_metadata.content.senderDisplayName,
+ 'senderDisplayName' in content
+ ? content.senderDisplayName
+ : undefined,
details: undefined,
};
}
diff --git a/apps/web/src/features/home/components/home-press.test.tsx b/apps/web/src/features/home/components/home-press.test.tsx
index bb9e72b925..f810429428 100644
--- a/apps/web/src/features/home/components/home-press.test.tsx
+++ b/apps/web/src/features/home/components/home-press.test.tsx
@@ -11,7 +11,11 @@ vi.mock('@app/features/agents-view/views/AgentSessionListItem', () => ({
vi.mock('@core/context/user', () => ({ useUserId: () => () => 'test-user' }));
vi.mock('@core/user', () => ({
getDisplayName: (id: string) =>
- id === 'macro|[email protected]' ? 'Teo' : 'Peter',
+ id === 'macro|[email protected]'
+ ? 'Teo'
+ : id === 'macro|[email protected]'
+ ? 'Eric'
+ : 'Peter',
tryMacroId: (id: string) => id,
}));
vi.mock('@components/app/split-panel', () => ({
@@ -61,19 +65,22 @@ describe('Home channel reply row', () => {
},
});
- const renderThread = (initial: UnifiedNotification[] = []) => {
+ const renderThread = (
+ initial: UnifiedNotification[] = [],
+ senderId = 'macro|[email protected]'
+ ) => {
const [notifications, setNotifications] = createSignal(initial);
const entity: WithNotification<ChannelThreadEntity> = {
type: 'channel_thread',
id: 'root',
name: 'bug-reports',
- ownerId: 'macro|[email protected]',
+ ownerId: senderId,
channelId: 'bug-reports',
channelType: 'private',
messageId: 'root',
threadId: 'root',
- senderId: 'macro|[email protected]',
- sender: { id: 'macro|[email protected]', type: 'user' },
+ senderId,
+ sender: { id: senderId, type: 'user' },
content: 'calendar invite has raw html',
attachments: [],
reactions: [],
@@ -143,6 +150,47 @@ describe('Home channel reply row', () => {
expect(renderThread().row.textContent).toContain('Peter in #bug-reports');
});
+ it('keeps the reply sender when the same message also mentions a document', () => {
+ const reply = replyNotification('macro|[email protected]');
+ const { row, setNotifications } = renderThread([reply], 'test-user');
+ expect(row.textContent).toContain('Eric in #bug-reports');
+
+ const documentMention: UnifiedNotification = {
+ ...reply,
+ id: 'document-mention',
+ created_at: '2026-10-01T16:34:48.028Z',
+ updated_at: '2026-10-01T16:34:48.028Z',
+ notification_event_type: 'document_mention',
+ notification_metadata: {
+ tag: 'document_mention',
+ content: {
+ messageId: 'reply',
+ messageContent: 'Reply with a document mention',
+ threadId: 'root',
+ channelType: 'private',
+ documentName: 'Owners',
+ owner: 'macro|[email protected]',
+ fileType: 'md',
+ subType: null,
+ senderDisplayName: null,
+ },
+ },
+ };
+ setNotifications([documentMention, reply]);
+ expect(row.textContent).toContain('Eric in #bug-reports');
+ expect(row.textContent).not.toContain('You in');
+
+ setNotifications([{ ...documentMention, state: 'done' }, reply]);
+ expect(row.textContent).toContain('Eric in #bug-reports');
+
+ setNotifications([
+ replyNotification(null, 'Macro'),
+ documentMention,
+ reply,
+ ]);
+ expect(row.textContent).toContain('Macro in #bug-reports');
+ });
+
it('does not attribute an unnamed bot reply to the thread author', () => {
expect(renderThread([replyNotification(null)]).row.textContent).toContain(
'Someone in #bug-reports'
diff --git a/docs/agent-guide/home.md b/docs/agent-guide/home.md
index 16d71a1b2e..cc42cbeb38 100644
--- a/docs/agent-guide/home.md
+++ b/docs/agent-guide/home.md
@@ -79,7 +79,11 @@ Channel thread replies remain separate Home entries from their parent channel,
using single-line rows and a reply arrow icon on desktop, labeled
with the sender and channel (for example, **Peter in #battlefield**). Replies and
mentions name the latest notification's sender, including bots, even after the
-notification is read. To verify, mention yourself from a second account in a
+notification is read. Document-mention and reaction notifications also name
+their sender, never the thread's original author. Verify a reply containing a
+document chip in your own thread: the row must keep the replier's name when
+the document-mention notification arrives, including after it is marked done.
+To verify user mentions, mention yourself from a second account in a
thread started by someone else: the row must name the mentioner and open their
message. Channel names
prefer the current channel cache, then a matching thread notification's name,