Hi guys just started using the sdk and already fel...
# questions
b
Hi guys just started using the sdk and already fell in love with it. just a quick question. tried the examples on two different systems, one mac and one debian based bth with proper docker setup. However I always see, the desktop service is not working, in the log I can always spot: [DOCKER] {"asctime": "2025-11-04 161523,736", "levelname": "INFO", "name": "openhands.agent_server.api", "filename": "api.py", "lineno": 70, "message": "Desktop service is disabled"} and when looking at the api.py code, it looks like sth. with the desktop service is not starting properly. Any ideas?
l
Thanks, glad to hear you enjoy it! Would you be able to provide the exact command that you run to reproduce the error?
Also, do you have docker desktop running?
b
yes docker desktop is running
l
OK, what example code is causing the issue?
b
Copy code
uv run python 03_browser_use_with_docker_sandboxed_server.py
and if i read the exmaple correcly, desktop should be enabled here
l
@nutritious-balloon-65098 try to reproduce this error by running that command in the background and piping to a log and seeing if you can get the same error.
n
I'm on it! Graham Neubig can track my progress here.
b
haha nice one šŸ˜„
🫔 1
n
Summary I've successfully reproduced the "Desktop service is disabled" error you reported. Here's what I found: The Bug When running
03_browser_use_with_docker_sandboxed_server.py
with
extra_ports=True
, the Docker workspace exposes port 8002 for VNC desktop access, but the agent server inside the container doesn't actually start the VNC service, resulting in the log message:
Copy code
"Desktop service is disabled"
Root Cause There's a configuration mismatch: 1. Workspace side: When
extra_ports=True
is set, the
DockerWorkspace
exposes ports 8001 (VSCode) and 8002 (VNC) to the host 2. Agent server side: The agent server requires the environment variable
OH_ENABLE_VNC=true
to actually start the VNC service 3. The gap: The workspace doesn't pass
OH_ENABLE_VNC
to the container environment, so even though the port is exposed, nothing is listening on it Reproduction I created a test script that simulates the agent server startup and confirmed: • Without
OH_ENABLE_VNC=true
: Config shows
enable_vnc: False
, desktop service returns
None
, logs "Desktop service is disabled" āŒ • With
OH_ENABLE_VNC=true
: Config shows
enable_vnc: True
, desktop service is created and enabled āœ… Solution The fix is to modify
DockerWorkspace.model_post_init()
in
openhands-workspace/openhands/workspace/docker/workspace.py
to automatically set the required environment variables when `extra_ports=True`:
Copy code
if self.extra_ports:
    flags += ["-e", "OH_ENABLE_VNC=true"]
    flags += ["-e", "OH_ENABLE_VSCODE=true"]
I've documented the complete bug analysis in
/tmp/bug_reproduction_summary.md
and created a test script at
/tmp/test_desktop_service.py
that demonstrates the issue without requiring Docker. Would you like me to implement the fix for this bug? <sub>View full conversation</sub>
b
That here is my next woah experience šŸ˜„
l
Tell me if that works!
b
On the road, will test later and come back
g
This whole interaction is šŸ”„ Also interested to see if it worked
l
I think the diagnosis is correct, the situation is a little cludgy, but probably would work?
b
@limited-student-10747 to test it, I add the fix to openhands-workspace/openhands/workspace/docker/workspace.py on my side and then an example with a baseimage should make use of the changed code during container build time, right?
l
I believe so
b
let's try
image.png
eh voila:
Copy code
[DOCKER] {"asctime": "2025-11-04 22:34:43,564", "levelname": "INFO", "name": "openhands.agent_server.api", "filename": "api.py", "lineno": 64, "message": "Desktop service
 started successfully"}
here full log of the related parts:
Copy code
[DOCKER] {"asctime": "2025-11-04 22:34:38,385", "levelname": "INFO", "name": "openhands.agent_server.desktop_service", "filename": "desktop_service.py", "lineno": 78, "me
ssage": "Starting TigerVNC on :1 (1280x800)..."}                                                                                                                          
[DOCKER] Please be aware that you are exposing your VNC server to all users on the                                                                                        
[DOCKER] local machine. These users can access your server without authentication!                                                                                        
[DOCKER] /usr/bin/xauth:  file /home/openhands/.Xauthority does not exist                                                                                                 
[11/04/25 23:34:38] INFO     $ docker inspect -f '{{.State.Running}}' 813007b46861e02796115ad7ae60259ce3434952e6d038992d6e98d697573880                       command.py:27
true                                                                                                                                                                      
[DOCKER]                                                                                                                                                                  
[DOCKER] New Xtigervnc server '813007b46861:1 (openhands)' on port 5901 for display :1.                                                                                   
[DOCKER] Use xtigervncviewer -SecurityTypes None :1 to connect to the VNC server.                                                                                         
[DOCKER]                                                                                                                                                                  
[11/04/25 23:34:39] INFO     $ docker inspect -f '{{.State.Running}}' 813007b46861e02796115ad7ae60259ce3434952e6d038992d6e98d697573880                       command.py:27
true                                                                                                                                                                      
[11/04/25 23:34:40] INFO     $ docker inspect -f '{{.State.Running}}' 813007b46861e02796115ad7ae60259ce3434952e6d038992d6e98d697573880                       command.py:27
true                                                                                                                                                                      
[DOCKER] {"asctime": "2025-11-04 22:34:41,553", "levelname": "INFO", "name": "openhands.agent_server.desktop_service", "filename": "desktop_service.py", "lineno": 121, "m
essage": "Starting noVNC proxy on 0.0.0.0:8002 -> 127.0.0.1:5901 ..."}                                                                                                    
[DOCKER] {"asctime": "2025-11-04 22:34:41,555", "levelname": "INFO", "name": "openhands.agent_server.desktop_service", "filename": "desktop_service.py", "lineno": 143, "m
essage": "noVNC URL: http://localhost:8002/vnc.html?autoconnect=1&resize=remote"}                                                                                         
[11/04/25 23:34:41] INFO     $ docker inspect -f '{{.State.Running}}' 813007b46861e02796115ad7ae60259ce3434952e6d038992d6e98d697573880                       command.py:27
true                                                                                                                                                                      
[11/04/25 23:34:42] INFO     $ docker inspect -f '{{.State.Running}}' 813007b46861e02796115ad7ae60259ce3434952e6d038992d6e98d697573880                       command.py:27
true                                                                                                                                                                      
[DOCKER] {"asctime": "2025-11-04 22:34:43,563", "levelname": "INFO", "name": "openhands.agent_server.desktop_service", "filename": "desktop_service.py", "lineno": 153, "m
essage": "Desktop started successfully"}
ā¤ļø
image.png
l
Awesome, love it šŸ™Œ
šŸ”„ 1
b
me too