Skip to content

Commit 0b57e1c

Browse files
committed
fix(vfs): forward the typed snapshot through the branch payload builder
The branch buildPayload implementations hand-list the params they pass to buildCopilotRequestPayload and forwarded workspaceContext but dropped vfs, so the typed snapshot never reached the Go request (req.Vfs was always nil and the append-only delta path never engaged). Forward vfs in both the workflow and workspace branches, and add a regression guard asserting the branch threads it through (the bug slipped past tests because post.test mocked the payload builder and payload.test called it directly, bypassing the branch).
1 parent 0ba58e1 commit 0b57e1c

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

apps/sim/lib/copilot/chat/post.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe('handleUnifiedChatPost', () => {
144144
getEffectiveDecryptedEnv.mockResolvedValue({ API_KEY: 'secret' })
145145
generateWorkspaceSnapshot.mockResolvedValue({
146146
markdown: 'workspace context',
147-
snapshot: undefined,
147+
snapshot: { workflows: [{ id: 'wf-1', name: 'Alpha', path: 'workflows/Alpha' }] },
148148
})
149149
processContextsServer.mockResolvedValue([])
150150
resolveActiveResourceContext.mockResolvedValue(null)
@@ -186,6 +186,8 @@ describe('handleUnifiedChatPost', () => {
186186
expect.objectContaining({
187187
model: 'claude-opus-4-8',
188188
workspaceContext: 'workspace context',
189+
// Regression guard: the branch must forward the typed snapshot, not drop it.
190+
vfs: expect.objectContaining({ workflows: expect.any(Array) }),
189191
}),
190192
{ selectedModel: 'claude-opus-4-8' }
191193
)
@@ -224,6 +226,8 @@ describe('handleUnifiedChatPost', () => {
224226
expect.objectContaining({
225227
workspaceId: 'ws-1',
226228
workspaceContext: 'workspace context',
229+
// Regression guard: the branch must forward the typed snapshot, not drop it.
230+
vfs: expect.objectContaining({ workflows: expect.any(Array) }),
227231
}),
228232
{ selectedModel: '' }
229233
)

apps/sim/lib/copilot/chat/post.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ async function resolveBranch(params: {
619619
prefetch: payloadParams.prefetch,
620620
implicitFeedback: payloadParams.implicitFeedback,
621621
workspaceContext: payloadParams.workspaceContext,
622+
vfs: payloadParams.vfs,
622623
userPermission: payloadParams.userPermission,
623624
userTimezone: payloadParams.userTimezone,
624625
userMetadata: payloadParams.userMetadata,
@@ -678,6 +679,7 @@ async function resolveBranch(params: {
678679
fileAttachments: payloadParams.fileAttachments,
679680
chatId: payloadParams.chatId,
680681
workspaceContext: payloadParams.workspaceContext,
682+
vfs: payloadParams.vfs,
681683
userPermission: payloadParams.userPermission,
682684
userTimezone: payloadParams.userTimezone,
683685
userMetadata: payloadParams.userMetadata,

0 commit comments

Comments
 (0)