Skip to content

Commit 42d38fc

Browse files
waleedlatif1claude
andcommitted
fix(browser-use): coerce empty maxSteps strings to undefined
Mirrors the Stagehand block's handling so a cleared field doesn't pass through as ''. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 3c9154d commit 42d38fc

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

apps/sim/blocks/blocks/browser_use.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,14 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
151151
tool: () => 'browser_use_run_task',
152152
params: (params) => {
153153
const next: Record<string, any> = { ...params }
154-
if (typeof next.maxSteps === 'string' && next.maxSteps.trim() !== '') {
155-
const n = Number(next.maxSteps)
156-
next.maxSteps = Number.isFinite(n) ? n : undefined
154+
if (typeof next.maxSteps === 'string') {
155+
const trimmed = next.maxSteps.trim()
156+
if (trimmed === '') {
157+
next.maxSteps = undefined
158+
} else {
159+
const n = Number(trimmed)
160+
next.maxSteps = Number.isFinite(n) ? n : undefined
161+
}
157162
}
158163
if (next.vision === 'true') next.vision = true
159164
else if (next.vision === 'false') next.vision = false

0 commit comments

Comments
 (0)