E2B icon indicating copy to clipboard operation
E2B copied to clipboard

waitForTimeout and wait_for_timeout truncate millisecond waits

Open Elon-Jiang opened this issue 2 weeks ago • 1 comments

wait_for_timeout(1500) and waitForTimeout(1500) currently produce sleep 1, so a template becomes ready about 500 ms before the requested duration. Both public helpers document milliseconds and a minimum of one second; values above that minimum should keep their fractional seconds.

import subprocess
import time
from e2b import wait_for_timeout

cmd = wait_for_timeout(1500).get_cmd()
start = time.monotonic()
subprocess.run(cmd, shell=True, check=True)
print(cmd, time.monotonic() - start)
# main: sleep 1, about 1.02 seconds
# expected: sleep 1.5, at least 1.5 seconds

Reproduced on main 3e72be3f08ec1a258ec0253c153df7ceed739f10, Python 3.12.13 on macOS arm64; the JavaScript regression also fails on the unchanged source. The whole-second and one-second-minimum controls pass. This runs the actual local shell command; it does not require or exercise a cloud sandbox.

A minimal fix and regression tests for both SDKs are prepared with Codex assistance under the contributor's authorization.

Elon-Jiang avatar Nov 13 '26 08:11 Elon-Jiang

Triage

  • type: bug
  • priority: medium
  • complexity: trivial
  • affected_area: js-sdk/template readycmd + python-sdk/template readycmd (waitForTimeout / wait_for_timeout)
  • actionable: yes
  • needs_clarification: false
  • summary: waitForTimeout(ms) / wait_for_timeout(ms) floor the millisecond timeout to whole seconds (e.g. 1500 ms → sleep 1), so templates become ready early; non-whole-second values above the 1 s minimum should keep fractional seconds (e.g. sleep 1.5) in both SDKs.

Written by Devin