fix(agent): use is not None check in predict_click for zero coordinates#1515
fix(agent): use is not None check in predict_click for zero coordinates#1515zhoufengen wants to merge 1 commit into
Conversation
In AnthropicHostedToolsConfig.predict_click, the coordinate check used
Python truthiness (`if action.get("x") and action.get("y")`), which
silently returns None when either coordinate is 0. Valid edge-of-screen
clicks at x=0 or y=0 were incorrectly discarded.
Replace with explicit None checks, matching the pattern already used in
the OpenAI loop (openai.py:401):
if action.get("x") is not None and action.get("y") is not None
Fixes trycua#1400
Generated with [AWS Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
|
@zhoufengen is attempting to deploy a commit to the Cua Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes a coordinate validation bug in ChangesCoordinate Validation Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
AnthropicHostedToolsConfig.predict_clickuses a Python truthiness check to validate click coordinates:This silently returns
Nonewhen either coordinate is0(falsy in Python). Valid edge-of-screen clicks atx=0ory=0are incorrectly discarded.Changes
Replace the truthiness check with an explicit
Nonecheck inlibs/python/agent/cua_agent/loops/anthropic.py:This matches the pattern already used in the OpenAI loop (
openai.py:401).Testing
Added
libs/python/agent/tests/test_predict_click_zero_coords.pywith 6 tests:x=0,y=0, and(0, 0)(regression proof)Nonewhen nocomputer_callin responseis not Nonecheck (not the old buggy pattern)Run with:
Related Issues
Fixes #1400
Summary by CodeRabbit
Bug Fixes
Tests