Skip to content

Bug: wait action reports a duration it did not actually wait (30s cap and -1 adjustment invisible to the LLM) #5362

Open

Description

@GautamSharma99

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:

  1. long_term_memory reports the requested duration, not the actual one. memory is built from seconds while the sleep uses actual_seconds. The value goes into long_term_memory, so it persists in the agent's history for the rest of the run.
  2. 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.
  3. 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 - 1 is still present. The INFO log 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

  1. Call the registered wait action with any seconds value.
  2. 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

  1. jinngimk-lang commented on Aug 17, 2026

    @jinngimk-lang

    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.

  2. added a commit that references this issue on Aug 22, 2026
    d5b69c6
  3. added 2 commits that reference this issue on Sep 5, 2026
    d576e57
    ebb4082
  4. added a commit that references this issue on Sep 14, 2026
    71cfa5a
  5. jimpablo commented on Oct 11, 2026

    @jimpablo

    Taking this. wait still sleeps min(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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions