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(agents): remove Macro Coding Agent from mention suggestions (#7651)

Eric Hayes0010f9b0041f
diff --git a/apps/web/src/features/channel/macroAi.ts b/apps/web/src/features/channel/macroAi.ts
index f29df01b87..7b325c1202 100644
--- a/apps/web/src/features/channel/macroAi.ts
+++ b/apps/web/src/features/channel/macroAi.ts
@@ -14,10 +14,6 @@ import {
MACRO_AGENT_NAME,
MACRO_AGENT_PRINCIPAL_ID,
} from '@core/constant/macroAgent';
-import {
- MACRO_CODER_NAME,
- MACRO_CODER_PRINCIPAL_ID,
-} from '@core/constant/macroCoder';
import { MACRO_NEW_PRINCIPAL_ID } from '@core/constant/macroNew';
import type { IUser } from '@core/user/types';
@@ -52,22 +48,9 @@ export function macroMentionUser(agentSessions: boolean): IUser {
};
}
-/**
- * A synthetic [`IUser`] entry so Macro Coder appears in the channel
- * `@`-mention typeahead, exactly like [`macroMentionUser`]. Mentioning it
- * opens a sandboxed coding-agent session rather than a chat reply.
- */
-export function macroCoderMentionUser(): IUser {
- return {
- id: MACRO_CODER_PRINCIPAL_ID,
- name: MACRO_CODER_NAME,
- email: MACRO_CODER_NAME,
- };
-}
-
/**
* The Cursor bot as a synthetic mention user, exactly like
- * [`macroCoderMentionUser`]. Mentioning it opens an agent session served by
+ * [`macroMentionUser`]. Mentioning it opens an agent session served by
* a Cursor cloud agent.
*/
export function cursorMentionUser(): IUser {
diff --git a/apps/web/src/features/channel/use-agent-mention-users.test.ts b/apps/web/src/features/channel/use-agent-mention-users.test.ts
index 5907c3879b..52cbd35374 100644
--- a/apps/web/src/features/channel/use-agent-mention-users.test.ts
+++ b/apps/web/src/features/channel/use-agent-mention-users.test.ts
@@ -2,6 +2,11 @@ import {
MACRO_AGENT_NAME,
MACRO_AGENT_PRINCIPAL_ID,
} from '@core/constant/macroAgent';
+import {
+ MACRO_CODER_BOT_ID,
+ MACRO_CODER_NAME,
+ MACRO_CODER_PRINCIPAL_ID,
+} from '@core/constant/macroCoder';
import { MACRO_NEW_PRINCIPAL_ID } from '@core/constant/macroNew';
import type { IUser } from '@core/user/types';
import { createRoot, createSignal } from 'solid-js';
@@ -84,4 +89,44 @@ describe('useAgentMentionUsers', () => {
dispose();
});
});
+
+ it.each([false, true])(
+ 'excludes the retired coder with the agents rollout set to %s',
+ (rollout) => {
+ createRoot((dispose) => {
+ flags.agents = () => rollout;
+ const users = useAgentMentionUsers(() => []);
+ expect(users().map((user) => user.id)).not.toContain(
+ MACRO_CODER_PRINCIPAL_ID
+ );
+
+ const person = {
+ id: 'person',
+ name: 'Person',
+ email: '[email protected]',
+ };
+ const [enabled, setEnabled] = createSignal(true);
+ const participants = [
+ person,
+ ...[MACRO_CODER_BOT_ID, MACRO_CODER_PRINCIPAL_ID].map((id) => ({
+ id,
+ name: MACRO_CODER_NAME,
+ email: MACRO_CODER_NAME,
+ })),
+ ];
+ const mentions = useAgentMentionUsers(() => participants, enabled);
+ expect(mentions()).toContainEqual(person);
+ expect(mentions().map((user) => user.id)).not.toContain(
+ MACRO_CODER_BOT_ID
+ );
+ expect(mentions().map((user) => user.id)).not.toContain(
+ MACRO_CODER_PRINCIPAL_ID
+ );
+ setEnabled(false);
+ expect(mentions()).toEqual([person]);
+ expect(participants).toHaveLength(3);
+ dispose();
+ });
+ }
+ );
});
diff --git a/apps/web/src/features/channel/use-agent-mention-users.ts b/apps/web/src/features/channel/use-agent-mention-users.ts
index e77db72f22..e7f5c55528 100644
--- a/apps/web/src/features/channel/use-agent-mention-users.ts
+++ b/apps/web/src/features/channel/use-agent-mention-users.ts
@@ -12,7 +12,6 @@ import {
isMacroAiId,
isMacroCoderId,
isMacroNewId,
- macroCoderMentionUser,
macroMentionUser,
} from './macroAi';
import { useChatV3AgentsFlag } from './use-chat-v3-agents-flag';
@@ -37,16 +36,15 @@ export function useAgentMentionUsers(
const canUseAgents = useChatV3AgentsFlag();
return () => {
- if (!enabled()) return users();
- const base = users().filter(
+ // Old participants and saved bot rows must not restore the retired coder.
+ const mentionable = users().filter((user) => !isMacroCoderId(user.id));
+ if (!enabled()) return mentionable;
+ const base = mentionable.filter(
(user) =>
(canUseCursor() || !isCursorBotId(user.id)) &&
!isMacroAiId(user.id) &&
!isMacroNewId(user.id)
);
- if (canUseAgents() && !base.some((user) => isMacroCoderId(user.id))) {
- base.unshift(macroCoderMentionUser());
- }
if (canUseCursor() && !base.some((user) => isCursorBotId(user.id))) {
base.unshift(cursorMentionUser());
}
diff --git a/apps/web/src/features/channel/use-chat-v3-agents-flag.ts b/apps/web/src/features/channel/use-chat-v3-agents-flag.ts
index 124cbd93f0..c9993a575a 100644
--- a/apps/web/src/features/channel/use-chat-v3-agents-flag.ts
+++ b/apps/web/src/features/channel/use-chat-v3-agents-flag.ts
@@ -3,9 +3,9 @@ import { enableChatV3Agents } from '@core/constant/featureFlags';
import type { Accessor } from 'solid-js';
/**
- * Whether the AI agents surfaces are enabled: the Macro Coder `@`-mention
- * entry, the folded agent-session view in channels, and whether `@macro`
- * opens an agent session instead of the classic reply. Reactive, so the
+ * Whether the AI agents surfaces are enabled: the folded agent-session view
+ * in channels, and whether `@macro` opens an agent session instead of the
+ * classic reply. Reactive, so the
* gated surfaces appear once PostHog answers rather than only on remount.
*/
export function useChatV3AgentsFlag(): Accessor<boolean> {
diff --git a/apps/web/src/features/property/queries/agent-assignees.test.ts b/apps/web/src/features/property/queries/agent-assignees.test.ts
index 37378d1157..a267e961fd 100644
--- a/apps/web/src/features/property/queries/agent-assignees.test.ts
+++ b/apps/web/src/features/property/queries/agent-assignees.test.ts
@@ -134,9 +134,9 @@ describe('task agent assignees', () => {
CLAUDE_BOT_PRINCIPAL_ID,
CODEX_BOT_PRINCIPAL_ID,
CURSOR_BOT_PRINCIPAL_ID,
- MACRO_CODER_PRINCIPAL_ID,
]);
expect(ids).not.toContain(MACRO_AGENT_PRINCIPAL_ID);
+ expect(ids).not.toContain(MACRO_CODER_PRINCIPAL_ID);
dispose();
});
});
diff --git a/apps/web/src/lib/core/constant/featureFlags.ts b/apps/web/src/lib/core/constant/featureFlags.ts
index efd9eba538..352afb7ba0 100644
--- a/apps/web/src/lib/core/constant/featureFlags.ts
+++ b/apps/web/src/lib/core/constant/featureFlags.ts
@@ -695,9 +695,9 @@ export const enableActivityFeed = defineFlag({
default: onInDev,
});
-// AI agents: the Macro Coder mention entry, the folded agent-session view in
-// channels, and which bot the single `@macro` mention targets — the agent
-// session when on, the classic in-channel reply when off.
+// AI agents: the folded agent-session view in channels, and which bot the
+// single `@macro` mention targets — the agent session when on, the classic
+// in-channel reply when off.
// Override with VITE_ENABLE_CHAT_V3_AGENTS.
export const enableChatV3Agents = defineFlag({
key: 'enable-chat-v3-agents',
diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.md
index 7792419125..c5deedb701 100644
--- a/docs/AGENT_GUIDE/ai-chat.md
+++ b/docs/AGENT_GUIDE/ai-chat.md
@@ -842,9 +842,9 @@ reads `Waiting for approval`. The agent's hidden context names the owner and the
Mention `@Macro` in any channel message. Without the `enable-chat-v3-agents` rollout it is
the classic in-channel reply; with it, the same mention opens an **agent session** — a
dedicated transcript at `/app/agent/<uuid>` whose replies also stream back into the thread.
-`@coder` / `@cursor` always open a session. There is only ever one Macro entry in the
-mention menu; which of the two answers is the rollout's decision, not a second choice in
-the menu.
+`@cursor` opens a session. Macro Coding Agent (`@coder`) is unavailable in mention
+suggestions. There is only ever one Macro entry in the mention menu; which of the
+two answers is the rollout's decision, not a second choice in the menu.
## Agent sessions
diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.md
index ffe01c6e3c..9a33ebc179 100644
--- a/docs/AGENT_GUIDE/channels.md
+++ b/docs/AGENT_GUIDE/channels.md
@@ -184,9 +184,12 @@ email at all. The bot's prompt carries the current date and time in the mentioni
own time zone (their primary calendar's), so it resolves relative times ("tomorrow at 4",
"EOD") without asking; when no calendar is connected the prompt falls back to UTC and the
bot asks before scheduling a specific clock time. Within the rollout, `@Macro` — plus
-`@coder` / `@cursor` / `@codex` / `@claude` for everyone — opens
+`@cursor` / `@codex` / `@claude` when available — opens
an agent session; follow-up
`@` mentions of that bot in the same thread route to it.
+Macro Coding Agent (`@coder`) is unavailable in mention suggestions, including
+when it appears among existing participants or bots. Check with the agents
+rollout both enabled and disabled.
When the backend is configured with AI usage enforcement, a rejected classic
`@Macro` request gets a thread reply explaining the allowance failure (for example,
`ai_allowance_exhausted`) or temporary validation failure (`ai_billing_unavailable`),