Repository navigation
refactor(agent-server): remove the VNC/desktop stack entirely - #4792
Conversation
The desktop feature has been disabled by every consumer since the 2025-10-30 security fix (#974) defaulted OH_ENABLE_VNC=false, and the token-auth PR meant to re-enable it safely (#1160) has been an open draft since 2025-11-13. Its documented opt-in never worked: extra_ports=True only mapped port 8002, and nothing in openhands-workspace ever set OH_ENABLE_VNC. Removes the DesktopService, its router and endpoints, the enable_vnc config field, the tigervnc/xfce4/dbus-x11/novnc/websockify apt install, the desktop capability key, and the browser tool's non-headless branch. Chromium is retained under the browser capability. Measured on linux/arm64: base-image 1205.6 MB -> 1133.6 MB compressed (-72.0 MB), matching #4645's independent 72.0 MB arm64 attribution.
Endpoint auditContract: pinned release artifact
Actionable client-only calls (0)none Actionable server-only operations (18)
Documented non-divergences (13)Client calls intentionally absent from the filtered contract (11)
Reason: Operational Agent Server endpoints intentionally excluded from the filtered public release artifact.
Reason: Client-ahead API stacked on the pending Agent Server meta-profiles implementation.
Reason: Client-ahead API stacked on the pending Agent Server pre-flight LLM validation endpoint. Server operations covered by an exposed browser URL (2)
Reason: RemoteWorkspace.startWorkspaceSession exposes these authenticated URLs for browser iframe and file requests; they are not HttpClient method calls. |
Python API breakage checks — ✅ PASSEDResult: ✅ PASSED |
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
|
🤖 OpenHands is reviewing this PR. Head commit: This comment was posted by an AI agent (OpenHands). |
Coverage Report •
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was created by an AI agent (OpenHands) on behalf of the repository maintainers.
The removal itself is clean and well-evidenced: the diffs are surgical, the image-size math is independently reproduced, and Chromium-under-browser/headless behavior is verified end-to-end. Two things need a human eye before this lands.
1. REST contract removal without a deprecation runway
GET /api/desktop/url (operationId get_desktop_url_api_desktop_url_get) is being deleted outright, with no prior deprecated=true marker. This is a public /api/** endpoint — it is not in the breakage checker's "previously-deprecated removal" allowlist (unlike /api/cloud-proxy or the accepted /api/vscode/url default change), so the REST-breakage check will flag it as a hard break.
This repo's own API-compatibility policy (root AGENTS.md, and openhands-agent-server/AGENTS.md) requires a deprecation notice and a ~5-minor-release runway before removing a public REST contract. The PR's Breaking changes section explicitly acknowledges the endpoint is being dropped cold. The argument that "nobody enables it / it always 503s in practice" is reasonable and likely correct — but a reachable, documented /api/desktop/url returning 503 to any caller is still a public contract, and any third-party client that calls it today would (post-merge) start getting 404 instead of the documented 503. This needs an explicit maintainer sign-off on skipping the runway, rather than being treated as routine cleanup.
2. The hand-written TypeScript client still points at the removed endpoint
The PR notes that the generated schema (clients/typescript/src/generated/agent-server-schema.ts, pinned to 1.44.0) will drop DesktopUrlResponse on the next regeneration. But the hand-written client surface still ships a live desktop API that calls the now-dead route:
clients/typescript/src/client/desktop-client.ts:26—DesktopClient.getUrl()doesGET /api/desktop/url.clients/typescript/src/models/api.ts:282— hand-writtenDesktopUrlResponse(this file is not generated; header reads "Models for auxiliary Agent Server APIs").clients/typescript/src/conversation/conversation-manager.ts:93,126—public readonly desktop: DesktopClientis still constructed and exposed.clients/typescript/src/clients.ts:17,74/index.ts:372—DesktopClient/DesktopClientOptions/DesktopUrlResponseare still publicly exported.
So after this merges and the next image ships, manager.desktop.getUrl() will throw a 404 (route gone), not the previously-tolerated 503. There is also a concrete test that will fail on this: clients/typescript/src/__tests__/integration/deterministic-api.integration.test.ts:90-94 calls manager.desktop.getUrl() and asserts HttpError.status === 503; once run against a rebuilt image, the error is 404 and the assertion breaks.
These files are not in this PR's diff, which is why this is surfaced here rather than as an inline comment. Recommend either removing/deprecating the hand-written DesktopClient/manager.desktop surface in a coordinated follow-up (with the same 5-minor-release runway as the REST endpoint), or at minimum updating the deterministic integration test so it doesn't hard-assert against a route this PR deletes. If the TS client is owned by a separate regeneration/release cadence, calling that out explicitly would prevent a broken client on the next release.
Minor (non-blocking)
openhands-agent-server/openhands/agent_server/docker/build.py:867 and tests/agent_server/test_docker_build.py:822 still cite the now-removed wallpaper.svg bind mount as a reason base-image needs the real build context. The unconditional builder-stage COPY is still a valid reason, so the fast-path conclusion stays correct — just stale wording.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟡 MEDIUM- Well-isolated deleted code with a strong "nobody enables it and it can't be enabled" evidence trail, and the browser-tool default path (headless=True) is genuinely unchanged — low runtime risk.
- Raised to MEDIUM because it is a deliberate removal of a public REST endpoint (no deprecation runway) and it leaves the in-repo TypeScript
desktopclient pointing at a route that no longer exists. The image-size/headless-Chromium verification is solid; the remaining risk is API-contract policy and client/server consistency, which a maintainer should confirm.
VERDICT: ✅ Worth merging (with maintainer sign-off on the deliberate REST removal and a follow-up to unship or deprecate the TS desktop client).
KEY INSIGHT: The deletion is clean, but it stops one layer before the browser-compatible TypeScript client — leaving a hand-written manager.desktop surface calling a route this PR removes, and a test that will 404 once the image ships.
The REST-breakage check correctly failed the outright deletion: this repo requires a 5-minor-release deprecation runway before removing a public /api/** operation, and this endpoint was never previously marked deprecated. The bot review flagged the same gap plus a second one — the hand-written TypeScript desktop client still calls the route and an integration test asserts it 503s. Keep a minimal desktop_router.py stub (no DesktopService behind it) that always 503s — the same response every deployment already gets today with VNC off by default — marked deprecated=True with removal scheduled for v1.49.0. No client-visible change, so the TypeScript client needs no follow-up. Also fixes a stale cross-test assertion still expecting `desktop` in the default INSTALL_CAPABILITIES string, and stale wallpaper.svg wording in two build-context comments.
|
Addressed the REST-breakage check failure and both review points in e5829d9: |
HUMAN:
Remove the VNC/desktop stack entirely — it has been off everywhere since the 2025 security fix and its opt-in never worked.
AGENT:
Why
The VNC/desktop feature was added in #515 (2025-09-29) for interactive browsing — you could watch the agent drive a real browser over noVNC. Six weeks later, #974 (2025-10-30) turned it off as a security fix: the VNC server was exposed unauthenticated by default. The PR that would re-enable it safely, #1160 (token-based auth), has been an open draft since 2025-11-13 — last touched 2026-07-29.
So for ten months we have shipped ~72 MB of desktop stack in every image, which every consumer explicitly disables and nobody can safely turn on.
Proof that it is safe to remove
1. No consumer enables it. Not one.
Every downstream repository sets it off, and none sets it on:
enterprise—remote_sandbox_spec_service.pyOH_ENABLE_VNC: '0'saas-deploy— production / staging / development"0"in all threeruntime-api—warm_runtimes.py,monitor_runtime.py, README"0"OpenHands-Cloud— helm values, runtime-api chart, replicated"0"benchmarks—apptainer_build.py,Dockerfile.agent-layer-commit0falsesandbox-server— docker/remote sandbox spec servicesOpenHands/OpenHands)srcOH_ENABLE_VNC=falseThe one place the value flows rather than being hardcoded —
runtime-api/runtimes.py— lists it under "Deployment-infrastructure keys set via ConfigMap, not by callers", and those keys are stripped when matching a warm pod to a request. It is not a customer-facing toggle either.2. The documented opt-in never worked
#974's description says it preserved backward compatibility by "Added automatic VNC enablement when
extra_ports=True".That code is not in
main.OH_ENABLE_VNCappears zero times anywhere inopenhands-workspace, andgit log -S 'OH_ENABLE_VNC' -- openhands-workspace/returns nothing — it was never there and removed; it simply was not implemented.extra_ports=Trueonly mapped host port +2 to container 8002, where nothing was listening because the image default isfalse.Three call sites relied on that:
benchmarks/openagentsafety/run_infer.py, and examples03_browser_use_with_docker_sandboxed_server.py/05_vscode_with_docker_sandboxed_server.py. All three mapped a port to a VNC server that never started. Example 03 even printed avnc.htmllink that could not have worked.So this PR removes a feature that cannot currently be enabled through any documented path.
3. The browser tool is unaffected — verified by running it
This is the only real coupling. #515 replaced
playwright install chromiumwith the system apt chromium, and installed it in the sameapt-getas the desktop stack. #4698 already split them into separatebrowser/desktopcapability keys, so Chromium is retained here underbrowserand only the desktop packages go.Verified in the built image:
And Chromium actually runs headless without the desktop:
BrowserToolExecutordefaults toheadless=True; the only thing that flipped it to non-headless was theOH_ENABLE_VNCbranch removed here, so the default path is unchanged.Summary
desktop_service.pyand thewallpaper.svgasset, and the desktop start/stop lifecycle fromapi.py.desktop_router.pystub forGET /api/desktop/url: noDesktopServicebehind it any more, it just always returns 503. The route is markeddeprecated=Truewith a scheduled removal in v1.49.0 (this repo's 5-minor-release REST compatibility runway — see "Breaking changes" below for why it isn't fully deleted yet).desktopcapability key fromINSTALL_CAPABILITIES(Dockerfile,build.py,server.yml); an explicitdesktopnow fails the build withUnknown capability 'desktop' … (expected one of: vscode, browser, docker).tigervnc-standalone-server xfce4 dbus-x11 novnc websockifyapt install; keep Chromium underbrowser.enable_vncfromConfigand theNOVNC_WEB/NOVNC_PORT/DISPLAY/VNC_GEOMETRYenv vars andOH_ENABLE_VNCdefaults.${NOVNC_PORT}.BrowserToolExecutor(and the now-deadnonlocal headless).extra_portsonDockerWorkspace/ApptainerWorkspaceno longer maps or port-checks +2. Field name kept to avoid an API break; description now says "the additional VSCode port".test_desktop_service.py,test_vnc_integration.py; rewritetest_desktop_router.pyfor the deprecated stub (always-503, and asserts the route is markeddeprecatedin the OpenAPI schema); updatetest_api.py(service parallelisation now 2 services, not 3),test_env_parser.py,test_docker_build.py.test_server_workflow_contains_install_capabilities_expression) that still expecteddesktopin the defaultINSTALL_CAPABILITIESstring.wallpaper.svgwording inbuild.py's andtest_docker_build.py's "why base-image needs the real build context" comments — thebuilder-stage COPY is the real, still-valid reason.REST API contract changes
Compared with base OpenAPI
600c81596aa6for public/api/**paths.Measured effect
--target base-image,linux/arm64native, compressed layer totals summed from an--output type=ociexport — the same methodology as #4698:origin/main(with desktop)That independently reproduces #4645's arm64 attribution for the desktop block, which measured 72.0 MB. The amd64 figure there was 76.1 MB.
Breaking changes — deliberate
GET /api/desktop/urloutright, which the REST-breakage check correctly failed ("api path removed without deprecation"): this repo'sAGENTS.mdpolicy requires a 5-minor-release runway for public/api/**removals, and this endpoint was never previously marked deprecated. A maintainer review caught the same issue independently, plus a second one — the hand-written TypeScriptdesktopclient (DesktopClient.getUrl(),manager.desktop) still calls the route, and an integration test asserts it 503s. Rather than get a sign-off to skip the runway, this PR now keepsGET /api/desktop/urlregistered, marks itdeprecated=Truewith removal scheduled for v1.49.0, and has it always return 503 — the exact response every deployment already gets today with VNC off by default. Net effect: no client-visible change at all, and the TypeScript client needs no update. The endpoint (and its stub router) can be deleted for real once v1.49.0 ships.enable_vnc/OH_ENABLE_VNCis no longer a recognised field. Downstream repos currently passingOH_ENABLE_VNC: "0"become harmless no-ops — no coordinated change required, and cleaning them up can happen at leisure.INSTALL_CAPABILITIES:desktopis rejected rather than ignored. Anyone passing it explicitly gets a clear build failure rather than a silently smaller image.extra_ports: no longer reserves or maps host port +2.#1160 should be closed — it implements auth for a feature this removes.
How to Test
Image-content and headless-Chromium verification output is quoted under Proof above.
Not in this PR
OH_ENABLE_VNC: "0"lines fromenterprise,saas-deploy,runtime-api,OpenHands-Cloud, andbenchmarks— separate repos, and they are no-ops either way.extra_ports=Trueinbenchmarks/openagentsafety/run_infer.py, which was already only mapping a dead port.Issue Number
Relates to #4643 (image reorganisation). Supersedes #1160.
🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.13-nodejs22-slimgolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:525a7cf-pythonRun
All tags pushed for this build
About Multi-Architecture Support
525a7cf-python) is a multi-arch manifest supporting both amd64 and arm64525a7cf-python-amd64) are also available if needed