Skip to content

The agent that grows with you

fix(tools): recommend set_value on a zero-delivery type verdict

Brooklyn Nicholsonebdc93473585
diff --git a/tests/tools/test_computer_use_zero_delivery_verdict.py b/tests/tools/test_computer_use_zero_delivery_verdict.py
new file mode 100644
index 00000000000..ef002afed86
--- /dev/null
+++ b/tests/tools/test_computer_use_zero_delivery_verdict.py
@@ -0,0 +1,31 @@
+"""Zero-delivery `type` verdict: web inputs behind trusted-event checks
+swallow synthetic keystrokes entirely (delivered 0 of N). Retrying the
+same delivery rung cannot help; the actionable next step is the AX
+set_value path, which bypasses synthetic-event filtering."""
+
+from __future__ import annotations
+
+from tools.computer_use.backend import ActionResult
+from tools.computer_use.tool import _classify_action_result
+
+
+def _result(delivered):
+ return ActionResult(
+ ok=True,
+ action="type",
+ message="type_text incomplete",
+ code="type_text_incomplete",
+ meta={"delivered_chars": delivered, "requested_chars": 11},
+ )
+
+
+def test_zero_delivery_recommends_set_value():
+ verdict = _classify_action_result(_result(0))
+ assert verdict["decision"] == "escalate"
+ assert verdict["recommended"] == "set_value"
+ assert "set_value" in verdict["hint"]
+
+
+def test_partial_delivery_keeps_generic_ladder():
+ verdict = _classify_action_result(_result(7))
+ assert verdict.get("recommended") != "set_value"
diff --git a/tools/computer_use/tool.py b/tools/computer_use/tool.py
index 25ccf175ca7..b8e341e651c 100644
--- a/tools/computer_use/tool.py
+++ b/tools/computer_use/tool.py
@@ -529,6 +529,27 @@ def _classify_action_result(res: ActionResult) -> Dict[str, Any]:
return {"decision": "verify_fresh_state", "hint": ("Input was delivered but not confirmed. Re-capture and check the "
"result BEFORE any retry — do not repeat the input on an escalation recommendation alone.")}
if res.effect == "suspected_noop" or not res.ok or res.code is not None:
+ meta = res.meta if isinstance(res.meta, dict) else {}
+ delivered, requested = meta.get("delivered_chars"), meta.get("requested_chars")
+ if (
+ res.action in ("type", "type_text")
+ and isinstance(delivered, int)
+ and isinstance(requested, int)
+ and requested > 0
+ and delivered <= 0
+ ):
+ # Zero delivery: the field swallowed every synthetic keystroke (trusted-event checks on web
+ # inputs do this). Neither rung of the delivery ladder can fix a target that drops events at
+ # the source — the AX set_value path writes the value directly and bypasses event filtering.
+ return {
+ "decision": "escalate",
+ "recommended": "set_value",
+ "hint": (
+ "0 characters landed: this input drops synthetic keystrokes, so no delivery rung will fix it. "
+ "Use set_value on the field's element index instead — it sets the value through the "
+ "accessibility API and bypasses event filtering. Re-capture first if the index is stale."
+ ),
+ }
return {"decision": "escalate", **({"recommended": res.escalation.get("recommended")}
if isinstance(res.escalation, dict) else {}), "hint": (
"The input likely did not land. Climb one rung following `recommended`: 'px' → re-issue by coordinate; "