Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(cu): effect-check scrolls and surface silent guard refusals (BUG-082)

Ruben Lütke97efc098eec1
diff --git a/docs/BUGS.md b/docs/BUGS.md
index ce19c21d28..7c51656efa 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -5658,3 +5658,49 @@ rebuild tests in `tests/unit/realtime/test_session.py` (133 green, 10 s).
first attempt when the target's waiter future has already completed.
Teardown must re-cancel on a bounded wait (or otherwise wake the awaited
resource) so a lost cancel degrades to a retry, never a permanent hang.
+
+## BUG-082: Computer-Use aborts mid-mission as "no progress" after one swallowed scroll — phantom scroll success + silent ledger refusals (HIGH, FIXED 2026-07-18)
+
+**Symptom.** A CU mission that ran fast and clean (Chrome → Gmail → open the
+LinkedIn email in 5 steps, 07:47 live run) suddenly stopped with
+`fail at step-10: no progress — the screen has not changed despite my
+actions`, ~5 s after its last visible action. The voice layer then invented a
+cause the mission never reached ("the unsubscribe link did not work" — no
+unsubscribe link was ever clicked). Flight recorder: steps 7–9 show
+observe+think but NO action, no refusal, no log line — the round dies
+invisibly.
+
+**Root cause (three interlocking defects).**
+1. *No effect-check for scroll:* the wheel event was dispatched (verified
+ move + SendInput), Gmail's reading pane never moved (pre/post screenshots
+ pixel-identical), yet the engine recorded `scroll ok` into history AND the
+ idempotency ledger — clicks are pre/post effect-checked, scrolls were not.
+2. *Direction-only ledger key:* `action_key` reduced every scroll to
+ `scroll@down`, so each retry the model sensibly proposed on the unchanged
+ frame was refused as a duplicate — regardless of position or amount.
+3. *Silent refusal paths:* the ledger/staleness/window-signature refusals
+ only appended to the model-facing history — no `log.info`, no progress
+ chunk, no flight-recorder event. Three silent refusals in a row satisfied
+ the `_STUCK_FRAMES` no-progress guard and the mission aborted with a
+ context-free reason the realtime voice model then embroidered.
+
+**Fix (2026-07-18).** (a) Scroll is now effect-checked exactly like clicks
+(pre/post `grab_region` + `frames_differ`); an ineffective scroll FAILS with
+actionable feedback (click the content area for scroll focus / use
+`key(["pagedown"])`/`key(["end"])`) and is bounded by
+`_MAX_CONSECUTIVE_FAILURES`. (b) Scroll is exempt from the ledger (it can no
+longer run blindly, and re-scrolling a similar-looking long page is
+legitimate progress). (c) Every refusal path (`REFUSED`/`SKIPPED`/`done
+REJECTED`) now logs and yields a progress chunk. (d) The no-progress abort
+names the last real attempts so the voice layer reports the true cause.
+Guards: `tests/unit/cu/test_engine_loop.py::
+test_ineffective_scroll_fails_with_keyboard_hint`,
+`::test_repeated_ineffective_scroll_aborts_with_honest_reason`.
+
+**Class rule.** Every state-changing CU action needs a closed verification
+loop — "the OS accepted the input" is not "the app reacted"; an action class
+without an effect-check (scroll was one) silently corrupts both the model's
+history and the dedup ledger, and the two errors compound. And guard paths
+that refuse an action must be OBSERVABLE (log + progress + recorder event):
+a guard that only whispers to the model turns every interaction bug into an
+unexplainable early abort.
diff --git a/jarvis/cu/engine.py b/jarvis/cu/engine.py
index 3f4d33108a..193ecff162 100644
--- a/jarvis/cu/engine.py
+++ b/jarvis/cu/engine.py
@@ -801,10 +801,17 @@ async def run_cu_loop(
stdout=f"[cu] done (verified: {proof})\n", exit_code=_EXIT_OK,
)
else:
+ # Name the last real attempts: a bare "no progress" invites
+ # the voice layer to invent a cause (live run 2026-07-18:
+ # "the unsubscribe link did not work" was never attempted —
+ # the mission died scrolling).
+ recent = "; ".join(h[:140] for h in history[-2:])
yield _final(
stderr=(
f"[cu] fail at step-{step_idx}: no progress — the "
- "screen has not changed despite my actions.\n"
+ "screen has not changed despite my actions."
+ + (f" Last attempts: {recent}" if recent else "")
+ + "\n"
),
exit_code=_EXIT_FAIL,
)
@@ -952,11 +959,14 @@ async def run_cu_loop(
exit_code=_EXIT_FAIL,
)
return
- history.append(
+ msg = (
f"step {step_idx}: done REJECTED by the verifier"
+ (f" — {proof}" if proof else "")
- + " — keep working toward visible proof",
+ + " — keep working toward visible proof"
)
+ history.append(msg)
+ log.info("[cu] %s", msg)
+ yield _progress(f"[cu] {msg}")
break # re-perceive
if kind == "fail":
@@ -973,11 +983,14 @@ async def run_cu_loop(
# omission is resolved to this frame's capture center below.
is_pointer = kind in ("click", "click_element", "drag", "scroll")
if is_pointer and pointer_used:
- history.append(
+ msg = (
f"step {step_idx}: {_summarize_action(action)} SKIPPED — "
"only one pointer action per screenshot; the screen may "
- "have changed",
+ "have changed"
)
+ history.append(msg)
+ log.info("[cu] %s", msg)
+ yield _progress(f"[cu] {msg}")
break # re-perceive before the next pointer action
# -- resolve coordinates through THIS frame's mapper -----------
@@ -1033,20 +1046,26 @@ async def run_cu_loop(
await asyncio.to_thread(list_monitors),
)
if live_topology != captured_topology:
- history.append(
+ msg = (
f"step {step_idx}: {_summarize_action(action)} REFUSED — "
"the display layout changed after the screenshot; "
"capturing fresh geometry before any pointer action."
)
+ history.append(msg)
+ log.info("[cu] %s", msg)
+ yield _progress(f"[cu] {msg}")
break
if ledger.is_duplicate(action, frame.thumb, resolved_xy=resolved_xy):
guard_hits += 1
- history.append(
+ msg = (
f"step {step_idx}: {_summarize_action(action)} REFUSED — "
"this exact action already ran on this unchanged screen; "
- "the screen did not react. Choose a DIFFERENT action.",
+ "the screen did not react. Choose a DIFFERENT action."
)
+ history.append(msg)
+ log.info("[cu] %s", msg)
+ yield _progress(f"[cu] {msg}")
if guard_hits >= _MAX_GUARD_HITS:
yield _final(
stderr=(
@@ -1060,11 +1079,14 @@ async def run_cu_loop(
if kind in {"click", "click_element", "drag", "scroll", "type", "key"}:
if await _live_window_state_signature() != captured_window_signature:
- history.append(
+ msg = (
f"step {step_idx}: {_summarize_action(action)} REFUSED — "
"the foreground window changed after the screenshot; "
"capturing a fresh frame before acting."
)
+ history.append(msg)
+ log.info("[cu] %s", msg)
+ yield _progress(f"[cu] {msg}")
break
# -- execute ------------------------------------------------------
@@ -1294,10 +1316,36 @@ async def run_cu_loop(
"_expected_window_signature": captured_window_signature,
}
pointer_used = True
+ pre = await asyncio.to_thread(grab_region, monitor.bbox)
ok, detail = await _dispatch_tool(ctx, "scroll", args, trace_id)
- if ok:
- ledger.record(action, frame.thumb)
profiler.add("act", t0, step_idx)
+ t0 = time.monotonic()
+ if ok:
+ # Effect-check, same contract as clicks: a wheel event the
+ # OS accepted but the app visibly ignored is a FAILED
+ # action, not a success. Recording it as "ok" fed the
+ # model a phantom scroll; its identical retry was then
+ # silently refused by the ledger and the mission died as
+ # an opaque "no progress" (live run 2026-07-18 07:47,
+ # Gmail reading pane never moved).
+ await asyncio.sleep(_EFFECT_SETTLE_S * settle_scale)
+ post = await asyncio.to_thread(grab_region, monitor.bbox)
+ from jarvis.cu.capture import frames_differ # noqa: PLC0415
+
+ if (
+ pre is not None
+ and post is not None
+ and not frames_differ(pre, post)
+ ):
+ ok = False
+ detail = (
+ "the scroll had NO visible effect — the surface "
+ "under the pointer did not move. Do NOT repeat "
+ "the same scroll. Click once inside the content "
+ "area to give it scroll focus, or scroll by "
+ 'keyboard: key(["pagedown"]) or key(["end"]).'
+ )
+ profiler.add("verify", t0, step_idx)
elif kind == "drag":
assert resolved_xy is not None
diff --git a/jarvis/cu/ledger.py b/jarvis/cu/ledger.py
index 602b82b490..a5389c1b3f 100644
--- a/jarvis/cu/ledger.py
+++ b/jarvis/cu/ledger.py
@@ -18,6 +18,14 @@ moved is exactly the double-action bug class and is blocked regardless of
what the model asks for.
``wait`` is exempt (waiting twice is harmless and sometimes right).
+
+``scroll`` is exempt too (2026-07-18): the engine effect-checks every scroll
+— a wheel event the app visibly ignored FAILS the action with feedback, so a
+scroll can no longer "run blindly". And a repeated scroll on a similar-looking
+frame is often legitimate forward progress (long uniform pages); the old
+direction-only key (``scroll@down``) refused every retry silently, which
+starved the no-progress guard into an opaque early abort (live Gmail run,
+07:47: unsubscribe hunt died after one swallowed wheel event).
"""
from __future__ import annotations
@@ -41,7 +49,10 @@ def action_key(action: dict[str, Any]) -> str | None:
"""Stable identity key for one validated action, or ``None`` when the
action kind is exempt from deduplication (``wait``/``done``/``fail``)."""
kind = action.get("action")
- if kind in (None, "wait", "done", "fail"):
+ if kind in (None, "wait", "done", "fail", "scroll"):
+ # scroll: effect-checked by the engine (an ineffective wheel event
+ # fails the action outright), and re-scrolling a page that still
+ # looks similar is legitimate progress — see the module docstring.
return None
if kind == "click_element":
return f"click_element@{_norm_text(str(action.get('name', '')))}"
@@ -50,8 +61,6 @@ def action_key(action: dict[str, Any]) -> str | None:
if kind == "key":
keys = "+".join(_norm_text(str(k)) for k in action.get("keys", []))
return f"key@{keys}"
- if kind == "scroll":
- return f"scroll@{action.get('direction')}"
if kind in ("open_app", "switch_window"):
return f"{kind}@{_norm_text(str(action.get('name', '')))}"
if kind == "drag":
diff --git a/tests/unit/cu/test_engine_loop.py b/tests/unit/cu/test_engine_loop.py
index f61cb9066a..9269ee9293 100644
--- a/tests/unit/cu/test_engine_loop.py
+++ b/tests/unit/cu/test_engine_loop.py
@@ -362,6 +362,56 @@ async def test_coordinate_less_scroll_targets_capture_center_and_stales_batch(pa
assert any("only one pointer action" in user for _system, user in brain.calls)
+async def test_ineffective_scroll_fails_with_keyboard_hint(patched):
+ # Live run 2026-07-18 07:47 (Gmail unsubscribe hunt): the wheel event was
+ # dispatched but the reading pane never moved. The old engine recorded a
+ # phantom "scroll ok"; every retry was then silently refused as a ledger
+ # duplicate and the mission died as an opaque "no progress". An
+ # ineffective scroll must FAIL with actionable feedback so the model can
+ # switch to keyboard scrolling — and that keyboard fallback must run.
+ patched.region_changes_after_click = False # pre == post → no effect
+ brain = FakeBrain([
+ '{"action":"scroll","direction":"down","amount":5}',
+ '{"action":"key","keys":["pagedown"]}',
+ '{"action": "done", "reason": "scrolled"}',
+ '{"done": true, "proof": "the unsubscribe link is visible"}',
+ ])
+ executor = FakeExecutor()
+
+ chunks = await _run(_ctx(brain, executor))
+
+ assert _final(chunks).exit_code == 0
+ assert any("NO visible effect" in user for _system, user in brain.calls), (
+ "the model must be told the scroll did not move anything"
+ )
+ assert any(name == "hotkey" for name, _args in executor.calls), (
+ "the keyboard fallback the hint suggests must not be blocked"
+ )
+
+
+async def test_repeated_ineffective_scroll_aborts_with_honest_reason(patched):
+ # Worst case: the model stubbornly re-issues the same dead scroll. The
+ # abort must carry the real cause (scroll had no effect) instead of the
+ # bare "no progress" the voice layer previously embroidered into a
+ # fabricated story ("the unsubscribe link did not work").
+ patched.region_changes_after_click = False
+ brain = FakeBrain(['{"action":"scroll","direction":"down","amount":5}'] * 6)
+ executor = FakeExecutor()
+
+ chunks = await _run(_ctx(brain, executor))
+
+ final = _final(chunks)
+ assert final.exit_code == 5
+ assert "NO visible effect" in final.stderr, (
+ "the no-progress abort must name the last real attempts"
+ )
+ scrolls = [name for name, _args in executor.calls if name == "scroll"]
+ assert len(scrolls) >= 2, (
+ "retrying an ineffective scroll must stay allowed (no silent ledger "
+ "refusal) so the failure surfaces as FAILED feedback instead"
+ )
+
+
async def test_done_judge_reuses_the_step_frame_when_no_action_ran(patched):
# "Say you are done FAST": when `done` arrives before any action of the
# batch executed, the screen is exactly the frame the model saw — the