Skip to content

Commit f012bc9

Browse files
committed
fix(copilot): import the block registry statically in context resolution
processBlockMetadata loaded @/blocks/registry with a dynamic import even though the module already reaches it statically through permission-groups/block-access. Concurrent dynamic imports of the mocked registry intermittently resolved the real registry under vitest, costing seconds and timing out the block-context test on CI. A static import is equivalent at runtime and removes the race.
1 parent e9d17ba commit f012bc9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎apps/sim/lib/copilot/chat/process-contents.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import type { ColumnDefinition } from '@/lib/table/types'
5858
import { workflowDelegationPolicy } from '@/lib/workflows/application/authorization'
5959
import { readWorkflowMetadata } from '@/lib/workflows/application/read-workflow'
6060
import { readWorkspaceFileMetadata } from '@/lib/workspace-files/application/read-workspace-file-metadata'
61+
import { getBlockRegistry } from '@/blocks/registry'
6162
import { escapeRegExp } from '@/executor/constants'
6263
import type { ResolvedSecretTraceRegistry } from '@/executor/utils/resolved-secret-trace-registry'
6364
import type { BrowserTextSelection, ChatContext, TerminalTextSelection } from '@/stores/panel'
@@ -582,7 +583,6 @@ async function processBlockMetadata(
582583
return null
583584
}
584585

585-
const { getBlockRegistry } = await import('@/blocks/registry')
586586
const blockRegistry = getBlockRegistry()
587587
if (!blockRegistry[blockId]) {
588588
return null

0 commit comments

Comments
 (0)