Description
The asynchronous call_gpt_4o_with_ocr function begins its main work with time.sleep(1). Because this synchronous sleep runs on the event-loop thread, every invocation pauses unrelated coroutines and timers for one second before the model setup proceeds.
Replacing it with await asyncio.sleep(1) would preserve the intended delay without blocking the loop. If the delay is unnecessary, removing it would avoid the pause entirely. Other synchronous operations in this function may also merit review separately.
Observed Behavior
The release-source harness exercised the exact time.sleep call expression with a controlled delay of about 30 ms. The call took about 30 ms, and no event-loop heartbeat ran during it despite six expected opportunities. No external service was contacted.
Affected Version
Confirmed in self-operating-computer 1.5.8 at operate/models/apis.py:317, in call_gpt_4o_with_ocr. The current repository version retains time.sleep(1) in the asynchronous function.
Reproduction
Run the PoC below from its material directory with Python 3.10, alongside the shared _site_harness.py, inputs/sites.json, and result.json. A reproduced result records approximately 30 ms in the blocking call and zero heartbeats while it runs.
PoC Source Code
#!/usr/bin/env python3
from pathlib import Path
import sys
POC_ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(POC_ROOT))
from _site_harness import run
REPO_ROOT = next(
parent
for parent in Path(__file__).resolve().parents
if (parent / "artifacts").is_dir()
)
if __name__ == "__main__":
raise SystemExit(run(Path(__file__).with_name("inputs") / "sites.json", Path(__file__).with_name("result.json"), REPO_ROOT))
Description
The asynchronous
call_gpt_4o_with_ocrfunction begins its main work withtime.sleep(1). Because this synchronous sleep runs on the event-loop thread, every invocation pauses unrelated coroutines and timers for one second before the model setup proceeds.Replacing it with
await asyncio.sleep(1)would preserve the intended delay without blocking the loop. If the delay is unnecessary, removing it would avoid the pause entirely. Other synchronous operations in this function may also merit review separately.Observed Behavior
The release-source harness exercised the exact
time.sleepcall expression with a controlled delay of about 30 ms. The call took about 30 ms, and no event-loop heartbeat ran during it despite six expected opportunities. No external service was contacted.Affected Version
Confirmed in
self-operating-computer1.5.8 atoperate/models/apis.py:317, incall_gpt_4o_with_ocr. The current repository version retainstime.sleep(1)in the asynchronous function.Reproduction
Run the PoC below from its material directory with Python 3.10, alongside the shared
_site_harness.py,inputs/sites.json, andresult.json. A reproduced result records approximately 30 ms in the blocking call and zero heartbeats while it runs.PoC Source Code