Skip to content

Commit 5169122

Browse files
committed
fix(mothership): strip presentation activity before desktop browser dispatch
1 parent 60d0e1c commit 5169122

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

‎apps/sim/lib/mothership/tools/client/browser-tool-execution.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,27 @@ describe('executeBrowserToolOnClient', () => {
110110
expect(mockExecuteBrowserTool).toHaveBeenCalledTimes(1)
111111
})
112112

113+
it('never forwards presentation activity to the desktop driver', async () => {
114+
mockExecuteBrowserTool.mockResolvedValue({ completed: true, results: [] })
115+
const toolCallId = nextToolCallId()
116+
const fields = [{ elementId: 1, kind: 'text', text: 'a' }]
117+
executeBrowserToolOnClient(
118+
toolCallId,
119+
'browser_fill_form',
120+
{ activity: { description: 'Filling the form' }, fields },
121+
CHAT_SCOPE
122+
)
123+
await flush()
124+
expect(mockExecuteBrowserTool).toHaveBeenCalledWith(
125+
toolCallId,
126+
'browser_fill_form',
127+
{ fields },
128+
expect.anything(),
129+
CHAT_SCOPE,
130+
expect.any(Function)
131+
)
132+
})
133+
113134
it('reports a batch as failed only when one of its actions failed', async () => {
114135
const actions = [
115136
{ tool: 'browser_click', args: { elementId: 1 } },

‎apps/sim/lib/mothership/tools/client/browser-tool-execution.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,14 +898,16 @@ async function doExecuteBrowserTool(
898898

899899
logger.info('Executing browser tool via the desktop agent browser', { toolCallId, toolName })
900900

901+
/** `activity` is presentation metadata for the chat row; desktop actions reject unknown keys. */
902+
const { activity: _activity, ...actionParams } = params
901903
let result: unknown
902904
try {
903905
nativeDispatchStarted = true
904906
result = await executeBrowserTool(
905907
toolCallId,
906908
toolName,
907-
params,
908-
timeoutForTool(toolName, params),
909+
actionParams,
910+
timeoutForTool(toolName, actionParams),
909911
scopeId,
910912
() => {
911913
cancelled = true

0 commit comments

Comments
 (0)