Skip to content

Commit 48f6a8a

Browse files
committed
test(mship): update tool-call display title tests for client-derived titles
Display titles now come from the Sim-side name resolver, not the stream's ui.title/phaseLabel. Update the read lifecycle test to expect the name-derived title and drop the obsolete phaseLabel-fallback test.
1 parent e87adf0 commit 48f6a8a

1 file changed

Lines changed: 5 additions & 45 deletions

File tree

apps/sim/lib/copilot/request/handlers/handlers.test.ts

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,7 @@ describe('sse-handlers tool lifecycle', () => {
169169
executor: MothershipStreamV1ToolExecutor.sim,
170170
mode: MothershipStreamV1ToolMode.async,
171171
phase: MothershipStreamV1ToolPhase.call,
172-
ui: {
173-
title: 'Reading foo.txt',
174-
phaseLabel: 'Workspace',
175-
},
172+
ui: {},
176173
},
177174
} satisfies StreamEvent,
178175
context,
@@ -198,53 +195,16 @@ describe('sse-handlers tool lifecycle', () => {
198195

199196
const updated = context.toolCalls.get('tool-1')
200197
expect(updated?.status).toBe(MothershipStreamV1ToolOutcome.success)
201-
expect(updated?.displayTitle).toBe('Reading foo.txt')
198+
// Display titles are derived client-side from the tool name (+args), not the
199+
// stream; read with no path resolves to the static "Reading file".
200+
expect(updated?.displayTitle).toBe('Reading file')
202201
expect(updated?.result?.output).toEqual({ ok: true })
203202
expect(context.contentBlocks.at(0)).toEqual(
204203
expect.objectContaining({
205204
type: 'tool_call',
206205
toolCall: expect.objectContaining({
207206
id: 'tool-1',
208-
displayTitle: 'Reading foo.txt',
209-
}),
210-
})
211-
)
212-
})
213-
214-
it('uses phaseLabel as a display title fallback when no title is provided', async () => {
215-
executeTool.mockResolvedValueOnce({ success: true, output: { ok: true } })
216-
const onEvent = vi.fn()
217-
218-
await sseHandlers.tool(
219-
{
220-
type: MothershipStreamV1EventType.tool,
221-
payload: {
222-
toolCallId: 'tool-phase-label',
223-
toolName: ReadTool.id,
224-
arguments: { workflowId: 'workflow-1' },
225-
executor: MothershipStreamV1ToolExecutor.sim,
226-
mode: MothershipStreamV1ToolMode.async,
227-
phase: MothershipStreamV1ToolPhase.call,
228-
ui: {
229-
phaseLabel: 'Workspace',
230-
},
231-
},
232-
} satisfies StreamEvent,
233-
context,
234-
execContext,
235-
{ onEvent, interactive: false, timeout: 1000 }
236-
)
237-
238-
await sleep(0)
239-
240-
const updated = context.toolCalls.get('tool-phase-label')
241-
expect(updated?.displayTitle).toBe('Workspace')
242-
expect(context.contentBlocks.at(0)).toEqual(
243-
expect.objectContaining({
244-
type: 'tool_call',
245-
toolCall: expect.objectContaining({
246-
id: 'tool-phase-label',
247-
displayTitle: 'Workspace',
207+
displayTitle: 'Reading file',
248208
}),
249209
})
250210
)

0 commit comments

Comments
 (0)