Fix @mention resolution for multi-word agent names

MentionTextarea inserted raw agent names (e.g. @Sarah Chen) but the
backend regex captured only the first word (@Sarah), causing mention
resolution to fail silently. Moved canonicalMentionHandle to shared/
so the renderer can produce space-free handles that the backend resolves
correctly.
This commit is contained in:
ZacharyZhang-NY committed 2026-06-30 21:17:43 -04:00
1 parent dfa2df3334
commit 5bb9aea4f9
10 files changed
+17 -12

No files matched your search

@@ -1,6 +1,6 @@
import type { ProviderService } from "./provider-service";
import { AGENT_TOOLS, dispatchAgentTool, type AgentToolContext, type AgentToolDeps } from "./agent-tools";
import { canonicalMentionHandle } from "./mention-handles";
import { canonicalMentionHandle } from "../../shared/mention-handles";
import type { AgentTurnMessage } from "./provider-tool-turn";
const MAX_ITERATIONS = 12;
@@ -6,7 +6,7 @@ import type { ChatService } from "./chat-service";
import { writeDeliverable } from "./deliverable-writer";
import { DocumentService } from "./document-service";
import { recordWorkspaceFile } from "./files/file-object-store";
import { canonicalMentionHandle } from "./mention-handles";
import { canonicalMentionHandle } from "../../shared/mention-handles";
import type { JsonRecord } from "./provider-http";
import type { ToolCall, ToolDefinition } from "./provider-tool-turn";
@@ -1,5 +1,5 @@
import type { DatabaseSync } from "node:sqlite";
import { canonicalMentionHandle } from "./mention-handles";
import { canonicalMentionHandle } from "../../shared/mention-handles";
export interface MentionTarget {
type: "employee" | "agent" | "board" | "org_group";
@@ -1,11 +0,0 @@
export const RESERVED_MENTION_HANDLES = new Set(["board", "oncall"]);
export function canonicalMentionHandle(value: string): string {
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
}
export function assertUsableMentionName(value: string): void {
if (RESERVED_MENTION_HANDLES.has(canonicalMentionHandle(value))) {
throw new Error("Mention handle is reserved.");
}
}
@@ -8,7 +8,7 @@ import { IdentityAccessService } from "./identity-access-service";
import { OrgGovernanceService } from "./org-governance-service";
import { OperationsService } from "./operations-service";
import { SdlcService } from "./sdlc-service";
import { assertUsableMentionName } from "./mention-handles";
import { assertUsableMentionName } from "../../shared/mention-handles";
/**
* Seeds a brand-new organization in one transaction's worth of writes: the org
@@ -7,7 +7,7 @@ import { ensureAgentHeartbeat, resolveGoalKickoff, type GoalKickoffPlan } from "
import { PolicyService } from "./policy-service";
import { IdentityAccessService } from "./identity-access-service";
import { OrgGovernanceService } from "./org-governance-service";
import { assertUsableMentionName } from "./mention-handles";
import { assertUsableMentionName } from "../../shared/mention-handles";
import { seedOrganization } from "./organization-seed";
export class OrganizationService {
@@ -1,4 +1,4 @@
import { canonicalMentionHandle } from "./mention-handles";
import { canonicalMentionHandle } from "../../shared/mention-handles";
export interface TaskExecutionTaskRow {
id: string;