fix(agent): correct step_interval calculation by vincent067 · Pull Request #4699 · browser-use/browser-use · GitHub
Skip to content

fix(agent): correct step_interval calculation#4699

Open
vincent067 wants to merge 2 commits intobrowser-use:mainfrom
vincent067:fix/step-interval-calculation
Open

fix(agent): correct step_interval calculation#4699
vincent067 wants to merge 2 commits intobrowser-use:mainfrom
vincent067:fix/step-interval-calculation

Conversation

@vincent067
Copy link
Copy Markdown

@vincent067 vincent067 commented Apr 18, 2026

🐛 Bug Fix

Fixes #4484

Problem

The step_interval in StepMetadata was incorrectly computing the duration of the previous step instead of the idle time gap between steps.

Changes

  • Fixed calculation in browser_use/agent/service.py (line 1358)
  • Changed from: max(0, previous_end_time - previous_start_time)
  • Changed to: max(0, self.step_start_time - previous_end_time)

Impact

Any monitoring or telemetry relying on step_interval now receives correct idle time data between steps.

Thanks to @warren618 for the clear bug report! 🙏


Summary by cubic

Corrected the step_interval calculation to measure idle time between steps instead of the previous step’s duration, ensuring accurate telemetry for step gaps. StepMetadata.step_interval now uses self.step_start_time - previous_end_time, fixing prior misreporting.

Written for commit e84d015. Summary will update on new commits.

The step_interval was incorrectly computing the duration of the previous
step instead of the idle time gap between steps.

Before: step_interval = previous_end_time - previous_start_time
After:  step_interval = self.step_start_time - previous_end_time

Fixes browser-use#4484
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StepMetadata.step_interval computes step duration instead of gap between steps

3 participants