Skip to content

Commit a136785

Browse files
authored
fix take step (#3037)
Auto-generated PR for: fix take step <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes first-step detection in take_step by checking step_info.step_number == 1 instead of relying on empty history. This ensures initial actions run only on the true first step. - **Bug Fixes** - Run initial startup only when step_number is 1, preventing accidental re-runs on resumed or cleared histories. <!-- End of auto-generated description by cubic. -->
2 parents a0f8a45 + 6eed723 commit a136785

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

browser_use/agent/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ async def take_step(self, step_info: AgentStepInfo | None = None) -> tuple[bool,
13121312
Returns:
13131313
Tuple[bool, bool]: (is_done, is_valid)
13141314
"""
1315-
if len(self.history.history) == 0:
1315+
if step_info is not None and step_info.step_number == 1:
13161316
# First step
13171317
self._log_first_step_startup()
13181318
await self._execute_initial_actions()

0 commit comments

Comments
 (0)