openhands-agent-server 1.49.4__tar.gz → 1.49.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/PKG-INFO +2 -1
  2. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/api.py +2 -0
  3. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/docker/Dockerfile +46 -24
  4. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/docker_runtime/proxy.py +8 -1
  5. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/docker_runtime/registry.py +102 -0
  6. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/docker_runtime/routers.py +49 -6
  7. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/mcp_oauth_store.py +73 -7
  8. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/mcp_router.py +10 -1
  9. openhands_agent_server-1.49.6/openhands/agent_server/meta_profiles_router.py +260 -0
  10. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/persistence/models.py +58 -0
  11. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/settings_router.py +6 -1
  12. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands_agent_server.egg-info/PKG-INFO +2 -1
  13. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands_agent_server.egg-info/SOURCES.txt +2 -0
  14. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands_agent_server.egg-info/requires.txt +1 -0
  15. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/pyproject.toml +2 -1
  16. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/__init__.py +0 -0
  17. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/__main__.py +0 -0
  18. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/_secret_redaction.py +0 -0
  19. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/_secrets_exposure.py +0 -0
  20. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/agent_profiles_router.py +0 -0
  21. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/auth_router.py +0 -0
  22. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/bash_router.py +0 -0
  23. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/bash_service.py +0 -0
  24. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/canvas_extensions/__init__.py +0 -0
  25. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/canvas_extensions/installed.py +0 -0
  26. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/canvas_extensions/manifest.py +0 -0
  27. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/canvas_extensions_router.py +0 -0
  28. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/config.py +0 -0
  29. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/conversation_lease.py +0 -0
  30. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/conversation_registry.py +0 -0
  31. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/conversation_router.py +0 -0
  32. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/conversation_service.py +0 -0
  33. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/credential_binding.py +0 -0
  34. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/dependencies.py +0 -0
  35. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/docker/build.py +0 -0
  36. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/docker_runtime/__init__.py +0 -0
  37. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/docker_runtime/mediation.py +0 -0
  38. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/docker_runtime/provisioning.py +0 -0
  39. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/env_parser.py +0 -0
  40. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/event_router.py +0 -0
  41. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/event_service.py +0 -0
  42. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/file_router.py +0 -0
  43. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/git_router.py +0 -0
  44. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/hooks_router.py +0 -0
  45. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/hooks_service.py +0 -0
  46. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/init_router.py +0 -0
  47. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/llm_router.py +0 -0
  48. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/local_secret_resolver.py +0 -0
  49. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/logging_config.py +0 -0
  50. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/middleware.py +0 -0
  51. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/models.py +0 -0
  52. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/openai/__init__.py +0 -0
  53. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/openai/models.py +0 -0
  54. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/openai/router.py +0 -0
  55. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/openai/service.py +0 -0
  56. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/openapi.py +0 -0
  57. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/persistence/__init__.py +0 -0
  58. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/persistence/store.py +0 -0
  59. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/plugins_router.py +0 -0
  60. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/plugins_service.py +0 -0
  61. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/profiles_router.py +0 -0
  62. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/provider_connections_router.py +0 -0
  63. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/pub_sub.py +0 -0
  64. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/py.typed +0 -0
  65. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/runtime_router.py +0 -0
  66. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/server_details_router.py +0 -0
  67. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/session_protocol.py +0 -0
  68. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/session_socket.py +0 -0
  69. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/skills_router.py +0 -0
  70. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/skills_service.py +0 -0
  71. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/sockets.py +0 -0
  72. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/sub_agents_router.py +0 -0
  73. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry/__init__.py +0 -0
  74. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry/factory.py +0 -0
  75. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry/http_exporter.py +0 -0
  76. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry/models.py +0 -0
  77. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry/policy.py +0 -0
  78. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry/posthog_exporter.py +0 -0
  79. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry/sanitizer.py +0 -0
  80. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry/service.py +0 -0
  81. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry/sink.py +0 -0
  82. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry/subscriber.py +0 -0
  83. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/telemetry_types.py +0 -0
  84. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/tool_preload_service.py +0 -0
  85. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/tool_router.py +0 -0
  86. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/utils.py +0 -0
  87. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/vscode_extensions/openhands-settings/extension.js +0 -0
  88. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/vscode_extensions/openhands-settings/package.json +0 -0
  89. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/vscode_router.py +0 -0
  90. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/vscode_service.py +0 -0
  91. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/workspace_router.py +0 -0
  92. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands/agent_server/workspaces_router.py +0 -0
  93. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands_agent_server.egg-info/dependency_links.txt +0 -0
  94. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands_agent_server.egg-info/entry_points.txt +0 -0
  95. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/openhands_agent_server.egg-info/top_level.txt +0 -0
  96. {openhands_agent_server-1.49.4 → openhands_agent_server-1.49.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openhands-agent-server
3
- Version: 1.49.4
3
+ Version: 1.49.6
4
4
  Summary: OpenHands Agent Server - REST/WebSocket interface for OpenHands AI Agent
5
5
  Project-URL: Source, https://github.com/OpenHands/software-agent-sdk
6
6
  Project-URL: Homepage, https://github.com/OpenHands/software-agent-sdk
@@ -12,6 +12,7 @@ Requires-Dist: alembic>=1.13
12
12
  Requires-Dist: docker<8,>=7.1
13
13
  Requires-Dist: fastapi>=0.104
14
14
  Requires-Dist: openhands-sdk
15
+ Requires-Dist: openhands-tools
15
16
  Requires-Dist: openai<3,>=2.33.0
16
17
  Requires-Dist: pydantic>=2
17
18
  Requires-Dist: sqlalchemy>=2
@@ -55,6 +55,7 @@ from openhands.agent_server.init_router import (
55
55
  from openhands.agent_server.llm_router import llm_router
56
56
  from openhands.agent_server.local_secret_resolver import local_secret_resolution
57
57
  from openhands.agent_server.mcp_router import mcp_router
58
+ from openhands.agent_server.meta_profiles_router import meta_profiles_router
58
59
  from openhands.agent_server.middleware import CORSDispatcher
59
60
  from openhands.agent_server.openai.router import (
60
61
  check_openai_api_key,
@@ -456,6 +457,7 @@ def _add_api_routes(app: FastAPI) -> None:
456
457
  api_router.include_router(workspaces_router)
457
458
  api_router.include_router(profiles_router)
458
459
  api_router.include_router(agent_profiles_router)
460
+ api_router.include_router(meta_profiles_router)
459
461
  # /api/auth/* mints workspace cookies and requires the header to bootstrap,
460
462
  # so it lives under the header-only auth group.
461
463
  api_router.include_router(auth_router)
@@ -8,6 +8,7 @@ ARG USERNAME=openhands
8
8
  ARG UID=10001
9
9
  ARG GID=10001
10
10
  ARG PORT=8000
11
+ ARG NPM_VERSION=11.19.1
11
12
  # Opt-in build flag for the Vertex AI extra (`openhands-sdk[vertex]`). Off by
12
13
  # default to keep the published image lean. Pass `--build-arg ENABLE_VERTEX=1`
13
14
  # to bundle google-cloud-aiplatform so the resulting binary supports
@@ -33,22 +34,24 @@ ARG INSTALL_CAPABILITIES=vscode,browser,docker
33
34
  # images. The final stage installs only the shared libraries required by Python
34
35
  # and Node; developer and package-manager tooling is added by the agent-server
35
36
  # stages below when needed. Package upgrades resolve against a dated snapshot so
36
- # newly published Debian packages have a seven-day observation period.
37
+ # newly published Debian packages have a three-day observation period.
37
38
  ####################################################################################
38
39
  FROM python:3.13.15-slim-trixie AS python-runtime
39
40
  FROM node:24.21.0-trixie-slim AS node-runtime
40
41
  FROM debian:trixie-slim AS python-node-runtime
41
- # Temporary exception to pick up Debian 13.7 before the normal observation period.
42
- ARG DEBIAN_SNAPSHOT=20260913T000000Z
42
+ ARG NPM_VERSION
43
+ ARG DEBIAN_SNAPSHOT=20260920T000000Z
43
44
 
44
45
  COPY --from=python-runtime /usr/local /usr/local
45
46
  COPY --from=node-runtime /usr/local/bin/node /usr/local/bin/node
46
47
  COPY --from=node-runtime /usr/local/lib/node_modules /usr/local/lib/node_modules
47
48
 
49
+ RUN node /usr/local/lib/node_modules/npm/bin/npm-cli.js install --global "npm@${NPM_VERSION}"
50
+
48
51
  RUN set -eux; \
49
- ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm; \
50
- ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx; \
51
- ln -s ../lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack; \
52
+ ln -sfn ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm; \
53
+ ln -sfn ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx; \
54
+ ln -sfn ../lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack; \
52
55
  printf '%s\n' \
53
56
  'Types: deb' \
54
57
  "URIs: http://snapshot.debian.org/archive/debian/${DEBIAN_SNAPSHOT}/" \
@@ -112,9 +115,9 @@ ENV UV_PROJECT_ENVIRONMENT=/agent-server/.venv
112
115
  ENV UV_PYTHON_INSTALL_DIR=/agent-server/uv-managed-python
113
116
 
114
117
  # uv 0.11.5+ embeds python-build-standalone 20260408 metadata, which is the
115
- # first release with the PT_GNU_STACK fix. Pin to 0.11.6 (latest at time of
118
+ # first release with the PT_GNU_STACK fix. Pin to 0.12.15 (latest eligible at time of
116
119
  # writing) rather than :latest so builds are reproducible.
117
- COPY --from=ghcr.io/astral-sh/uv:0.11.6 /uv /uvx /bin/
120
+ COPY --from=ghcr.io/astral-sh/uv:0.12.15 /uv /uvx /bin/
118
121
 
119
122
  RUN groupadd -g ${GID} ${USERNAME} \
120
123
  && useradd -m -u ${UID} -g ${GID} -s /usr/sbin/nologin ${USERNAME} \
@@ -174,6 +177,7 @@ RUN test -x /agent-server/dist/openhands-agent-server
174
177
  ####################################################################################
175
178
  FROM python:3.13-bookworm AS acp-providers
176
179
  ARG INSTALL_ACP_PROVIDERS
180
+ ARG NPM_VERSION
177
181
  # A fresh top-level path, not nested under a directory (e.g. /opt) that base
178
182
  # images commonly already populate (SWE-bench images ship /opt/miniconda3):
179
183
  # COPY --from=<stage> only produces a byte-identical layer across different
@@ -202,18 +206,19 @@ RUN set -eux; \
202
206
  rm -rf /var/lib/apt/lists/*; \
203
207
  ARCH=$(uname -m); \
204
208
  case "$ARCH" in \
205
- x86_64|amd64) NARCH=x64; NODE_SHA256=c0649af18e6a24f6fe5535a3e86b341dd49a8e71117c8b68bde973ef834f16f2;; \
206
- aarch64|arm64) NARCH=arm64; NODE_SHA256=0b2d9f564b6594222a62c82e1df2efe119dd4a4aff29644f4dd325bf360b6bcc;; \
209
+ x86_64|amd64) NARCH=x64; NODE_SHA256=d60acfe00a2932254bb0ad20e01b0d74397a0875595de719654b214f4b03f307;; \
210
+ aarch64|arm64) NARCH=arm64; NODE_SHA256=fff4078c5def658577f92c88db7db3bc0072924bfb93fe52c1e744a54e94abb8;; \
207
211
  *) echo "Unsupported architecture for ACP providers: '$ARCH'" >&2; exit 1;; \
208
212
  esac; \
209
- NODE_TARBALL="/tmp/node-v22.19.0-linux-${NARCH}.tar.xz"; \
213
+ NODE_TARBALL="/tmp/node-v22.23.2-linux-${NARCH}.tar.xz"; \
210
214
  curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
211
- "https://nodejs.org/dist/v22.19.0/node-v22.19.0-linux-${NARCH}.tar.xz" -o "$NODE_TARBALL"; \
215
+ "https://nodejs.org/dist/v22.23.2/node-v22.23.2-linux-${NARCH}.tar.xz" -o "$NODE_TARBALL"; \
212
216
  echo "$NODE_SHA256 $NODE_TARBALL" | sha256sum -c -; \
213
217
  tar -xJ --strip-components=1 -C "$ACP_NODE_DIR" -f "$NODE_TARBALL"; \
214
218
  rm -f "$NODE_TARBALL"; \
215
219
  "$ACP_NODE_DIR/bin/node" --version; \
216
- PATH="$ACP_NODE_DIR/bin:$PATH" "$ACP_NODE_DIR/bin/npm" install -g $PACKAGES; \
220
+ PATH="$ACP_NODE_DIR/bin:$PATH" "$ACP_NODE_DIR/bin/npm" install --global "npm@${NPM_VERSION}"; \
221
+ PATH="$ACP_NODE_DIR/bin:$PATH" "$ACP_NODE_DIR/bin/npm" install --global $PACKAGES; \
217
222
  for bin in $WRAPPER_BINS; do \
218
223
  # Fail the build rather than ship a wrapper that execs a missing target:
219
224
  # a wrong binary_name is otherwise invisible until someone launches the
@@ -247,11 +252,11 @@ ENV OPENHANDS_BUILD_GIT_REF=${OPENHANDS_BUILD_GIT_REF}
247
252
  # Install base packages and create user
248
253
  RUN set -eux; \
249
254
  # Install base packages across the most common package managers, since
250
- # benchmark base images aren't always Debian-based. `tini` is added on
251
- # apt/apk where it's reliably available; on the other paths the kernel-
252
- # reaping behaviour falls back to dumb-init's absence (the agent server
253
- # is short-lived enough on non-Debian images that PID 1 zombie reaping
254
- # has not been observed to matter — revisit if it does).
255
+ # benchmark base images aren't always Debian-based. `tini` comes from the
256
+ # distro on apt/apk; the rpm/zypper families have no tini in their base
257
+ # repos, so those paths fall through to the static-binary install below.
258
+ # Every path must end with a working `tini` on PATH, because the ENTRYPOINT
259
+ # of this image invokes it unconditionally.
255
260
  if command -v apt-get >/dev/null 2>&1; then \
256
261
  apt-get -o Acquire::Retries=5 update; \
257
262
  apt-get -o Acquire::Retries=5 install -y --no-install-recommends \
@@ -260,22 +265,39 @@ RUN set -eux; \
260
265
  elif command -v apk >/dev/null 2>&1; then \
261
266
  apk add --no-cache bash ca-certificates git shadow tini tmux; \
262
267
  elif command -v microdnf >/dev/null 2>&1; then \
263
- microdnf install -y bash ca-certificates git shadow-utils tmux; \
268
+ microdnf install -y bash ca-certificates curl git shadow-utils tmux; \
264
269
  microdnf clean all; \
265
270
  elif command -v dnf >/dev/null 2>&1; then \
266
- dnf install -y bash ca-certificates git shadow-utils tmux; \
271
+ dnf install -y bash ca-certificates curl git shadow-utils tmux; \
267
272
  dnf clean all; \
268
273
  elif command -v yum >/dev/null 2>&1; then \
269
- yum install -y bash ca-certificates git shadow-utils tmux; \
274
+ yum install -y bash ca-certificates curl git shadow-utils tmux; \
270
275
  yum clean all; \
271
276
  elif command -v zypper >/dev/null 2>&1; then \
272
277
  zypper --non-interactive install --no-recommends \
273
- bash ca-certificates git shadow tmux; \
278
+ bash ca-certificates curl git shadow tmux; \
274
279
  zypper clean --all; \
275
280
  else \
276
281
  echo "Unsupported base image: no known package manager found" >&2; \
277
282
  exit 1; \
278
283
  fi; \
284
+ # Static tini fallback for the package managers that don't ship it. Pinned
285
+ # to a release-published sha256 per arch, mirroring the Node payload above.
286
+ if ! command -v tini >/dev/null 2>&1; then \
287
+ ARCH=$(uname -m); \
288
+ case "$ARCH" in \
289
+ x86_64|amd64) TARCH=amd64; TINI_SHA256=c5b0666b4cb676901f90dfcb37106783c5fe2077b04590973b885950611b30ee;; \
290
+ aarch64|arm64) TARCH=arm64; TINI_SHA256=eae1d3aa50c48fb23b8cbdf4e369d0910dfc538566bfd09df89a774aa84a48b9;; \
291
+ *) echo "Unsupported architecture for tini: '$ARCH'" >&2; exit 1;; \
292
+ esac; \
293
+ curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
294
+ "https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-${TARCH}" \
295
+ -o /usr/local/bin/tini; \
296
+ echo "$TINI_SHA256 /usr/local/bin/tini" | sha256sum -c -; \
297
+ chmod 755 /usr/local/bin/tini; \
298
+ fi; \
299
+ # Fail the build rather than ship an image whose ENTRYPOINT cannot exec.
300
+ tini --version; \
279
301
  grep -Eq "^[^:]*:[^:]*:${GID}:" /etc/group || groupadd -g "${GID}" "${USERNAME}"; \
280
302
  grep -Eq "^${USERNAME}:" /etc/passwd || \
281
303
  useradd -m -u "${UID}" -g "${GID}" -s /bin/bash "${USERNAME}"; \
@@ -378,7 +400,7 @@ RUN set -eux; \
378
400
  echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
379
401
 
380
402
  # Keep uv as part of the full development environment, but not binary-minimal.
381
- COPY --from=ghcr.io/astral-sh/uv:0.11.6 /uv /uvx /bin/
403
+ COPY --from=ghcr.io/astral-sh/uv:0.12.15 /uv /uvx /bin/
382
404
 
383
405
  # Fail fast on a typo'd capability name before spending any time on the
384
406
  # installs below (each block only checks for ITS OWN keyword's presence, so
@@ -401,7 +423,7 @@ ENV EDITOR=code \
401
423
  VISUAL=code \
402
424
  GIT_EDITOR="code --wait" \
403
425
  OPENVSCODE_SERVER_ROOT=/openhands/.openvscode-server
404
- ARG RELEASE_TAG="openvscode-server-v1.98.2"
426
+ ARG RELEASE_TAG="openvscode-server-v1.109.5"
405
427
  ARG RELEASE_ORG="gitpod-io"
406
428
  # The --mount=from=builder on the extensions RUN below is unconditional at
407
429
  # the Dockerfile level, so BuildKit still builds the full `builder` stage
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import asyncio
6
- from collections.abc import AsyncIterator
6
+ from collections.abc import AsyncIterator, Awaitable, Callable
7
7
  from contextlib import AsyncExitStack
8
8
  from typing import Protocol
9
9
  from urllib.parse import parse_qsl, urlencode, urlsplit, urlunsplit
@@ -81,6 +81,7 @@ async def proxy_http(
81
81
  upstream_path: str,
82
82
  timeout: float | None = None,
83
83
  body: bytes | None = None,
84
+ on_close: Callable[[], Awaitable[None]] | None = None,
84
85
  ) -> StreamingResponse:
85
86
  """Forward ``request`` to the per-conversation container.
86
87
 
@@ -94,6 +95,10 @@ async def proxy_http(
94
95
  timeout: Per-request timeout in seconds. ``None`` (the default) means
95
96
  no read timeout — conversation event streams can be long-lived.
96
97
  body: Replacement request body. By default the incoming body is streamed.
98
+ on_close: Awaited once the streamed response is fully consumed or the
99
+ client disconnects. Callers use this to release a session
100
+ attachment that must outlive the route handler (see
101
+ ``DockerConversationRegistry.attach_session``).
97
102
 
98
103
  Notes:
99
104
  A fresh :class:`httpx.AsyncClient` is created per request. We avoid a
@@ -149,6 +154,8 @@ async def proxy_http(
149
154
  yield chunk
150
155
  finally:
151
156
  await stack.aclose()
157
+ if on_close is not None:
158
+ await on_close()
152
159
 
153
160
  return StreamingResponse(
154
161
  _response_body(),
@@ -7,6 +7,7 @@ import hashlib
7
7
  import os
8
8
  import subprocess
9
9
  import time
10
+ from contextlib import suppress
10
11
  from dataclasses import dataclass
11
12
  from pathlib import Path
12
13
  from typing import TYPE_CHECKING
@@ -22,6 +23,7 @@ from openhands.agent_server.models import (
22
23
  ConversationRuntimeStatus,
23
24
  )
24
25
  from openhands.agent_server.persistence.store import _get_persistence_dir
26
+ from openhands.sdk.conversation.state import ConversationExecutionStatus
25
27
  from openhands.sdk.logger import get_logger
26
28
  from openhands.sdk.utils.cipher import Cipher
27
29
  from openhands.sdk.utils.command import execute_command, sanitized_env
@@ -74,8 +76,13 @@ class DockerConversationRegistry(ConversationRegistry):
74
76
  self._starts: dict[UUID, asyncio.Task[ConversationContainer]] = {}
75
77
  self._deleting: set[UUID] = set()
76
78
  self._lock = asyncio.Lock()
79
+ self._service: ConversationService | None = None
80
+ self._last_access: dict[UUID, float] = {}
81
+ self._sessions: dict[UUID, int] = {}
82
+ self._eviction_task: asyncio.Task[None] | None = None
77
83
 
78
84
  def configure_service(self, service: ConversationService) -> None:
85
+ self._service = service
79
86
  service.runtime_cipher_resolver = self.resolve_persisted_cipher
80
87
 
81
88
  def resolve_persisted_cipher(self, conversation_id: UUID) -> Cipher:
@@ -112,6 +119,8 @@ class DockerConversationRegistry(ConversationRegistry):
112
119
 
113
120
  async def start(self) -> None:
114
121
  await asyncio.to_thread(self.cleanup_stale_containers)
122
+ if self.config.conversation_idle_ttl_seconds:
123
+ self._eviction_task = asyncio.create_task(self._evict_idle_runtimes_loop())
115
124
 
116
125
  def add_execution_routes(self, router: APIRouter) -> None:
117
126
  from openhands.agent_server.docker_runtime.routers import (
@@ -164,6 +173,29 @@ class DockerConversationRegistry(ConversationRegistry):
164
173
  def is_starting(self, conversation_id: UUID) -> bool:
165
174
  return conversation_id in self._starts
166
175
 
176
+ def attach_session(self, conversation_id: UUID) -> None:
177
+ """Record an outer proxied session attached to this runtime.
178
+
179
+ Non-zero counts suppress idle eviction, mirroring the inner
180
+ ``EventService.has_external_subscribers()`` guard: a client holding a
181
+ live events websocket or a long-lived proxied stream keeps the
182
+ container alive even while the conversation itself looks idle.
183
+ """
184
+ self._sessions[conversation_id] = self._sessions.get(conversation_id, 0) + 1
185
+
186
+ def detach_session(self, conversation_id: UUID) -> None:
187
+ """Release a session recorded by :meth:`attach_session`."""
188
+ remaining = self._sessions.get(conversation_id, 0) - 1
189
+ if remaining > 0:
190
+ self._sessions[conversation_id] = remaining
191
+ else:
192
+ self._sessions.pop(conversation_id, None)
193
+ self._last_access[conversation_id] = time.monotonic()
194
+
195
+ def has_attached_sessions(self, conversation_id: UUID) -> bool:
196
+ """True if an outer proxied session is currently attached."""
197
+ return self._sessions.get(conversation_id, 0) > 0
198
+
167
199
  def cleanup_stale_containers(self) -> None:
168
200
  result = execute_command(
169
201
  ["docker", "ps", "-aq", "--filter", f"label={_OWNER_LABEL}={self.owner}"]
@@ -179,6 +211,7 @@ class DockerConversationRegistry(ConversationRegistry):
179
211
  async with self._lock:
180
212
  if conversation_id in self._deleting:
181
213
  raise RuntimeError("Conversation is being deleted")
214
+ self._last_access[conversation_id] = time.monotonic()
182
215
  container = self._containers.get(conversation_id)
183
216
 
184
217
  if container is not None:
@@ -211,12 +244,14 @@ class DockerConversationRegistry(ConversationRegistry):
211
244
  if existing is not None:
212
245
  if existing is not container:
213
246
  await asyncio.to_thread(container.stop)
247
+ self._last_access[conversation_id] = time.monotonic()
214
248
  return existing
215
249
  if self._starts.get(conversation_id) is not task:
216
250
  await asyncio.to_thread(container.stop)
217
251
  raise RuntimeError("Conversation container start was cancelled")
218
252
  self._starts.pop(conversation_id, None)
219
253
  self._containers[conversation_id] = container
254
+ self._last_access[conversation_id] = time.monotonic()
220
255
  return container
221
256
 
222
257
  async def begin_delete(self, conversation_id: UUID) -> bool:
@@ -234,6 +269,8 @@ class DockerConversationRegistry(ConversationRegistry):
234
269
  async with self._lock:
235
270
  task = self._starts.pop(conversation_id, None)
236
271
  container = self._containers.pop(conversation_id, None)
272
+ self._last_access.pop(conversation_id, None)
273
+ self._sessions.pop(conversation_id, None)
237
274
  if task is not None:
238
275
  try:
239
276
  started = await task
@@ -244,9 +281,74 @@ class DockerConversationRegistry(ConversationRegistry):
244
281
  await asyncio.to_thread(container.stop)
245
282
 
246
283
  async def shutdown(self) -> None:
284
+ if self._eviction_task is not None:
285
+ self._eviction_task.cancel()
286
+ with suppress(asyncio.CancelledError):
287
+ await self._eviction_task
288
+ self._eviction_task = None
247
289
  ids = set(self._containers) | set(self._starts)
248
290
  await asyncio.gather(*(self.stop(cid) for cid in ids), return_exceptions=True)
249
291
 
292
+ async def _evict_idle_runtimes_loop(self) -> None:
293
+ ttl = self.config.conversation_idle_ttl_seconds
294
+ if not ttl:
295
+ return
296
+ interval = max(1.0, min(60.0, ttl / 2))
297
+ while True:
298
+ await asyncio.sleep(interval)
299
+ try:
300
+ await self._evict_idle_runtimes(ttl)
301
+ except Exception:
302
+ logger.exception("error_evicting_idle_docker_runtimes")
303
+
304
+ async def _evict_idle_runtimes(self, ttl_seconds: float) -> None:
305
+ service = self._service
306
+ if service is None:
307
+ return
308
+ cutoff = time.monotonic() - ttl_seconds
309
+ async with self._lock:
310
+ candidates = [
311
+ (conversation_id, container)
312
+ for conversation_id, container in self._containers.items()
313
+ if self._last_access.get(conversation_id, float("inf")) <= cutoff
314
+ and not self.has_attached_sessions(conversation_id)
315
+ ]
316
+
317
+ for conversation_id, container in candidates:
318
+ info = await service.get_conversation(conversation_id)
319
+ if (
320
+ info is None
321
+ or info.execution_status == ConversationExecutionStatus.RUNNING
322
+ ):
323
+ continue
324
+ async with self._lock:
325
+ if self._containers.get(conversation_id) is not container:
326
+ continue
327
+ if self._last_access.get(conversation_id, float("inf")) > cutoff:
328
+ continue
329
+ if self.has_attached_sessions(conversation_id):
330
+ continue
331
+ self._containers.pop(conversation_id)
332
+ self._last_access.pop(conversation_id, None)
333
+ try:
334
+ await asyncio.to_thread(container.stop)
335
+ except Exception:
336
+ async with self._lock:
337
+ if conversation_id not in self._containers:
338
+ self._containers[conversation_id] = container
339
+ self._last_access[conversation_id] = time.monotonic()
340
+ logger.warning(
341
+ "Failed to stop idle conversation runtime %s",
342
+ conversation_id,
343
+ exc_info=True,
344
+ )
345
+ else:
346
+ logger.info(
347
+ "Stopped idle conversation runtime %s (idle >= %.0fs)",
348
+ conversation_id,
349
+ ttl_seconds,
350
+ )
351
+
250
352
  def _build_container(self, conversation_id: UUID) -> ConversationContainer:
251
353
  identity = self.provisioning.load(conversation_id)
252
354
  runtime_dir = self.provisioning.runtime_dir(conversation_id)
@@ -64,6 +64,39 @@ def _upstream_path(request: Request, path: str) -> str:
64
64
  return f"{path}?{query}" if query else path
65
65
 
66
66
 
67
+ async def _proxy_with_session(
68
+ registry: DockerConversationRegistry,
69
+ conversation_id: UUID,
70
+ container: ConversationContainer,
71
+ request: Request,
72
+ *,
73
+ upstream_path: str,
74
+ body: bytes | None = None,
75
+ ) -> StreamingResponse:
76
+ """Proxy one request while holding an outer session attachment.
77
+
78
+ The attachment is released when the streamed response finishes (or the
79
+ client disconnects), so a long-lived proxied stream keeps the container
80
+ from being evicted while a client is still reading from it.
81
+ """
82
+ registry.attach_session(conversation_id)
83
+
84
+ async def detach() -> None:
85
+ registry.detach_session(conversation_id)
86
+
87
+ try:
88
+ return await proxy_http(
89
+ request,
90
+ container,
91
+ upstream_path=upstream_path,
92
+ body=body,
93
+ on_close=detach,
94
+ )
95
+ except BaseException:
96
+ await detach()
97
+ raise
98
+
99
+
67
100
  docker_conversation_router = APIRouter(
68
101
  prefix="/conversations", tags=["Docker Conversations"]
69
102
  )
@@ -269,16 +302,20 @@ async def proxy_conversation(
269
302
  body = UpdateSecretsRequest(secrets=materialized).model_dump(
270
303
  mode="json", context={"expose_secrets": "plaintext"}
271
304
  )
272
- response = await proxy_http(
273
- request,
305
+ response = await _proxy_with_session(
306
+ registry,
307
+ conversation_id,
274
308
  container,
309
+ request,
275
310
  upstream_path=upstream_path,
276
311
  body=json.dumps(body).encode(),
277
312
  )
278
313
  else:
279
- response = await proxy_http(
280
- request,
314
+ response = await _proxy_with_session(
315
+ registry,
316
+ conversation_id,
281
317
  container,
318
+ request,
282
319
  upstream_path=upstream_path,
283
320
  )
284
321
  if request.method not in {"GET", "HEAD", "OPTIONS"} and response.status_code < 400:
@@ -297,9 +334,11 @@ async def proxy_workspace_file(
297
334
  ) -> StreamingResponse:
298
335
  registry = get_registry(request)
299
336
  container = await _container(registry, conversation_id)
300
- return await proxy_http(
301
- request,
337
+ return await _proxy_with_session(
338
+ registry,
339
+ conversation_id,
302
340
  container,
341
+ request,
303
342
  upstream_path=_upstream_path(
304
343
  request, f"/api/conversations/{conversation_id}/workspace/{file_path}"
305
344
  ),
@@ -331,6 +370,9 @@ async def _proxy_socket(
331
370
  return
332
371
  query = strip_auth_query("?" + websocket.url.query).lstrip("?")
333
372
  path = f"/sockets/{socket_name}/{conversation_id}"
373
+ # Hold the attachment for the whole bridge lifetime so the idle-eviction
374
+ # loop cannot stop the container under a live events/session websocket.
375
+ registry.attach_session(conversation_id)
334
376
  try:
335
377
  await bridge_websocket(
336
378
  websocket,
@@ -338,6 +380,7 @@ async def _proxy_socket(
338
380
  upstream_path=f"{path}?{query}" if query else path,
339
381
  )
340
382
  finally:
383
+ registry.detach_session(conversation_id)
341
384
  await websocket.app.state.conversation_service.refresh_persisted_conversation(
342
385
  conversation_id
343
386
  )
@@ -15,7 +15,9 @@ from collections.abc import Mapping, Sequence
15
15
  from dataclasses import dataclass
16
16
  from typing import Any, NamedTuple, SupportsFloat
17
17
 
18
- from openhands.agent_server.config import Config
18
+ import httpx
19
+
20
+ from openhands.agent_server.config import Config, WebhookSpec
19
21
  from openhands.agent_server.persistence import PersistedSettings, get_settings_store
20
22
  from openhands.sdk.logger import get_logger
21
23
  from openhands.sdk.mcp.client import MCPClient
@@ -35,6 +37,8 @@ from openhands.sdk.utils.cipher import Cipher
35
37
 
36
38
  logger = get_logger(__name__)
37
39
 
40
+ _WRITE_BACK_TIMEOUT_SECONDS = 10.0
41
+
38
42
 
39
43
  class _OAuthKeySpec(NamedTuple):
40
44
  suffix: str
@@ -93,6 +97,10 @@ class MCPSettingsOAuthTokenStore:
93
97
  they carry is served to FastMCP, and tokens refreshed during the
94
98
  conversation are kept in memory for the lifetime of the store instead of
95
99
  being dropped. Servers found in settings always take precedence.
100
+
101
+ ``write_back_webhooks`` are the app server callbacks this agent server
102
+ posts conversation events to; a refreshed inline state is posted there
103
+ too so the app server can persist it (see ``_write_back_seeded_state``).
96
104
  """
97
105
 
98
106
  def __init__(
@@ -100,9 +108,13 @@ class MCPSettingsOAuthTokenStore:
100
108
  *,
101
109
  seed_mcp_config: Mapping[str, MCPServer] | None = None,
102
110
  cipher: Cipher | None = None,
111
+ write_back_webhooks: Sequence[WebhookSpec] = (),
112
+ session_api_key: str | None = None,
103
113
  ):
104
114
  self._seeded: dict[str, MCPOAuthState] = {}
105
115
  self._seeded_lock = threading.Lock()
116
+ self._write_back_webhooks = tuple(write_back_webhooks)
117
+ self._session_api_key = session_api_key
106
118
  for server in (seed_mcp_config or {}).values():
107
119
  if server.url is None or server.oauth_auth is None:
108
120
  continue
@@ -156,6 +168,7 @@ class MCPSettingsOAuthTokenStore:
156
168
  if field is None:
157
169
  return
158
170
  stored_value = copy.deepcopy(dict(value))
171
+ seeded_updates: list[tuple[str, MCPOAuthState]] = []
159
172
 
160
173
  def apply_update(settings: PersistedSettings) -> PersistedSettings:
161
174
  mcp_config = settings.agent_settings.mcp_config
@@ -165,9 +178,9 @@ class MCPSettingsOAuthTokenStore:
165
178
  with self._seeded_lock:
166
179
  seeded = self._seeded.get(server_url)
167
180
  if seeded is not None:
168
- self._seeded[server_url] = seeded.with_token_storage_value(
169
- field, stored_value
170
- )
181
+ updated = seeded.with_token_storage_value(field, stored_value)
182
+ self._seeded[server_url] = updated
183
+ seeded_updates.append((server_url, updated))
171
184
  return settings
172
185
  logger.warning(
173
186
  "Could not persist MCP OAuth state: no configured MCP "
@@ -195,6 +208,47 @@ class MCPSettingsOAuthTokenStore:
195
208
  return settings
196
209
 
197
210
  get_settings_store().update(apply_update)
211
+ for server_url, state in seeded_updates:
212
+ self._write_back_seeded_state(server_url, state)
213
+
214
+ def _write_back_seeded_state(self, server_url: str, state: MCPOAuthState) -> None:
215
+ """Post the refreshed state of an inline server to the app server.
216
+
217
+ The settings of a server passed inline on the agent live on the app
218
+ server that started the conversation. Without this the refreshed
219
+ tokens die with the sandbox, and the next conversation starts from
220
+ the previous refresh token, which providers that rotate refresh
221
+ tokens have already revoked. Best effort: a failure only logs, and
222
+ the in-memory overlay keeps serving the new tokens.
223
+ """
224
+ if not self._write_back_webhooks:
225
+ return
226
+ payload = {
227
+ "server_url": server_url,
228
+ "oauth_state": state.to_response().model_dump(
229
+ mode="json", exclude_none=True
230
+ ),
231
+ }
232
+ for spec in self._write_back_webhooks:
233
+ headers = dict(spec.headers)
234
+ if self._session_api_key:
235
+ headers["X-Session-API-Key"] = self._session_api_key
236
+ url = f"{spec.base_url.rstrip('/')}/mcp-oauth-state"
237
+ try:
238
+ response = httpx.post(
239
+ url,
240
+ json=payload,
241
+ headers=headers,
242
+ timeout=_WRITE_BACK_TIMEOUT_SECONDS,
243
+ )
244
+ response.raise_for_status()
245
+ except httpx.HTTPError:
246
+ logger.warning(
247
+ "Could not write back MCP OAuth state for %s to %s",
248
+ server_url,
249
+ url,
250
+ exc_info=True,
251
+ )
198
252
 
199
253
  async def put(
200
254
  self,
@@ -375,10 +429,13 @@ class SettingsBackedMCPToolProvider:
375
429
  """Create MCP tools with FastMCP OAuth state persisted in settings.
376
430
 
377
431
  OAuth servers absent from settings (passed inline on the agent) fall back
378
- to the OAuth state they carry; see ``MCPSettingsOAuthTokenStore``.
432
+ to the OAuth state they carry, and their refreshed state is posted back
433
+ through ``webhooks``; see ``MCPSettingsOAuthTokenStore``.
379
434
  """
380
435
 
381
436
  cipher: Cipher | None = None
437
+ webhooks: tuple[WebhookSpec, ...] = ()
438
+ session_api_key: str | None = None
382
439
 
383
440
  def create_tools(
384
441
  self,
@@ -392,7 +449,10 @@ class SettingsBackedMCPToolProvider:
392
449
  mcp_config,
393
450
  timeout,
394
451
  mcp_oauth_token_storage=MCPSettingsOAuthTokenStore(
395
- seed_mcp_config=mcp_config, cipher=self.cipher
452
+ seed_mcp_config=mcp_config,
453
+ cipher=self.cipher,
454
+ write_back_webhooks=self.webhooks,
455
+ session_api_key=self.session_api_key,
396
456
  ),
397
457
  on_tools_changed=on_tools_changed,
398
458
  on_tools_reconciled=on_tools_reconciled,
@@ -410,4 +470,10 @@ def create_settings_backed_mcp_tool_provider(
410
470
  "(no OH_SECRET_KEY configured). Configure OH_SECRET_KEY for "
411
471
  "production deployments."
412
472
  )
413
- return SettingsBackedMCPToolProvider(cipher=config.cipher)
473
+ return SettingsBackedMCPToolProvider(
474
+ cipher=config.cipher,
475
+ webhooks=tuple(config.webhooks),
476
+ session_api_key=(
477
+ config.session_api_keys[0] if config.session_api_keys else None
478
+ ),
479
+ )