Skip to content

Commit e23d2b3

Browse files
committed
Updates
1 parent 4b47b91 commit e23d2b3

3 files changed

Lines changed: 7 additions & 39 deletions

File tree

apps/sim/lib/copilot/request/tools/executor.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import {
99
markAsyncToolRunning,
1010
upsertAsyncToolCall,
1111
} from '@/lib/copilot/async-runs/repository'
12-
import {
13-
TOOL_WATCHDOG_DEFAULT_MS,
14-
TOOL_WATCHDOG_LONG_RUNNING_MS,
15-
} from '@/lib/copilot/constants'
12+
import { TOOL_WATCHDOG_DEFAULT_MS, TOOL_WATCHDOG_LONG_RUNNING_MS } from '@/lib/copilot/constants'
1613
import {
1714
MothershipStreamV1AsyncToolRecordStatus,
1815
MothershipStreamV1EventType,

apps/sim/lib/copilot/vfs/workflow-alias-backing.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { db } from '@sim/db'
22
import { workspaceFileFolder, workspaceFiles } from '@sim/db/schema'
3-
import { createLogger } from '@sim/logger'
4-
import { toError } from '@sim/utils/errors'
53
import { and, eq, inArray, isNull } from 'drizzle-orm'
64
import {
75
WORKFLOW_CHANGELOG_BACKING_FOLDER,
@@ -19,8 +17,6 @@ import {
1917
type WorkspaceFileRecord,
2018
} from '@/lib/uploads/contexts/workspace/workspace-file-manager'
2119

22-
const logger = createLogger('WorkflowAliasBacking')
23-
2420
export interface WorkflowAliasBacking {
2521
changelogFolderId: string
2622
plansRootFolderId: string
@@ -97,24 +93,6 @@ export async function ensureWorkflowAliasBacking(args: {
9793
}
9894
}
9995

100-
export async function ensureWorkflowAliasBackingQuietly(args: {
101-
workspaceId: string
102-
userId: string
103-
workflowId: string
104-
workflowName?: string
105-
}): Promise<WorkflowAliasBacking | null> {
106-
try {
107-
return await ensureWorkflowAliasBacking(args)
108-
} catch (error) {
109-
logger.warn('Failed to ensure workflow alias backing', {
110-
workspaceId: args.workspaceId,
111-
workflowId: args.workflowId,
112-
error: toError(error).message,
113-
})
114-
return null
115-
}
116-
}
117-
11896
export async function ensureWorkspacePlanBacking(args: {
11997
workspaceId: string
12098
userId: string

apps/sim/lib/copilot/vfs/workspace-vfs.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ import {
7575
serializeVersions,
7676
serializeWorkflowMeta,
7777
} from '@/lib/copilot/vfs/serializers'
78-
import { ensureWorkflowAliasBackingQuietly } from '@/lib/copilot/vfs/workflow-alias-backing'
7978
import {
8079
buildWorkflowAliasLinks,
8180
isWorkflowAliasBackingPath,
@@ -984,18 +983,12 @@ export class WorkspaceVFS {
984983

985984
const folderPaths = this.buildFolderPaths(folderRows)
986985

987-
if (workflowArtifactsEnabled) {
988-
await Promise.all(
989-
workflowRows.map((wf) =>
990-
ensureWorkflowAliasBackingQuietly({
991-
workspaceId,
992-
userId,
993-
workflowId: wf.id,
994-
workflowName: wf.name,
995-
})
996-
)
997-
)
998-
}
986+
// NOTE: materialization is a pure READ. Alias backing (changelog/plan
987+
// folders + files) is ensured at write time — workflow create/rename
988+
// (lib/workflows/utils) and alias writes (vfs/resource-writer,
989+
// tools/server/files/workspace-file) — never here. Ensuring per workflow
990+
// on every materialize meant N storage/DB writes per read tool call, and
991+
// concurrent materializations contending on the same rows.
999992
const workspaceFiles = workflowArtifactsEnabled
1000993
? await listWorkspaceFiles(workspaceId, { includeReservedSystemFiles: true })
1001994
: []

0 commit comments

Comments
 (0)