Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

⚑️ perf(home): remove legacy session joins (#19126)

Arvin Xu0d6a59d67a86
diff --git a/apps/server/src/routers/lambda/home.ts b/apps/server/src/routers/lambda/home.ts
index 4113df92c5d..4bfd46ad8d2 100644
--- a/apps/server/src/routers/lambda/home.ts
+++ b/apps/server/src/routers/lambda/home.ts
@@ -3,14 +3,12 @@ import { z } from 'zod';
import { withScopedPermission } from '@/business/server/trpc-middlewares/rbacPermission';
import { wsCompatProcedure } from '@/business/server/trpc-middlewares/workspaceAuth';
import { AgentModel } from '@/database/models/agent';
-import { AgentMigrationRepo } from '@/database/repositories/agentMigration';
import { HomeRepository } from '@/database/repositories/home';
import { router } from '@/libs/trpc/lambda';
import { serverDatabase } from '@/libs/trpc/lambda/middleware';
import { createFtsSearchRepo } from '@/server/services/ftsSearch';
import { type HomeBriefData, HomeService } from '@/server/services/home';
import { hasWorkspaceScopedPermission } from '@/server/services/workspacePermission';
-import { after } from '@/server/utils/scheduleAfterResponse';
const homeProcedure = wsCompatProcedure.use(serverDatabase).use(async (opts) => {
const { ctx } = opts;
@@ -18,7 +16,6 @@ const homeProcedure = wsCompatProcedure.use(serverDatabase).use(async (opts) =>
return opts.next({
ctx: {
- agentMigrationRepo: new AgentMigrationRepo(ctx.serverDB, ctx.userId, workspaceId),
agentModel: new AgentModel(ctx.serverDB, ctx.userId, workspaceId),
homeRepository: new HomeRepository(ctx.serverDB, ctx.userId, workspaceId),
homeService: new HomeService(ctx.userId),
@@ -76,20 +73,7 @@ export const homeRouter = router({
})
: true;
- const result = await ctx.homeRepository.getSidebarAgentList(includeLabels, includeGroups);
-
- // Runtime migration: backfill sessionGroupId for legacy agents
- const runMigration = async () => {
- try {
- await ctx.agentMigrationRepo.migrateSessionGroupId();
- } catch (error) {
- console.error('[AgentMigration] Failed to migrate sessionGroupId:', error);
- }
- };
-
- after(runMigration);
-
- return result;
+ return ctx.homeRepository.getSidebarAgentList(includeLabels, includeGroups);
}),
searchAgents: homeSearchProcedure
diff --git a/packages/database/src/repositories/agentMigration/__tests__/agentMigrationRepo.test.ts b/packages/database/src/repositories/agentMigration/__tests__/agentMigrationRepo.test.ts
index bf8e63b44b1..9e1d75a6098 100644
--- a/packages/database/src/repositories/agentMigration/__tests__/agentMigrationRepo.test.ts
+++ b/packages/database/src/repositories/agentMigration/__tests__/agentMigrationRepo.test.ts
@@ -2,15 +2,7 @@ import { eq, inArray } from 'drizzle-orm';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { getTestDB } from '../../../core/getTestDB';
-import {
- agents,
- agentsToSessions,
- messages,
- sessionGroups,
- sessions,
- topics,
- users,
-} from '../../../schemas';
+import { agents, messages, sessions, topics, users } from '../../../schemas';
import type { LobeChatDatabase } from '../../../type';
import { AgentMigrationRepo } from '../index';
@@ -767,133 +759,4 @@ describe('AgentMigrationRepo', () => {
expect(result).toBeNull();
});
});
-
- describe('migrateSessionGroupId', () => {
- it('should backfill sessionGroupId from session groupId', async () => {
- // Create session group
- const [group] = await serverDB
- .insert(sessionGroups)
- .values({ id: 'test-group', name: 'Test Group', userId })
- .returning();
-
- // Create a session with groupId
- const groupedSessionId = 'grouped-session';
- await serverDB.insert(sessions).values({ id: groupedSessionId, userId, groupId: group.id });
-
- // Create an agent with null sessionGroupId
- const agentId = 'migrate-group-agent';
- await serverDB.insert(agents).values({ id: agentId, userId, sessionGroupId: null });
-
- // Link agent to session
- await serverDB
- .insert(agentsToSessions)
- .values({ agentId, sessionId: groupedSessionId, userId });
-
- // Run migration
- await agentMigrationRepo.migrateSessionGroupId();
-
- // Verify agent's sessionGroupId was updated
- const updatedAgent = await serverDB.query.agents.findFirst({
- where: eq(agents.id, agentId),
- });
- expect(updatedAgent?.sessionGroupId).toBe(group.id);
- });
-
- it('should not modify agents that already have sessionGroupId', async () => {
- const [group1] = await serverDB
- .insert(sessionGroups)
- .values({ id: 'group-1', name: 'Group 1', userId })
- .returning();
-
- const [group2] = await serverDB
- .insert(sessionGroups)
- .values({ id: 'group-2', name: 'Group 2', userId })
- .returning();
-
- const groupedSessionId = 'session-with-group2';
- await serverDB.insert(sessions).values({ id: groupedSessionId, userId, groupId: group2.id });
-
- // Agent already has a sessionGroupId set
- const agentId = 'already-grouped-agent';
- await serverDB.insert(agents).values({ id: agentId, userId, sessionGroupId: group1.id });
-
- await serverDB
- .insert(agentsToSessions)
- .values({ agentId, sessionId: groupedSessionId, userId });
-
- await agentMigrationRepo.migrateSessionGroupId();
-
- // Should still have the original group
- const agent = await serverDB.query.agents.findFirst({
- where: eq(agents.id, agentId),
- });
- expect(agent?.sessionGroupId).toBe(group1.id);
- });
-
- it('should do nothing when no agents need migration', async () => {
- // No agents at all - should not throw
- await agentMigrationRepo.migrateSessionGroupId();
- });
-
- it('should not modify other user agents', async () => {
- const [group] = await serverDB
- .insert(sessionGroups)
- .values({ id: 'user2-group', name: 'User2 Group', userId: userId2 })
- .returning();
-
- const user2Session = 'user2-session-grouped';
- await serverDB
- .insert(sessions)
- .values({ id: user2Session, userId: userId2, groupId: group.id });
-
- const agentId = 'user2-agent';
- await serverDB.insert(agents).values({ id: agentId, userId: userId2, sessionGroupId: null });
-
- await serverDB
- .insert(agentsToSessions)
- .values({ agentId, sessionId: user2Session, userId: userId2 });
-
- // Run migration for user1
- await agentMigrationRepo.migrateSessionGroupId();
-
- // User2's agent should not be affected
- const agent = await serverDB.query.agents.findFirst({
- where: eq(agents.id, agentId),
- });
- expect(agent?.sessionGroupId).toBeNull();
- });
-
- it('should handle multiple agents needing migration', async () => {
- const [group] = await serverDB
- .insert(sessionGroups)
- .values({ id: 'multi-group', name: 'Multi Group', userId })
- .returning();
-
- const session1 = 'multi-session-1';
- const session2 = 'multi-session-2';
- await serverDB.insert(sessions).values([
- { id: session1, userId, groupId: group.id },
- { id: session2, userId, groupId: group.id },
- ]);
-
- const agent1 = 'multi-agent-1';
- const agent2 = 'multi-agent-2';
- await serverDB.insert(agents).values([
- { id: agent1, userId, sessionGroupId: null },
- { id: agent2, userId, sessionGroupId: null },
- ]);
-
- await serverDB.insert(agentsToSessions).values([
- { agentId: agent1, sessionId: session1, userId },
- { agentId: agent2, sessionId: session2, userId },
- ]);
-
- await agentMigrationRepo.migrateSessionGroupId();
-
- const updatedAgents = await serverDB.query.agents.findMany({
- where: inArray(agents.id, [agent1, agent2]),
- });
- expect(updatedAgents.every((a) => a.sessionGroupId === group.id)).toBe(true);
- });
- });
});
diff --git a/packages/database/src/repositories/agentMigration/index.ts b/packages/database/src/repositories/agentMigration/index.ts
index fe2882a33d2..c6144b314ce 100644
--- a/packages/database/src/repositories/agentMigration/index.ts
+++ b/packages/database/src/repositories/agentMigration/index.ts
@@ -1,7 +1,7 @@
-import { and, eq, inArray, isNotNull, isNull } from 'drizzle-orm';
+import { and, eq, inArray, isNull } from 'drizzle-orm';
import type { AnyPgColumn } from 'drizzle-orm/pg-core';
-import { agents, agentsToSessions, messages, sessions, topics } from '../../schemas';
+import { agentsToSessions, messages, topics } from '../../schemas';
import type { LobeChatDatabase } from '../../type';
import { buildWorkspaceWhere } from '../../utils/workspace';
@@ -165,50 +165,4 @@ export class AgentMigrationRepo {
return result[0]?.sessionId ?? null;
};
-
- /**
- * Runtime migration: backfill sessionGroupId for legacy agents
- *
- * This method migrates agents that have:
- * - sessionGroupId IS NULL
- * - Associated session has groupId NOT NULL
- *
- * It copies the session's groupId to the agent's sessionGroupId
- */
- migrateSessionGroupId = async () => {
- // Personal scope only. `sessions` are per-user rows and the join below does
- // not filter by the caller, so inside a workspace this would copy some
- // member's legacy per-session folder into the *shared*
- // `agents.sessionGroupId` β€” arbitrarily, since which session wins depends
- // on the join, and permanently, since the column is now what every
- // member's sidebar reads. Workspace agents keep whatever the shared column
- // already says; there is no legacy shared value to recover.
- if (this.workspaceId) return;
-
- // Find all agents that need migration:
- // - Agent's sessionGroupId is NULL
- // - Agent's associated session has a groupId
- const agentsToMigrate = await this.db
- .select({
- agentId: agents.id,
- sessionGroupId: sessions.groupId,
- })
- .from(agents)
- .innerJoin(agentsToSessions, eq(agents.id, agentsToSessions.agentId))
- .innerJoin(sessions, eq(agentsToSessions.sessionId, sessions.id))
- .where(and(this.ws(agents), isNull(agents.sessionGroupId), isNotNull(sessions.groupId)));
-
- if (agentsToMigrate.length === 0) return;
-
- // Update each agent's sessionGroupId
- // Using individual updates to preserve updatedAt (no auto-update trigger)
- for (const item of agentsToMigrate) {
- if (!item.sessionGroupId) continue;
-
- await this.db
- .update(agents)
- .set({ sessionGroupId: item.sessionGroupId, updatedAt: agents.updatedAt })
- .where(and(eq(agents.id, item.agentId), this.ws(agents)));
- }
- };
}
diff --git a/packages/database/src/repositories/home/__tests__/index.test.ts b/packages/database/src/repositories/home/__tests__/index.test.ts
index d1e9b92ef57..5d06bd28340 100644
--- a/packages/database/src/repositories/home/__tests__/index.test.ts
+++ b/packages/database/src/repositories/home/__tests__/index.test.ts
@@ -423,8 +423,8 @@ describe('HomeRepository', () => {
expect(group!.unreadCount).toBe(1);
});
- describe('backward compatibility - fallback to sessions.pinned', () => {
- it('should fallback to sessions.pinned when agents.pinned is undefined (legacy data)', async () => {
+ describe('agents.pinned is the only sidebar pin source', () => {
+ it('should ignore sessions.pinned when agents.pinned is null', async () => {
// Simulate legacy data: agents.pinned is null, but sessions.pinned is true
const agentId = 'legacy-agent';
const sessionId = 'legacy-session';
@@ -452,10 +452,10 @@ describe('HomeRepository', () => {
const result = await homeRepo.getSidebarAgentList();
// Should fallback to sessions.pinned = true
- expect(result.pinned).toHaveLength(1);
- expect(result.pinned[0].id).toBe(agentId);
- expect(result.pinned[0].pinned).toBe(true);
- expect(result.ungrouped).toHaveLength(0);
+ expect(result.pinned).toHaveLength(0);
+ expect(result.ungrouped).toHaveLength(1);
+ expect(result.ungrouped[0].id).toBe(agentId);
+ expect(result.ungrouped[0].pinned).toBe(false);
});
it('should use agents.pinned when both agents.pinned and sessions.pinned exist (agents.pinned takes priority)', async () => {
@@ -671,8 +671,8 @@ describe('HomeRepository', () => {
expect(result).toHaveLength(0);
});
- describe('backward compatibility - fallback to sessions.pinned', () => {
- it('should fallback to sessions.pinned when agents.pinned is null in search results', async () => {
+ describe('agents.pinned is the only search pin source', () => {
+ it('should ignore sessions.pinned when agents.pinned is null', async () => {
// Create legacy agent with pinned on session only
await clientDB.transaction(async (tx) => {
await tx.insert(Schema.agents).values({
@@ -700,7 +700,7 @@ describe('HomeRepository', () => {
expect(result).toHaveLength(1);
expect(result[0].id).toBe('legacy-search');
- expect(result[0].pinned).toBe(true); // Should fallback to sessions.pinned
+ expect(result[0].pinned).toBe(false);
});
it('should prioritize agents.pinned over sessions.pinned in search results', async () => {
@@ -850,7 +850,7 @@ describe('HomeRepository', () => {
expect(result.ungrouped).toHaveLength(0);
});
- it('should prioritize agents.sessionGroupId over sessions.groupId', async () => {
+ it('should ignore sessions.groupId when agents.sessionGroupId is set', async () => {
// agents.sessionGroupId points to folder A; sessions.groupId points to folder B.
// The agent must land in folder A.
await clientDB.transaction(async (tx) => {
@@ -887,7 +887,7 @@ describe('HomeRepository', () => {
expect(folderB?.items).toHaveLength(0);
});
- it('should fall back to sessions.groupId when agents.sessionGroupId is null', async () => {
+ it('should ignore sessions.groupId when agents.sessionGroupId is null', async () => {
await clientDB.transaction(async (tx) => {
await tx.insert(Schema.sessionGroups).values({
id: 'folder-fallback',
@@ -920,7 +920,8 @@ describe('HomeRepository', () => {
expect(result.groups).toHaveLength(1);
expect(result.groups[0].id).toBe('folder-fallback');
- expect(result.groups[0].items.map((i) => i.id)).toContain('agent-fallback-group');
+ expect(result.groups[0].items).toHaveLength(0);
+ expect(result.ungrouped.map((item) => item.id)).toContain('agent-fallback-group');
});
});
diff --git a/packages/database/src/repositories/home/index.test.ts b/packages/database/src/repositories/home/index.test.ts
index b1011d83e45..b33f37fdb25 100644
--- a/packages/database/src/repositories/home/index.test.ts
+++ b/packages/database/src/repositories/home/index.test.ts
@@ -43,7 +43,7 @@ describe('HomeRepository', () => {
});
describe('getSidebarAgentList - agents', () => {
- it('should return agents with their session info', async () => {
+ it('should return agents without projecting legacy session info', async () => {
// Create agent
const [agent] = await serverDB
.insert(agents)
@@ -80,7 +80,6 @@ describe('HomeRepository', () => {
description: 'Test agent description',
id: agent.id,
pinned: false,
- sessionId: session.id,
title: 'Test Agent',
type: 'agent',
});
@@ -116,7 +115,6 @@ describe('HomeRepository', () => {
expect(result.ungrouped[0]).toMatchObject({
avatar: DEFAULT_INBOX_AVATAR,
id: agent.id,
- sessionId: session.id,
title: DEFAULT_INBOX_TITLE,
});
});
@@ -198,16 +196,13 @@ describe('HomeRepository', () => {
});
it('should return custom avatar when chat group has one set', async () => {
- const [group] = await serverDB
- .insert(chatGroups)
- .values({
- avatar: 'πŸš€',
- backgroundColor: '#ff5500',
- pinned: false,
- title: 'Custom Avatar Group',
- userId,
- })
- .returning();
+ await serverDB.insert(chatGroups).values({
+ avatar: 'πŸš€',
+ backgroundColor: '#ff5500',
+ pinned: false,
+ title: 'Custom Avatar Group',
+ userId,
+ });
const result = await homeRepo.getSidebarAgentList();
@@ -320,53 +315,10 @@ describe('HomeRepository', () => {
describe('getSidebarAgentList - pinned items', () => {
it('should separate pinned agents', async () => {
- // Create pinned agent
- const [pinnedAgent] = await serverDB
- .insert(agents)
- .values({
- title: 'Pinned Agent',
- userId,
- virtual: false,
- })
- .returning();
-
- const [pinnedSession] = await serverDB
- .insert(sessions)
- .values({
- pinned: true,
- userId,
- })
- .returning();
-
- await serverDB.insert(agentsToSessions).values({
- agentId: pinnedAgent.id,
- sessionId: pinnedSession.id,
- userId,
- });
-
- // Create unpinned agent
- const [unpinnedAgent] = await serverDB
- .insert(agents)
- .values({
- title: 'Unpinned Agent',
- userId,
- virtual: false,
- })
- .returning();
-
- const [unpinnedSession] = await serverDB
- .insert(sessions)
- .values({
- pinned: false,
- userId,
- })
- .returning();
-
- await serverDB.insert(agentsToSessions).values({
- agentId: unpinnedAgent.id,
- sessionId: unpinnedSession.id,
- userId,
- });
+ await serverDB.insert(agents).values([
+ { pinned: true, title: 'Pinned Agent', userId, virtual: false },
+ { pinned: false, title: 'Unpinned Agent', userId, virtual: false },
+ ]);
const result = await homeRepo.getSidebarAgentList();
@@ -404,28 +356,12 @@ describe('HomeRepository', () => {
.returning();
// Create agent in group
- const [agent] = await serverDB
- .insert(agents)
- .values({
- title: 'Work Agent',
- userId,
- virtual: false,
- })
- .returning();
-
- const [session] = await serverDB
- .insert(sessions)
- .values({
- groupId: group.id,
- pinned: false,
- userId,
- })
- .returning();
-
- await serverDB.insert(agentsToSessions).values({
- agentId: agent.id,
- sessionId: session.id,
+ await serverDB.insert(agents).values({
+ pinned: false,
+ sessionGroupId: group.id,
+ title: 'Work Agent',
userId,
+ virtual: false,
});
const result = await homeRepo.getSidebarAgentList();
@@ -734,52 +670,20 @@ describe('HomeRepository', () => {
.returning();
// Create pinned agent
- const [pinnedAgent] = await serverDB
- .insert(agents)
- .values({
- title: 'Pinned Agent',
- userId,
- virtual: false,
- })
- .returning();
-
- const [pinnedSession] = await serverDB
- .insert(sessions)
- .values({
- pinned: true,
- userId,
- })
- .returning();
-
- await serverDB.insert(agentsToSessions).values({
- agentId: pinnedAgent.id,
- sessionId: pinnedSession.id,
+ await serverDB.insert(agents).values({
+ pinned: true,
+ title: 'Pinned Agent',
userId,
+ virtual: false,
});
// Create grouped agent
- const [groupedAgent] = await serverDB
- .insert(agents)
- .values({
- title: 'Grouped Agent',
- userId,
- virtual: false,
- })
- .returning();
-
- const [groupedSession] = await serverDB
- .insert(sessions)
- .values({
- groupId: folder.id,
- pinned: false,
- userId,
- })
- .returning();
-
- await serverDB.insert(agentsToSessions).values({
- agentId: groupedAgent.id,
- sessionId: groupedSession.id,
+ await serverDB.insert(agents).values({
+ pinned: false,
+ sessionGroupId: folder.id,
+ title: 'Grouped Agent',
userId,
+ virtual: false,
});
// Create ungrouped chat group
diff --git a/packages/database/src/repositories/home/index.ts b/packages/database/src/repositories/home/index.ts
index f09fc24fa5e..1c15c721189 100644
--- a/packages/database/src/repositories/home/index.ts
+++ b/packages/database/src/repositories/home/index.ts
@@ -12,10 +12,8 @@ import {
agentLabelAssignments,
agentLabels,
agents,
- agentsToSessions,
chatGroups,
sessionGroups,
- sessions,
topics,
} from '../../schemas';
import { type LobeChatDatabase } from '../../type';
@@ -82,14 +80,14 @@ export class HomeRepository {
includeLabels = true,
includeGroups = true,
): Promise<SidebarAgentListResponse> {
- // 1. Query all agents (non-virtual) with their session info (if exists).
+ // 1. Query all non-virtual agents.
// `visibility` is selected so we can later bucket public vs. the
// current user's private rows; the WHERE already hides other members'
// private rows via the workspace-aware predicate.
const agentList = await this.db
.select({
agencyConfig: agents.agencyConfig,
- agentSessionGroupId: agents.sessionGroupId,
+ sessionGroupId: agents.sessionGroupId,
agentUserId: agents.userId,
avatar: agents.avatar,
backgroundColor: agents.backgroundColor,
@@ -97,17 +95,12 @@ export class HomeRepository {
id: agents.id,
name: agents.name,
pinned: agents.pinned,
- sessionGroupId: sessions.groupId,
- sessionId: sessions.id,
- sessionPinned: sessions.pinned,
slug: agents.slug,
title: agents.title,
updatedAt: agents.updatedAt,
visibility: agents.visibility,
})
.from(agents)
- .leftJoin(agentsToSessions, eq(agents.id, agentsToSessions.agentId))
- .leftJoin(sessions, eq(agentsToSessions.sessionId, sessions.id))
.where(
and(
buildWorkspaceWhere(this.scope, {
@@ -288,7 +281,6 @@ export class HomeRepository {
private processAgentList(
agentItems: Array<{
agencyConfig: { heterogeneousProvider?: { type?: string } } | null;
- agentSessionGroupId: string | null;
agentUserId: string;
avatar: string | null;
backgroundColor: string | null;
@@ -297,8 +289,6 @@ export class HomeRepository {
name: string | null;
pinned: boolean | null;
sessionGroupId: string | null;
- sessionId: string | null;
- sessionPinned: boolean | null;
slug: string | null;
title: string | null;
updatedAt: Date;
@@ -334,8 +324,6 @@ export class HomeRepository {
// The only per-member layer left is show/hide, applied client-side from
// `sidebarAgentVisibilityOverrides` / `sidebarHiddenGroupIds`.
// Convert to unified format
- // For pinned status: agents.pinned takes priority, fallback to sessions.pinned for backward compatibility
- // For groupId: agents.sessionGroupId takes priority, fallback to sessions.groupId for backward compatibility
type EnrichedItem = SidebarAgentItem & {
groupId: string | null;
isPrivate: boolean;
@@ -353,24 +341,13 @@ export class HomeRepository {
avatar: meta.avatar,
backgroundColor: a.backgroundColor,
description: a.description,
- // Legacy fallback, personal scope only. `sessions` are per-user rows
- // and this join does not filter by the caller, so in a workspace the
- // fallback would hand one member's old per-session folder to every
- // member β€” arbitrarily, since which session wins depends on the join.
- // That was harmless while folders were per-member; now that the
- // sidebar is shared it would publish one person's legacy state.
- groupId: this.workspaceId
- ? a.agentSessionGroupId
- : (a.agentSessionGroupId ?? a.sessionGroupId),
+ groupId: a.sessionGroupId,
heterogeneousType: a.agencyConfig?.heterogeneousProvider?.type ?? null,
id: a.id,
isPrivate: visibility === 'private',
labels: agentLabelsMap.get(a.id),
name: a.name,
- // Same personal-only reasoning as `groupId`: `sessions.pinned` is one
- // member's legacy pin, and pins are shared again.
- pinned: this.workspaceId ? (a.pinned ?? false) : (a.pinned ?? a.sessionPinned ?? false),
- sessionId: a.sessionId,
+ pinned: a.pinned ?? false,
slug: a.slug,
title: meta.title,
type: 'agent' as const,
@@ -393,7 +370,6 @@ export class HomeRepository {
id: g.id,
isPrivate: visibility === 'private',
pinned: g.pinned ?? false,
- sessionId: null,
title: g.title,
type: 'group' as const,
unreadCount: groupUnread.get(g.id) ?? 0,
@@ -510,8 +486,6 @@ export class HomeRepository {
id: agents.id,
name: agents.name,
pinned: agents.pinned,
- sessionId: sessions.id,
- sessionPinned: sessions.pinned,
slug: agents.slug,
title: agents.title,
updatedAt: agents.updatedAt,
@@ -519,8 +493,6 @@ export class HomeRepository {
visibility: agents.visibility,
})
.from(agents)
- .leftJoin(agentsToSessions, eq(agents.id, agentsToSessions.agentId))
- .leftJoin(sessions, eq(agentsToSessions.sessionId, sessions.id))
.where(
and(
buildWorkspaceWhere(this.scope, agents),
@@ -576,10 +548,7 @@ export class HomeRepository {
description: a.description,
id: a.id,
name: a.name,
- // Same personal-only reasoning as `groupId`: `sessions.pinned` is one
- // member's legacy pin, and pins are shared again.
- pinned: this.workspaceId ? (a.pinned ?? false) : (a.pinned ?? a.sessionPinned ?? false),
- sessionId: a.sessionId,
+ pinned: a.pinned ?? false,
title: meta.title,
type: 'agent' as const,
updatedAt: a.updatedAt,
diff --git a/packages/types/src/home.ts b/packages/types/src/home.ts
index c76da1b27f9..1cbf4747f9e 100644
--- a/packages/types/src/home.ts
+++ b/packages/types/src/home.ts
@@ -80,7 +80,6 @@ export interface SidebarAgentItem {
*/
name?: string | null;
pinned: boolean;
- sessionId?: string | null;
/**
* Agent slug. Builtin agents (LobeAI / agent-builder / …) are identified by
* slug, letting the sidebar hide creator-only actions on official agents.
diff --git a/src/features/MobileHome/SessionListContent/agentSearchResults.test.ts b/src/features/MobileHome/SessionListContent/agentSearchResults.test.ts
index 446231e0cf7..a12fdb28e3e 100644
--- a/src/features/MobileHome/SessionListContent/agentSearchResults.test.ts
+++ b/src/features/MobileHome/SessionListContent/agentSearchResults.test.ts
@@ -13,12 +13,10 @@ const createSearchResult = (overrides: Partial<SidebarAgentItem> = {}): SidebarA
});
describe('getVisibleAgentSearchResults', () => {
- it('keeps mobile agent results that do not have a legacy session', () => {
- const agentWithoutSession = createSearchResult({ sessionId: undefined });
+ it('keeps mobile agent results', () => {
+ const agent = createSearchResult();
- expect(getVisibleAgentSearchResults([agentWithoutSession], true)).toEqual([
- agentWithoutSession,
- ]);
+ expect(getVisibleAgentSearchResults([agent], true)).toEqual([agent]);
});
it('hides chat groups only on the mobile home', () => {