Skip to content

Commit 138a5d1

Browse files
committed
Report requested Mothership model without legacy telemetry defaults
1 parent 31231ba commit 138a5d1

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,16 +1804,27 @@ describe('handleUnifiedChatPost copilot.use capability gate', () => {
18041804

18051805
expect(response.status).toBe(200)
18061806
expect(createSSEStream).toHaveBeenCalledTimes(1)
1807+
expect(startCopilotOtelRoot.mock.results.at(-1)?.value.setRequestShape).toHaveBeenCalledWith(
1808+
expect.objectContaining({ model: undefined })
1809+
)
18071810
})
18081811

18091812
/** A personal workspace, or any non-enterprise organization, is governed by no group. */
18101813
it('streams the send when no permission group governs the user', async () => {
18111814
resolvePermissionGroupConfig.mockResolvedValue(null)
18121815

1813-
const response = await handleUnifiedChatPost(chatRequest({ createNewChat: true }))
1816+
const response = await handleUnifiedChatPost(
1817+
chatRequest({
1818+
createNewChat: true,
1819+
modelSelection: { model: 'gpt-6-astra', fastMode: false },
1820+
})
1821+
)
18141822

18151823
expect(response.status).toBe(200)
18161824
expect(createSSEStream).toHaveBeenCalledTimes(1)
1825+
expect(startCopilotOtelRoot.mock.results.at(-1)?.value.setRequestShape).toHaveBeenCalledWith(
1826+
expect.objectContaining({ model: 'gpt-6-astra' })
1827+
)
18171828
})
18181829

18191830
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,8 +1117,8 @@ export async function handleUnifiedChatPost(req: NextRequest) {
11171117
activeOtelRoot.setRequestShape({
11181118
branchKind: branch.kind,
11191119
mode: body.mode,
1120-
model: branch.effectiveModel,
1121-
provider: body.provider,
1120+
/** Only the explicit selection is known here; the worker resolves the default and provider. */
1121+
model: body.modelSelection?.model,
11221122
createNewChat: body.createNewChat,
11231123
prefetch: body.prefetch,
11241124
fileAttachmentsCount: body.fileAttachments?.length ?? 0,

‎apps/sim/lib/mothership/request/lifecycle/start.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ describe('requestChatTitle billing protocol', () => {
534534

535535
expect(fetchGo.mock.calls[0]?.[1]?.signal).toBe(signal)
536536
expect(title).toBe('Billing Protocol')
537+
expect(fetchGo.mock.calls[0]?.[1]?.attributes).toBeUndefined()
537538
const headers = fetchGo.mock.calls[0]?.[1]?.headers as Record<string, string>
538539
const billingRequestId = headers['x-sim-billing-request-id']
539540
expect(billingRequestId).toMatch(

‎apps/sim/lib/mothership/request/lifecycle/start.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,6 @@ export async function requestChatTitle(params: {
588588
chatId,
589589
message,
590590
model,
591-
provider,
592591
userId,
593592
workspaceId,
594593
organizationId,
@@ -646,10 +645,6 @@ export async function requestChatTitle(params: {
646645
otelContext,
647646
spanName: 'sim → go /api/generate-chat-title',
648647
operation: 'generate_chat_title',
649-
attributes: {
650-
[TraceAttr.GenAiRequestModel]: model,
651-
...(provider ? { [TraceAttr.GenAiSystem]: provider } : {}),
652-
},
653648
})
654649

655650
const payload = await response.json().catch(() => ({}))

0 commit comments

Comments
 (0)