Skip to content

Commit 7083e16

Browse files
committed
fix(mothership): workspaceId is required end-to-end — no silent fallback path
Companion to the worker contract tightening. The requiredness propagates up sim's own chain: the payload builder and the workflow branch carried optional workspaceId that was never truly optional (the resolver's 'resolved' variant guarantees it; the workspace contract requires it) — now typed as it always behaved. Regenerated protocol mirror. Claude-Session: https://claude.ai/code/session_01CgaxNAaeD3taGdghbXn17w
1 parent 20522c0 commit 7083e16

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎apps/sim/lib/mothership/chat/payload.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ export async function buildCopilotRequestPayload(
420420
: {}),
421421
messageId: userMessageId,
422422
...(chatId ? { chatId } : {}),
423-
...(params.workspaceId ? { workspaceId: params.workspaceId } : {}),
423+
workspaceId: params.workspaceId,
424424
...(workflowId ? { workflowId } : {}),
425425
...(allContexts.length > 0 ? { context: allContexts } : {}),
426426
...(integrationTools.length > 0 ? { integrationTools } : {}),

‎apps/sim/lib/mothership/chat/post.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ type UnifiedChatBranch =
354354
kind: 'workflow'
355355
workflowId: string
356356
workflowName?: string
357-
workspaceId?: string
357+
/** Always present: the resolver's 'resolved' variant guarantees it (the workflow's
358+
* own workspace) — the wire contract requires it. */
359+
workspaceId: string
358360
effectiveModel: string
359361
selectedModel: string
360362
mode: UnifiedChatRequest['mode']
@@ -376,7 +378,7 @@ type UnifiedChatBranch =
376378
effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max'
377379
workflowId: string
378380
workflowName?: string
379-
workspaceId?: string
381+
workspaceId: string
380382
mode: UnifiedChatRequest['mode']
381383
provider?: string
382384
commands?: string[]

‎apps/sim/lib/mothership/generated/protocol.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export interface ChatRequest {
2525
protocolVersion?: number | undefined;
2626
messageId?: string | undefined;
2727
chatId?: string | undefined;
28-
workspaceId?: string | undefined;
28+
/** Required: memories, analytics, and the chat row all key on it — sim always resolves
29+
* it (workspace-scoped directly; workflow-scoped from the workflow). A missing value
30+
* used to FABRICATE a random workspace identity per request. */
31+
workspaceId: string;
2932
/** Workflow-scoped chats (the workflow-page copilot): the agent anchors to this workflow. */
3033
workflowId?: string | undefined;
3134
/** Connected-service operation schemas served by the integration gateway. */

0 commit comments

Comments
 (0)