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(channels): preserve thread-only conversation targets (#8935)

dev-rb2d1a03dbf27d
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 9816ac8d7a..cf4193f35b 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -213,6 +213,7 @@ ownership. Cancel, logout, and the ten-minute timeout retire pending callbacks.
- 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. Document rows whose newest outstanding notification is a comment, and calendar event rows whose newest is a join request, say who did it (`row-notification.ts`).
- Use `ChannelTitleIcon` for conversation breadcrumbs so DMs retain participant or agent avatars and named channels retain their pictures; suppress avatar actions inside breadcrumb buttons.
+- Normalize thread-only conversation URLs in `channelsSearch` before Home, Chat, or touch views derive their message target.
- 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/channels-view/channels-route.ts b/apps/web/src/features/channels-view/channels-route.ts
index 237963ff1a..3c372734ce 100644
--- a/apps/web/src/features/channels-view/channels-route.ts
+++ b/apps/web/src/features/channels-view/channels-route.ts
@@ -4,12 +4,18 @@ import type { ChannelsTab } from './types';
export const channelsSearch = {
namespace: 'channels',
- schema: z.object({
- tab: z.enum(['browse', 'recents', 'threads']),
- messageId: z.string(),
- threadId: z.string(),
- seek: z.string(),
- }),
+ schema: z
+ .object({
+ tab: z.enum(['browse', 'recents', 'threads']),
+ messageId: z.string(),
+ threadId: z.string(),
+ seek: z.string(),
+ })
+ // A thread-only URL targets the root in every conversation host.
+ .transform((value) => ({
+ ...value,
+ messageId: value.messageId || value.threadId,
+ })),
defaults: {
tab: 'browse' as ChannelsTab,
messageId: '',
diff --git a/apps/web/src/features/home/home-route-schema.test.ts b/apps/web/src/features/home/home-route-schema.test.ts
index 9ef190fc4d..9c5094ba65 100644
--- a/apps/web/src/features/home/home-route-schema.test.ts
+++ b/apps/web/src/features/home/home-route-schema.test.ts
@@ -1,4 +1,7 @@
+import { channelsSearchCodec } from '@app/features/channels-view/channels-route';
+import { toChannelTargetRequest } from '@channel/Channel/link';
import { describe, expect, it } from 'vitest';
+import { homePreviewLegacyTarget, homePreviewTarget } from './home-route';
import { homePreviewRouteParams } from './home-route-schema';
describe('home preview route params', () => {
@@ -18,3 +21,35 @@ describe('home preview route params', () => {
).toBe(false);
});
});
+
+describe('Home channel target URLs', () => {
+ it.each([undefined, ['']])(
+ 'opens a thread root when the message parameter is %j',
+ (messageId) => {
+ const decoded = channelsSearchCodec.parse({
+ ...(messageId ? { messageId } : {}),
+ threadId: ['thread-root'],
+ });
+ expect(decoded.valid).toBe(true);
+ const params = {
+ blockType: 'channel' as const,
+ previewId: 'conversation',
+ };
+ const search = { channel: decoded.value, document: { commentId: '' } };
+ const inline = homePreviewTarget(params, search);
+ expect(toChannelTargetRequest({ ...inline.params })).toEqual({
+ kind: 'message',
+ messageId: 'thread-root',
+ threadId: 'thread-root',
+ });
+ expect(homePreviewLegacyTarget(params, search)).toEqual({
+ type: 'channel',
+ id: 'conversation',
+ params: {
+ channel_message_id: 'thread-root',
+ channel_thread_id: 'thread-root',
+ },
+ });
+ }
+ );
+});
diff --git a/docs/agent-guide/channels.md b/docs/agent-guide/channels.md
index 95f5bd0944..e42315403b 100644
--- a/docs/agent-guide/channels.md
+++ b/docs/agent-guide/channels.md
@@ -16,6 +16,11 @@ from their parent channel rather than the message or thread ID.
## Message links
+A channel search namespace with `threadId` and no `messageId` targets the thread
+root. Home, Chat, and the full-screen touch conversation normalize this URL in
+the shared channel search schema; an explicit message continues to target its
+reply within that thread.
+
Bare URLs, common bare domains, and email addresses are clickable in opened
messages, including agent/API messages and older messages. Explicit Markdown
links still use their label. Inline code, code blocks, and escaped URLs stay
diff --git a/docs/agent-guide/home.md b/docs/agent-guide/home.md
index 66ab4c20af..cdacf6599f 100644
--- a/docs/agent-guide/home.md
+++ b/docs/agent-guide/home.md
@@ -92,6 +92,11 @@ message. Channel names
prefer the current channel cache, then a matching thread notification's name,
then **Unknown channel** if neither source has a name. Selecting a
thread opens that thread in the channel preview; Shift-click opens it in a split.
+A Home URL containing only the channel `threadId` opens that thread's root,
+not the latest message. Reloading or opening the same URL on touch retains the
+target; an explicit reply `messageId` still takes precedence.
+
+![Thread-only Home URL targeting its root message](images/conversation-thread-target.png)
Items in the 256px desktop rail use single-line pills with 16px icons: profile photos for
DMs and model logos for AI chats (Claude sunburst or ChatGPT knot). Other items
diff --git a/docs/agent-guide/images/conversation-thread-target.png b/docs/agent-guide/images/conversation-thread-target.png
new file mode 100644
index 0000000000..19bb401abe
Binary files /dev/null and b/docs/agent-guide/images/conversation-thread-target.png differ