Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tools/computer_use/browser_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,11 @@ def mutate(
)
if refusal is not None:
return refusal
assert selected_tab is not None and self.state.target_id is not None
if selected_tab is None or self.state.target_id is None:
return _refusal(
"browser_state_missing",
"Internal state error: no selected tab or target id after mutation check.",
)

ref = call_args.get("ref")
supports_trust_choice = tool in {"browser_click", "browser_pointer"}
Expand Down
6 changes: 5 additions & 1 deletion tools/computer_use/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ def _open_mcp(binary: str) -> subprocess.Popen:

def _mcp_rpc(proc: subprocess.Popen, msg_id: int, method: str, params: Any = None) -> Dict[str, Any]:
"""Write one JSON-RPC request and read one response line."""
assert proc.stdin is not None and proc.stdout is not None
if proc.stdin is None or proc.stdout is None:
raise RuntimeError(
"_mcp_rpc: subprocess stdin or stdout is None — "
"cannot communicate with MCP server"
)
payload: Dict[str, Any] = {"jsonrpc": "2.0", "id": msg_id, "method": method}
if params is not None:
payload["params"] = params
Expand Down
Loading