fix(mothership): default chat effort back to high (#8659) · simstudioai/sim@648bf45 · GitHub
Skip to content

Commit 648bf45

Browse files
authored
fix(mothership): default chat effort back to high (#8659)
* fix(mothership): default chat effort back to high * test(mothership): pin that a send carries effort only when the user picked one The default flip reaches a chat only if admission never records the default as a pick. The composer already sends effort only for a real pick; this pins it for new and existing chats.
1 parent 777b3e9 commit 648bf45

5 files changed

Lines changed: 45 additions & 7 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.dom.test.tsx‎

Lines changed: 32 additions & 1 deletion

‎apps/sim/executor/handlers/mothership/mothership-handler.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,13 @@ describe('MothershipBlockHandler', () => {
10951095
})
10961096
})
10971097

1098+
it('runs a block with no effort set at high', async () => {
1099+
fetchMock.mockResolvedValue(new Response(JSON.stringify({ content: 'done' })))
1100+
await handler.execute(context, block, { prompt: 'hello' })
1101+
const body = JSON.parse(String(fetchMock.mock.calls[0]?.[1]?.body))
1102+
expect(body.effort).toBe('high')
1103+
})
1104+
10981105
it.each([true, false])('uses deployment agent-event opt-in: %s', async (agentEvents) => {
10991106
context.stream = true
11001107
context.selectedOutputs = [`${block.id}_content`]

‎apps/sim/lib/mothership/chat/application/set-effort.integration.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('a chat keeps the effort its owner picked', () => {
7878
await setChatEffort.execute({ principal: owner, input: { chatId: picked, effort: 'low' } })
7979

8080
expect(await loadEffort(untouched)).toBeNull()
81-
expect(await nextTurnEffort(untouched)).toBe('medium')
81+
expect(await nextTurnEffort(untouched)).toBe('high')
8282
expect(await nextTurnEffort(picked)).toBe('low')
8383
const [row] = await db
8484
.select({ config: copilotChats.config })
@@ -96,7 +96,7 @@ describe('a chat keeps the effort its owner picked', () => {
9696
it('reads a stored value outside the effort range as no pick', async () => {
9797
const chatId = await createChat({ effort: 'turbo' })
9898
expect(await loadEffort(chatId)).toBeNull()
99-
expect(await nextTurnEffort(chatId)).toBe('medium')
99+
expect(await nextTurnEffort(chatId)).toBe('high')
100100
})
101101

102102
it("refuses to change another user's chat in a shared workspace", async () => {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ describe('handleUnifiedChatPost', () => {
814814
['xhigh', 'xhigh'],
815815
['max', 'xhigh'],
816816
['low', 'low'],
817-
['none', 'medium'],
817+
['none', 'high'],
818818
])(
819819
'enforces the default model and effort range on submitted %s effort',
820820
async (effort, expected) => {
@@ -841,8 +841,8 @@ describe('handleUnifiedChatPost', () => {
841841
)
842842

843843
it.each([
844-
{ stored: null, sent: undefined, runs: 'medium' },
845-
{ stored: 'high', sent: undefined, runs: 'high' },
844+
{ stored: null, sent: undefined, runs: 'high' },
845+
{ stored: 'medium', sent: undefined, runs: 'medium' },
846846
{ stored: 'low', sent: undefined, runs: 'low' },
847847
{ stored: 'high', sent: 'low', runs: 'low' },
848848
{ stored: 'high', sent: 'max', runs: 'xhigh' },

‎apps/sim/lib/mothership/model-options.ts‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)