Skip to content

The agent that grows with you

fix(computer_use): disable embedded daemon overlay

cvillarroel21a7f83a73b7b
diff --git a/tests/computer_use/test_cua_no_overlay.py b/tests/computer_use/test_cua_no_overlay.py
index 4752d90f6ec..12582a34a2e 100644
--- a/tests/computer_use/test_cua_no_overlay.py
+++ b/tests/computer_use/test_cua_no_overlay.py
@@ -11,7 +11,7 @@ probe), not specific config snapshots.
"""
import os
-from unittest.mock import mock_open, patch
+from unittest.mock import MagicMock, mock_open, patch
import pytest
@@ -223,3 +223,30 @@ class TestMcpArgsOverlayFlag:
result = cua_backend._mcp_args_with_overlay_flag(original)
assert "--no-overlay" in result
assert "--no-overlay" not in original
+
+
+class TestEmbeddedDaemonOverlayFlag:
+ def test_serve_process_disables_overlay_when_policy_requires_it(self):
+ daemon = cua_backend._EmbeddedCuaDaemon("/usr/bin/cua-driver", "unrestricted")
+ process = MagicMock()
+ process.poll.return_value = None
+ status = MagicMock(returncode=0)
+
+ with patch.object(
+ cua_backend,
+ "_resolve_mcp_invocation",
+ return_value=("/usr/bin/cua-driver", ["mcp"]),
+ ), patch.object(
+ cua_backend, "_cua_no_overlay", return_value=True,
+ ), patch.object(
+ cua_backend, "_cua_driver_supports_no_overlay", return_value=True,
+ ), patch.object(
+ cua_backend.subprocess, "Popen", return_value=process,
+ ) as popen, patch.object(
+ cua_backend.subprocess, "run", return_value=status,
+ ), patch.object(cua_backend.threading, "Thread"):
+ daemon.start()
+
+ command = popen.call_args.args[0]
+ assert command[:2] == ["/usr/bin/cua-driver", "serve"]
+ assert "--no-overlay" in command
diff --git a/tools/computer_use/cua_backend.py b/tools/computer_use/cua_backend.py
index d8da627c280..03d2b6cb1fe 100644
--- a/tools/computer_use/cua_backend.py
+++ b/tools/computer_use/cua_backend.py
@@ -728,6 +728,10 @@ class _EmbeddedCuaDaemon:
"--approve-capability-manifest",
]
)
+ # The private daemon owns the platform cursor overlay. Applying the
+ # policy only to its MCP proxy leaves this long-lived serve process
+ # free to create a full-screen overlay before session tuning runs.
+ command = _mcp_args_with_overlay_flag(command, driver_cmd=self._command)
self._process = subprocess.Popen(
command,
stdin=subprocess.DEVNULL,