Bug Report
Description
In libs/python/agent/cua_agent/loops/anthropic.py, the predict_click method uses a truthiness check to validate the returned click coordinates:
if action.get("x") and action.get("y"):
x = action.get("x")
y = action.get("y")
return (int(x), int(y))
This check silently fails when either coordinate is 0, because 0 is falsy in Python. For example, if the model predicts a click at (0, 300) (left edge) or (500, 0) (top edge), the condition evaluates to False, and the method incorrectly returns None instead of the valid coordinates.
Steps to Reproduce
- Use
predict_click with a model that predicts a click at the left or top edge of the screen (x=0 or y=0).
- The method returns
None even though the model returned valid coordinates.
Expected Behavior
Coordinates of 0 are valid — predict_click should return (0, y) or (x, 0) correctly.
Fix
Replace the truthiness check with an explicit None check:
if action.get("x") is not None and action.get("y") is not None:
x = action.get("x")
y = action.get("y")
return (int(x), int(y))
Impact
Any use case where the model must click an element at the leftmost column or topmost row of the screen will silently fail and return None.
Signed-off-by: cocoon 54054995+kuishou68@users.noreply.github.com
Bug Report
Description
In
libs/python/agent/cua_agent/loops/anthropic.py, thepredict_clickmethod uses a truthiness check to validate the returned click coordinates:This check silently fails when either coordinate is
0, because0is falsy in Python. For example, if the model predicts a click at(0, 300)(left edge) or(500, 0)(top edge), the condition evaluates toFalse, and the method incorrectly returnsNoneinstead of the valid coordinates.Steps to Reproduce
predict_clickwith a model that predicts a click at the left or top edge of the screen (x=0 or y=0).Noneeven though the model returned valid coordinates.Expected Behavior
Coordinates of
0are valid —predict_clickshould return(0, y)or(x, 0)correctly.Fix
Replace the truthiness check with an explicit
Nonecheck:Impact
Any use case where the model must click an element at the leftmost column or topmost row of the screen will silently fail and return
None.Signed-off-by: cocoon 54054995+kuishou68@users.noreply.github.com