Repository navigation
Description
Browser Use Version
0.13.7 (commit 71714137)
Bug Description
The wait action reports a duration to the LLM that it did not actually wait, and its explanatory comment contradicts the code.
browser_use/tools/service.py:597-608:
@self.registry.action('Wait for x seconds.')
async def wait(seconds: int = 3):
# Cap wait time at maximum 30 seconds
# Reduce the wait time by 3 seconds to account for the llm call which takes at least 3 seconds
# So if the model decides to wait for 5 seconds, the llm call took at least 3 seconds, so we only need to wait for 2 seconds
# Note by Mert: the above doesnt make sense because we do the LLM call right after this or this could be followed by another action after which we would like to wait
# so I revert this.
actual_seconds = min(max(seconds - 1, 0), 30)
memory = f'Waited for {seconds} seconds'
logger.info(f'🕒 waited for {seconds} second{"" if seconds == 1 else "s"}')
await asyncio.sleep(actual_seconds)
return ActionResult(extracted_content=memory, long_term_memory=memory)Three separate problems:
long_term_memoryreports the requested duration, not the actual one.memoryis built fromsecondswhile the sleep usesactual_seconds. The value goes intolong_term_memory, so it persists in the agent's history for the rest of the run.- The 30 s cap is invisible to the model. A request for 120 s sleeps 30 s and reports 120 s. The agent then concludes it has already waited two minutes and that the page must be broken, when only 30 seconds elapsed. That is a plausible path into a premature
done(success=False)or an unnecessary reload. - Comment and code disagree, and a stated revert never happened. The comment says "Reduce the wait time by 3 seconds"; the code subtracts 1. The note from Mert says the adjustment does not make sense and "so I revert this" — but the
- 1is still present. TheINFOlog line also prints the requested value rather than the actual one.
Measured:
wait(seconds=3) -> slept 2.00s, told the LLM: 'Waited for 3 seconds'
wait(seconds=120) -> slept 30.00s, told the LLM: 'Waited for 120 seconds'
Steps to Reproduce
- Call the registered
waitaction with anysecondsvalue. - Time the call and compare against the returned
long_term_memory.
Failing Python Code
import asyncio
import time
from browser_use.tools.service import Tools
wait_fn = Tools().registry.registry.actions['wait'].function
async def main():
for req in (3, 120):
t0 = time.monotonic()
r = await wait_fn(seconds=req)
print(f'wait(seconds={req}) -> slept {time.monotonic() - t0:.2f}s, reported: {r.long_term_memory!r}')
asyncio.run(main())Expected Behaviour
The reported duration matches the actual sleep, and when the request is capped the model is told so — for example Waited for 30 seconds (capped from the requested 120).
Actual Behaviour
The reported duration is the requested one regardless of what was actually slept.
Suggested Fix
Report actual_seconds, mention the cap when one was applied, log the actual value, and either delete the - 1 (completing the revert the comment describes) or update the comment to match whatever the intended behaviour is. Happy to open a PR — I would default to removing the - 1 per Mert's note, but that is a behavioural call so I would rather confirm the intent first.
LLM Model
Not model specific.
Operating System & Browser Versions
macOS (Darwin 25.5.0), Python 3.12.13. Not platform specific — no browser required to reproduce.
Full DEBUG Log Output
INFO [tools] 🕒 waited for 3 seconds
wait(seconds=3) -> slept 2.00s, told the LLM: 'Waited for 3 seconds'
INFO [tools] 🕒 waited for 120 seconds
wait(seconds=120) -> slept 30.00s, told the LLM: 'Waited for 120 seconds'
Activity
fix(tools): align wait tests and ruff format for browser-use#5362
jinngimk-lang commentedon Aug 17, 2026
This is one of my favorite “the agent is being lied to by its own runtime” bugs: request 120s, sleep 30s, persist “Waited for 120 seconds.” From that point on the planner is reasoning from fabricated execution history.
AgentCI is actively recruiting this class for a public Breaker corpus. A tiny accepted fixture can bind requested duration → effective duration/cap source → monotonic timestamps → memory/receipt text. If those disagree, the evidence itself should fail validation.
If you or another external agent contributes the deterministic timing fixture, we’ll preserve the upstream provenance and give durable public credit/backlink in the AgentCI Breaker Hall of Fame, plus help convert it into a cross-runtime regression shape.
AgentCI: https://github.com/jinngimk-lang/agentci
Challenge/recognition: https://github.com/jinngimk-lang/agentci/blob/main/COMMUNITY.md
We’re the AgentCI project; no Browser Use certification claim.
fix: report actual wait duration instead of the requested one
fix: report actual wait duration instead of the requested one
fix: report actual wait duration instead of the requested one
fix: report actual wait duration instead of the requested one
jimpablo commentedon Oct 11, 2026
Taking this.
waitstill sleepsmin(max(seconds - 1, 0), 30)and records the requested number, so a 1s wait sleeps 0s and a 120s wait sleeps 30s while telling the model it waited 120s. I'll report the sleep that actually happened, keep the 30s cap, and say so when the request is capped.