Native Windows backend (full computer-use, not stub) - #13
Conversation
Replace the Windows stub with real primitives (ImageGrab, pyautogui/SendInput, EnumWindows, launch_app) and the same exclusive-lease model as macOS. Document Windows install/limits, pin pyautogui for win32, and add unit tests that run on Linux CI.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_c52c93dc-6945-4e08-8bd1-c520b434c83c) |
|
Warning Review limit reached
Next review available in: 56 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_de051245-e300-48df-ab68-cb69f97d639f) |
| x, y, w, h = parts | ||
| bbox = (x, y, x + w, y + h) | ||
| img = ImageGrab.grab(bbox=bbox, all_screens=True) | ||
| path, meta = _encode_screenshot(img, fmt=fmt, max_width=max_width, use_cache=use_cache) |
There was a problem hiding this comment.
Bug: The call to _encode_screenshot in WinBackend is missing required arguments (display, grab_ms) and incorrectly unpacks the dictionary return value, causing a TypeError.
Severity: CRITICAL
Suggested Fix
Update the call to _encode_screenshot in WinBackend._take_screenshot to provide all required arguments (img, display, grab_ms, fmt, max_width, use_cache). The returned dictionary should be assigned to a single variable, and its keys should be used to access the values, similar to how it is handled in the MacBackend.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: mcp-server/server.py#L1709
Potential issue: The `_take_screenshot` method in the `WinBackend` class calls the
`_encode_screenshot` function with incorrect arguments. The call at line 1709 is missing
the required positional arguments `display` and `grab_ms`. Furthermore, it incorrectly
attempts to unpack the dictionary returned by `_encode_screenshot` into a tuple `(path,
meta)`. This will raise a `TypeError` whenever a screenshot is taken on a Windows
system, causing the feature to fail completely on that platform.
Did we get this right? 👍 / 👎 to inform future reviews.
Summary
Prior multi-agent work left
WinBackendas a limited stub. This ships a real Windows backend with the same MCP tool surface as Linux/macOS.win-main(macOS model) — exclusive owner + heartbeat/reap of lease metadatapyautoguionly onwin32(marker); SendInput fallback if missingtests/test_win_backend.py— method surface, off-Windows guards, lease roundtrip on Linux CICapability matrix
Test plan
python3 -m py_compile mcp-server/server.pypytest tests/(leases + win backend) on Linuxensure_desktop→screenshot→click→type_text→list_windows→release_desktopNote
Medium Risk
Large new code path drives real mouse/keyboard and app launch on the logged-in Windows session; incorrect input or lease handling could affect concurrent agents sharing one desktop, though Linux pool behavior is unchanged.
Overview
Replaces the limited
WinBackendstub with a native implementation that matches Linux/macOS MCP tools: screenshot (PillowImageGrab), click/type/keypress/scroll (pyautoguior ctypesSendInput+ clipboard paste fallback), list_windows (EnumWindows), and launch_app (os.startfile/ shell).Desktop pooling on Windows stays a single interactive session
win-main(macOS-style): exclusive leases, heartbeat, release, and reap clear metadata only—no Xvnc multi-seat pool. Default display becomeswin:mainwhen on Windows; MCP instructions and architecture notes now describe three backends.Dependencies & tests:
pyautoguiis added with awin32marker;tests/test_win_backend.pyvalidates the full method surface, off-Windows guards for GUI ops, and lease roundtrips on Linux CI.Reviewed by Cursor Bugbot for commit 938ffba. Bugbot is set up for automated code reviews on this repo. Configure here.