Skip to content

jev's wait sleeps in the VM, a page still loading is not a stall, and a capture that lags the screen gets a second look - #54

Open
awlevin wants to merge 11 commits into
mainfrom
jev-wait-pick
Open

awlevin wants to merge 11 commits into
mainfrom
jev-wait-pick

Conversation

@awlevin

@awlevin awlevin commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Builds on #53 (jev-no-wait, merged in): OSWorld's fixed wait is 0, so jev has to wait when it needs to, and only then.

Why

At 0 s, #53's run solved 1 of 6 tasks. Its causes:

  1. OSWorld takes the screenshot the moment the action ran, before Chrome has drawn it.
  2. jev's tree, fetched after the screenshot, is newer than it, so the two disagree (a menu in the tree, not on the capture).
  3. A refused action sends nothing, so no new observation comes, and jev re-reads the same stale screen.
  4. jev's wait was OSWorld's WAIT, which sleeps the fixed pause: 0 s.

What changes

  • wait really waits. 0.5 s, as a time.sleep in the step's code in the VM, which brings a new observation. On the Mac and Windows, sleep_watching(0.5) then the step's delay, as before but shorter. Its description now says to wait only while what the goal needs is not on the screen yet, so jev acts on a page that already shows it.

  • A page still loading is not a stall. The first 3 waits in a row (MAX_WAITS) do not count toward the idle limit. So they do not add to the stall or stuck counts either. The waits after them count as before, so a page that never finishes stalls after 6.

  • A capture that lags the screen gets a second look. Before a step decides, it looks once more, a wait's pause later, when:

    • (a) the screen seems to be as the last action left it. This covers a refused action, and a click whose menu is not drawn yet.
    • (b) 8 or more controls the tree puts on screen are not on the capture (screen.undrawn, from the existing drawn() check).

    It decides on the second look, whatever that shows: one more look, never a wait for a full settle. There is no second look after a wait. The step log and answers.json (looked_again) say why the step looked twice.

  • The OSWorld adapter never hands out WAIT: every pause is VM code.

  • Docs: how-a-step-works.md (action table, Stalls) and osworld.md. OBSERVATIONS.md has two new lines.

Replay

972 distinct captured classifier requests (all run folders, including #53's 0 s run) were replayed 3 ways: A (as captured), A2 (as captured, again), and B (only the wait text changed). TypeSafe cost: $0.67.

picks agree
A vs A2 (the classifier's own noise) 93.5%
A vs B 94.9%

Neither text picked wait on any request. Mean p(wait) went from 0.0024 to 0.0051, with a max of 0.09. Of the 22 requests where A and A2 agreed and B differed, none went to wait.

On 21 of those screens with the page's content removed, neither text picked wait either (p(wait) 0.02 → 0.04). That is why code, not the classifier, notices a capture that lags the screen.

Threshold for (b): on 384 saved OSWorld trees with their screenshots (2 s wait), 380 lacked 6 or fewer controls. The other 4 lacked 17 to 52: a menu or a page that Chrome had not drawn yet, while the tree already had it. So the threshold is 8.

Tests

  • Unit tests and run-level scenarios:
    • l16: a page that never loads stalls after MAX_WAITS + MAX_IDLE waits.
    • l16b: a page slower than the idle budget is waited out.
    • l16c: a wait neither counts nor clears the idle actions around it.
    • l16d: a menu drawn after the capture is seen on the second look.
    • l16e: no second look after a wait.
  • OSWorld agent tests: a wait is time.sleep(0.5) in the VM, and a refused action still brings a new observation.
  • uv run ruff check, uv run ruff format --check, and uv run pytest pass. tests/conftest.py is unchanged.

Added after batch 1 (e7854f0)

  • A menu item the capture has not drawn yet is clicked where the tree puts it. Chrome sometimes left a menu it had just opened unpainted on every capture for seconds, while its tree had the menu open. Examples: 2ad9387a's Organise menu and bb5e4c0d's Chrome menu. Its items reached the classifier as off-screen controls, and OSWorld refuses every press. Now, when the press is refused, an AXMenuItem in screen.undrawn gets a pointer click at its box. A page's own undrawn control still does not, because it may be clipped out of sight (the Chosen box on justice.gov).
  • A step with no action since the last capture does not look twice. Batch 1 spent 3–9 s on each second look after a writer hand-off. Batch 3 suggests this was a mistake (see below).

Cloud results (0 s wait, --ocr rapidocr, rows committed)

run code 2ad9387a 2ae9ba84 12086550 af630914 bb5e4c0d 9f935cce (not gated) solved
batch 1 (20260929T214238Z) 61beb6a ✗ 14 st, 68.6 s ✓ 12, 57.4 ✓ 6, 42.3 ✓ 8, 39.6 ✓ 15, 75.4 ✗ 50, 206.7 4/6
batch 2 (20260929T215827Z) e7854f0 ✓ 9, 45.1 ✓ 8, 50.8 ✓ 6, 42.2 ✓ 7, 34.6 ✓ 10, 47.9 ✗ 17, 72.5 5/6
batch 3 (20260929T223353Z) e7854f0 ✓ 13, 60.7 ✗ 4, 24.9 ✓ 6, 39.3 ✓ 9, 51.7 ✓ 12, 56.2 ✓ 7, 54.3 5/6
solo 2ad9387a (20260929T223021Z) e7854f0 ✓ 8, 22.4, $0.0019 1/1
rerun 2ae9ba84 (20260929T224043Z) e7854f0 ✗ 8, 21.1 0/1

Means (steps are OSWorld steps; cost is TypeSafe plus Luna as the writer):

solved solved: steps / s / $ failed: steps / s / $
2 s baseline (164943Z) 6/6 6.7 / 54.7 / 0.0030 –
#53 at 0 s, two batches 3/12 7.3 / 43.2 / 0.0031 4.4 / 29.0 / 0.0027
this PR, batches 2+3 (final code) 10/12 8.7 / 48.3 / 0.0028 10.5 / 48.7 / 0.0044
this PR, all three batches 14/18 9.1 / 49.8 / 0.0028 21.2 / 93.2 / 0.0071

Causes of the failures:

  • Batch 1, 2ad9387a: the Organise menu was open in the tree and never drawn. Two press_offscreen calls were refused, and a click closed the menu. Then came three low-confidence stops, and the writer's focus led into Chrome's own menu. The menu click added in e7854f0 targets this, and it solved the task in batch 2 and batch 3.
  • Batch 1, 9f935cce: it ran out of OSWorld's 50 steps (16 second looks, 9 writer reviews) on justice.gov.
  • Batch 2, 9f935cce: it ended on Civil Division "Documents and Forms", which the writer judged done. The checker wanted another page. It also refused type_text 7 times with no field focused.
  • Batch 3, 2ae9ba84: the capture after "Customise profile" was mid-change: the new URL, with the profile menu still drawn. The classifier stopped at 0.32, and the writer read that same stale capture. Its focus led to no action, and the run ended. The step after the hand-off did not look again (e7854f0's second change), so it decided on the stale screen again. This is a likely regression from that change.
  • Rerun, 2ae9ba84: the writer typed "Thomas" without Return, and the classifier said done. Chrome had not saved the name, so the checker read the old one. This is not about the wait.

In all 20 runs the classifier never chose wait. The pauses that helped were code's second looks (68 in all).

Next step, not tested in the cloud: restore the second look after a hand-off, or better, look again before the writer reviews a stop that came on the first capture after an action.

Also found: a results pull hung for 25 minutes after the IAP tunnel dropped. The _rsh shim in scripts/osworld-gcp runs gcloud SSH without KEEPALIVE. Adding "${KEEPALIVE[@]}" there would end a stalled pull within a minute, and the existing retry would then take over.

🤖 Generated with Claude Code

awlevin and others added 11 commits September 29, 2026 15:11
…chmark row says how long it waited

SLEEP_AFTER_EXECUTION in scripts/osworld goes from 2.0 to 0, and scripts/osworld-gcp adds it to
every row as sleep_after_execution, so a 0 s run is never read against a 2 s one. A row without
the field waited 2 s. jev's own code is unchanged; its wait kind is OSWorld's WAIT, which sleeps
that same pause, so it now waits nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mark task alone for jev and Luna

jev solved 1 and 2 of the six (6 of 6 at 2 s). Alone on one VM, jev solved the bookmark task in
28.4 s (42.3 s at 2 s), and Luna in 18.6 s (29.3 s). OBSERVATIONS.md keeps why most of the
six failed: the screenshot comes before Chrome draws, the tree read just after it disagrees, and
a refused action brings no new observation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a capture that lags the screen gets a second look

With OSWorld's fixed wait at 0 (jev-no-wait), jev's `wait` appended OSWorld's WAIT, which sleeps that
same 0. It is now a 0.5 s `time.sleep` in the step's code, which brings a new observation after it.
Its description says to wait only while what the goal needs is not on the screen yet, so jev acts on
a page that already shows it.

The first three waits in a row do not count toward the idle limit, so a page still loading neither
stalls nor adds to the stuck count; the waits after them count as before, so a page that never
finishes stalls after six.

A step also looks once more, a wait's pause later, before it decides, when the screen seems to be as
the last action left it (a refused action sends nothing, so OSWorld took no new observation, and a
click's menu may not be drawn yet), or when 8 or more controls the tree puts on screen are not on the
capture, which then predates the tree. It decides on the second look, however it looks.

Replay: 972 captured requests, old against new wait text, agreed on 94.9% of picks, against 93.5%
for the old text against itself; neither picked wait on any of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…4 of 6 solved

2ae9ba84, 12086550, af630914, and bb5e4c0d solved; 2ad9387a stopped at low confidence after
press_offscreen refusals on a Bookmarks Organise menu that Chrome had open but not drawn, and
9f935cce ran out of OSWorld's 50 steps. The classifier picked wait on no step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uts it, and a step the writer sent back looks once

At no wait, Chrome left a menu it had just opened unpainted on every capture for seconds while its
tree had the menu open (chrome/2ad9387a's Organise menu, chrome/bb5e4c0d's Chrome menu). Its items
reached the classifier as off-screen controls, and OSWorld refuses every press, so a second look did
not help. Such an item, a menu item the tree puts on the display, is now clicked at its box when the
press is refused; a page's own undrawn control still is not, since it may be clipped out of sight.

A step with no action since the last capture, as when the writer sends the classifier back to the
screen it stopped on, no longer looks twice: nothing is on its way to the screen. In the first batch
that second look took 3 to 9 s each time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry task the gate names among them

Solved in a mean of 8.0 OSWorld steps, 44.1 s, and $0.0026, against 53.4 s for the same five tasks
at the 2 s wait. 9f935cce, which the gate does not name, stopped at low confidence on justice.gov.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n 8 steps, 22.4 s, and $0.0019

Against 8 steps, 28.4 s, and $0.0033 for jev-no-wait's solo run of the same task. One step looked
twice, after a refused press, and the Organise menu was drawn this time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…2ae9ba84 flipped

2ae9ba84 stopped at low confidence on a capture taken as the profile page opened, with the profile
menu still drawn over it; the writer read that same capture, and its focus led to no action.
9f935cce solved this time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e no-wait runs taught

The rerun typed the name without Return and ended done, so the checker read the old name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant