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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
chore: auto-save WIP via Claude stop-hook safety net (2026-07-02 19:36)
Ruben Lütkeff9015aeb61a
diff --git a/docs/BUGS.md b/docs/BUGS.mdindex 1cf425e4e2..946a331ba2 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -2765,3 +2765,62 @@ content; revert to the energy gate.**Endgame.** Truly instant + zero-ghost custom wake needs a trained neural KWSmodel (openWakeWord `custom_onnx`), which does not transcribe (AP-25).++## BUG-038: Computer-Use stalls AT its goal — false-miss verification on secondary monitors (HIGH, 2026-07-02)++**Symptom.** A mission opens Chrome (guest), clicks land pixel-perfect on the+window — on whatever monitor it sits — then the agent "gets stuck": it clicks+the address bar repeatedly, never types, and finally gives up with "I tried it+on screen but could not do it". Live run 19:05–19:06: steps 2–4 OK (including+negative-X clicks on the left monitor), steps 5+7 `click(address bar) ->+FAILED: the click produced NO visible change`, mission aborted.++**Root causes — THREE stacked verification defects, none of them pointing.**++1. **Idempotent-click false miss.** The flight-recorder frames show the guest+ new-tab's address bar was focused BEFORE the click (blue ring + caret). A+ click on a control that is already in the desired state changes ZERO+ pixels, so the pre/post effect-check judged it a miss; a failed action+ truncates the batch, so the type behind it never ran; the retry hit the+ same false miss; the mission died at a state that was already correct.+2. **Primary-monitor clipping of the accessibility tree.** Every UI-tree+ source clipped its on-screen overlap filter to the PRIMARY monitor+ (Windows `GetSystemMetrics(0/1)`, macOS `CGMainDisplayID`, Linux a+ hardcoded 1920x1080 — which even clipped a single 4K screen). A window on+ a secondary monitor lost its ENTIRE walked tree: no clickable anchors, no+ field-content hints, no focus evidence. (Verified live: a Chrome window at+ x=-2324 produced a 1-node tree.)+3. **Confident-but-wrong type read-back.** `typed_text_landed` returned a+ hard `False` whenever readable editables lacked the text — even when the+ REAL receiver (start-menu/UWP flyout) was outside the enumerated tree or+ had not committed the value yet (18:00 run: `typed 'Spotify' but it did+ NOT land in any editable field` while the text had landed).++**Fix (all three platforms, one seam each).**+- **Focus-evidence click rescue** (`jarvis/cu/verify.py::+ verify_click_focus_point`, consumed by the engine's click-miss path only —+ zero happy-path latency): before declaring a zero-pixel-change click a+ miss, ask (a) the native point hit-test (UIA `ElementFromPoint` / AX+ element-at-position / AT-SPI `getAccessibleAtPoint`; depth- and+ pruning-independent, new `PointerElement.focused` field) and (b) the walked+ tree, whether the click point sits inside the FOCUSED control. Container+ focus (window/pane/document/web-area) NEVER counts — accepting it would+ rescue genuine in-window misses (`_FOCUS_CONTAINER_ROLES`).+- **Virtual-desktop on-screen filter**+ (`jarvis/platform/monitors.py::virtual_desktop_bounds`, union of all+ monitors per platform: `SM_*VIRTUALSCREEN` under the PMv2 declaration /+ `CGGetActiveDisplayList` / X11 root geometry) used by all three tree+ sources; injected bounds and legacy fallbacks preserved.+- **Honest type verdict**: `typed_text_landed` says `False` only when a+ FOCUSED editable was readable (we provably looked at the receiving+ surface), else `None`; the engine re-verifies once after a short settle+ before failing a type (async surfaces commit late).++**Live proof (Windows, 2026-07-02):** fresh Chrome on the LEFT monitor —+hit-test at the omnibox returns `Edit 'Adress- und Suchleiste' focused=True`,+rescue verdict `True`; mid-page point returns `False` (real misses still+fail). Guards: `tests/unit/cu/test_engine_loop.py` (rescued click lets the+batched type run; re-checked type verdict), `tests/unit/cu/+test_conventions_ledger_verify.py` (container trap, focused-editable+evidence), `tests/unit/vision/test_screen_bounds_virtual_desktop.py`+(secondary-monitor tree survives; per-OS bounds helpers).diff --git a/jarvis/cu/verify.py b/jarvis/cu/verify.pyindex 937fe0f9c4..d0213d01b1 100644--- a/jarvis/cu/verify.py+++ b/jarvis/cu/verify.py@@ -47,6 +47,7 @@ _PASSWORD_FIELD_TOKENS = ("password", "passwort", "passcode") # noqa: S105 —# Cached UI tree source (constructing one per step pays setup cost for the# same foreground enumeration)._UI_TREE_SOURCE: Any = None+_POINTER_RESOLVER: Any = Nonedef _get_ui_tree_source() -> Any:@@ -58,6 +59,18 @@ def _get_ui_tree_source() -> Any:return _UI_TREE_SOURCE+def _get_pointer_resolver() -> Any:+ """Cached per-OS accessibility point resolver (hit-test at a point)."""+ global _POINTER_RESOLVER+ if _POINTER_RESOLVER is None:+ from jarvis.vision.element_at_point import ( # noqa: PLC0415+ make_pointer_resolver,+ )++ _POINTER_RESOLVER = make_pointer_resolver()+ return _POINTER_RESOLVER++# ---------------------------------------------------------------------------# Pure node inspections (ported from the legacy engine, behavior-identical)# ---------------------------------------------------------------------------@@ -103,10 +116,27 @@ def typed_text_landed(nodes: tuple, typed: str) -> bool | None:return False if focused_editable_seen else None+#: Roles that are CONTAINERS, not controls — focus reported on one of these+#: (a browser window, a web view, a panel) is NOT evidence that a click hit+#: its intended target: accepting it would rescue every in-window miss and+#: neuter the effect-check. Covers all three role vocabularies (UIA / AX /+#: AT-SPI), since the point resolver returns platform-native role names.+_FOCUS_CONTAINER_ROLES = frozenset({+ # UIA (also the mapped vocabulary of the walked tree nodes)+ "Window", "Pane", "Document", "Group", "Custom", "TitleBar",+ # macOS AX+ "AXWindow", "AXSheet", "AXGroup", "AXScrollArea", "AXWebArea",+ "AXApplication", "AXDrawer",+ # AT-SPI role names+ "frame", "window", "panel", "application", "document frame",+ "document web", "filler",+})++def click_point_in_focused_element(nodes: tuple, x: int, y: int,) -> bool | None:- """Did the click point land inside the element HOLDING keyboard focus?+ """Did the click point land inside the CONTROL holding keyboard focus?The rescue evidence for the "click produced no visible change" falsemiss: clicking a control that is ALREADY in the desired state (e.g. an@@ -118,8 +148,11 @@ def click_point_in_focused_element(nothing visibly changed. Works on all three platforms (UIA / AX /AT-SPI bounds are screen input units).- ``True`` — a focused element's bounds contain the point.- ``False`` — nodes are readable, no focused element contains the point.+ Container roles never count (:data:`_FOCUS_CONTAINER_ROLES`): a focused+ WINDOW containing the point says nothing about the click's target.++ ``True`` — a focused non-container element's bounds contain the point.+ ``False`` — nodes are readable, no qualifying element contains the point.``None`` — no nodes readable (cannot tell)."""if not nodes:@@ -127,6 +160,8 @@ def click_point_in_focused_element(for node in nodes:if not getattr(node, "focused", False):continue+ if str(getattr(node, "role", "") or "") in _FOCUS_CONTAINER_ROLES:+ continuebounds = getattr(node, "bounds", None)if not bounds:continue@@ -354,11 +389,35 @@ async def verify_click_focus(name: str) -> bool | None:async def verify_click_focus_point(x: int, y: int) -> bool | None:- """Fresh tree → :func:`click_point_in_focused_element`. Error → ``None``.+ """Is the element at ``(x, y)`` the focused control? Error → ``None``.++ Two evidence paths, positive-only, both cross-platform:- Runs ONLY on the click-miss path (no happy-path latency): the engine+ 1. Native point hit-test (UIA ``ElementFromPoint`` / AX element-at-+ position / AT-SPI ``getAccessibleAtPoint``) — depth- and pruning-+ independent, so it works even where the walked tree cannot reach the+ control (Chrome nests its omnibox below the walk depth).+ 2. Fallback: scan the walked foreground tree+ (:func:`click_point_in_focused_element`).++ Container focus never counts (:data:`_FOCUS_CONTAINER_ROLES`). Runs+ ONLY on the click-miss path (no happy-path latency): the engineconsults it before declaring a zero-pixel-change click a miss."""+ try:+ element = await asyncio.wait_for(+ asyncio.to_thread(_get_pointer_resolver().at, int(x), int(y)),+ timeout=UIA_TIMEOUT_S,+ )+ except Exception: # noqa: BLE001 — hit-test is best-effort+ element = None+ if (+ element is not None+ and getattr(element, "focused", None) is True+ and str(getattr(element, "role", "") or "")+ not in _FOCUS_CONTAINER_ROLES+ ):+ return Truetry:obs = await asyncio.wait_for(_get_ui_tree_source().observe(), timeout=UIA_TIMEOUT_S,diff --git a/jarvis/vision/element_at_point.py b/jarvis/vision/element_at_point.pyindex e80b9b8573..00eece1f67 100644--- a/jarvis/vision/element_at_point.py+++ b/jarvis/vision/element_at_point.py@@ -137,6 +137,13 @@ def _win_query_element_at_point(x: int, y: int) -> PointerElement | None:name = str(getattr(info, "name", "") or "").strip()role = str(getattr(info, "control_type", "") or "").strip()bounds = _rect_to_bounds(getattr(info, "rectangle", None))+ # Keyboard-focus state of the LEAF element actually hit (never an+ # ancestor): the CU click verification uses it as already-in-desired-+ # state evidence. Best-effort tri-state.+ try:+ focused: bool | None = bool(raw.CurrentHasKeyboardFocus)+ except Exception: # noqa: BLE001 — property read is best-effort+ focused = None# Walk up to the nearest named ancestor (bounded) when the leaf is unnamed —# a deep custom-drawn leaf often has no Name, but its container does.@@ -165,6 +172,7 @@ def _win_query_element_at_point(x: int, y: int) -> PointerElement | None:app_name=app_name,window_title=window_title,source="ax_tree",+ focused=focused,)@@ -231,6 +239,11 @@ def _ax_query_element_at_point(x: int, y: int) -> PointerElement | None:role = _attr("AXRole")name = _attr("AXTitle") or _attr("AXDescription")value = _attr("AXValue")+ try:+ err_f, val_f = AXUIElementCopyAttributeValue(elem, "AXFocused", None)+ focused: bool | None = bool(val_f) if err_f == 0 else None+ except Exception: # noqa: BLE001 — attribute read is best-effort+ focused = Nonereturn PointerElement(name=name,role=role,@@ -239,6 +252,7 @@ def _ax_query_element_at_point(x: int, y: int) -> PointerElement | None:app_name="",window_title=_attr("AXWindow"),source="ax_tree",+ focused=focused,)@@ -301,6 +315,12 @@ def _atspi_query_element_at_point(x: int, y: int) -> PointerElement | None:role = str(node.getRoleName() or "").strip()except Exception:role = ""+ try:+ focused: bool | None = bool(+ node.getState().contains(pyatspi.STATE_FOCUSED),+ )+ except Exception: # noqa: BLE001 — state read is best-effort+ focused = Nonereturn PointerElement(name=name,role=role,@@ -309,6 +329,7 @@ def _atspi_query_element_at_point(x: int, y: int) -> PointerElement | None:app_name="",window_title="",source="ax_tree",+ focused=focused,)diff --git a/jarvis/vision/pointer_types.py b/jarvis/vision/pointer_types.pyindex fe01eae81b..da01a3b71a 100644--- a/jarvis/vision/pointer_types.py+++ b/jarvis/vision/pointer_types.py@@ -37,6 +37,11 @@ class PointerElement:app_name: str = ""window_title: str = ""source: PointerSource = "ax_tree"+ #: Does the element under the point hold keyboard focus? Tri-state:+ #: ``True``/``False`` when the native API answered, ``None`` when the+ #: backend could not tell. Consumed by the Computer-Use click+ #: verification as positive already-in-desired-state evidence.+ focused: bool | None = None@propertydef is_labeled(self) -> bool:diff --git a/tests/unit/cu/test_conventions_ledger_verify.py b/tests/unit/cu/test_conventions_ledger_verify.pyindex 61d61a5a84..210c5562a4 100644--- a/tests/unit/cu/test_conventions_ledger_verify.py+++ b/tests/unit/cu/test_conventions_ledger_verify.py@@ -214,6 +214,18 @@ def test_click_point_in_focused_element_tristate():assert click_point_in_focused_element(broken, 400, 58) is False+def test_focused_container_is_never_click_evidence():+ # Chrome reports keyboard focus on its top-level WINDOW node — accepting+ # that would rescue EVERY in-window miss and neuter the effect-check.+ window = _node(role="Window", name="Browser",+ focused=True, bounds=(0, 0, 2560, 1400))+ assert click_point_in_focused_element((window,), 400, 58) is False+ # A real focused control inside the focused window still qualifies.+ bar = _node(role="Edit", name="Address",+ focused=True, bounds=(100, 40, 800, 36))+ assert click_point_in_focused_element((window, bar), 400, 58) is True++def test_field_values_hint_lists_filled_fields_only():nodes = (_node(name="Address", value="https://example.com"),