openhands-workspace 1.60.2__tar.gz → 1.62.0__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 (23) hide show
  1. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/PKG-INFO +1 -1
  2. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/apptainer/workspace.py +9 -4
  3. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/cloud/workspace.py +6 -13
  4. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/docker/workspace.py +12 -4
  5. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/remote_api/workspace.py +1 -1
  6. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands_workspace.egg-info/PKG-INFO +1 -1
  7. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/pyproject.toml +1 -1
  8. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/__init__.py +0 -0
  9. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/agent_sandbox/__init__.py +0 -0
  10. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/agent_sandbox/testing/agent_ollama_example.py +0 -0
  11. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/agent_sandbox/testing/smoke_test.py +0 -0
  12. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/agent_sandbox/workspace.py +0 -0
  13. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/apptainer/__init__.py +0 -0
  14. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/cloud/__init__.py +0 -0
  15. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/docker/__init__.py +0 -0
  16. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/docker/dev_workspace.py +0 -0
  17. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/py.typed +0 -0
  18. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands/workspace/remote_api/__init__.py +0 -0
  19. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands_workspace.egg-info/SOURCES.txt +0 -0
  20. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands_workspace.egg-info/dependency_links.txt +0 -0
  21. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands_workspace.egg-info/requires.txt +0 -0
  22. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/openhands_workspace.egg-info/top_level.txt +0 -0
  23. {openhands_workspace-1.60.2 → openhands_workspace-1.62.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openhands-workspace
3
- Version: 1.60.2
3
+ Version: 1.62.0
4
4
  Summary: OpenHands Workspace - Docker and container-based workspace implementations
5
5
  Project-URL: Source, https://github.com/OpenHands/software-agent-sdk
6
6
  Project-URL: Homepage, https://github.com/OpenHands/software-agent-sdk
@@ -316,10 +316,12 @@ class ApptainerWorkspace(RemoteWorkspace):
316
316
  str(self.host_port),
317
317
  ]
318
318
 
319
- # Start the server process in the background in separate process group
319
+ # Start the server process in the background in separate process group.
320
+ # Without a log thread nothing reads a pipe, and a full pipe would block
321
+ # the server, so its output is discarded instead.
320
322
  self._process = subprocess.Popen(
321
323
  server_cmd,
322
- stdout=subprocess.PIPE,
324
+ stdout=subprocess.PIPE if self.detach_logs else subprocess.DEVNULL,
323
325
  stderr=subprocess.STDOUT,
324
326
  text=True,
325
327
  start_new_session=True,
@@ -378,8 +380,11 @@ class ApptainerWorkspace(RemoteWorkspace):
378
380
  return self
379
381
 
380
382
  def __exit__(self, exc_type, exc_val, exc_tb) -> None: # type: ignore[no-untyped-def]
381
- """Context manager exit - cleans up the Apptainer container."""
382
- self.cleanup()
383
+ """Send the completion callback, then clean up the Apptainer container."""
384
+ try:
385
+ super().__exit__(exc_type, exc_val, exc_tb)
386
+ finally:
387
+ self.cleanup()
383
388
 
384
389
  def __del__(self) -> None:
385
390
  """Clean up the Apptainer container when the workspace is destroyed."""
@@ -711,6 +711,8 @@ class OpenHandsCloudWorkspace(RemoteWorkspace):
711
711
  url=f"{self._settings_base_url}/secrets/{name}",
712
712
  headers={"X-Session-API-Key": self._session_api_key or ""},
713
713
  description=item.get("description"),
714
+ scope=item.get("scope"),
715
+ scope_description=item.get("scope_description"),
714
716
  )
715
717
 
716
718
  return result
@@ -909,7 +911,7 @@ class OpenHandsCloudWorkspace(RemoteWorkspace):
909
911
  Retries up to 3 times on transient failures.
910
912
 
911
913
  Args:
912
- name: Name of the secret to fetch (e.g., "github_token", "gitlab_token")
914
+ name: Name of the secret to fetch (e.g., "GITHUB_TOKEN", "GITLAB_TOKEN")
913
915
 
914
916
  Returns:
915
917
  The secret value as a string, or None if not found or an error occurred.
@@ -922,20 +924,11 @@ class OpenHandsCloudWorkspace(RemoteWorkspace):
922
924
  logger.warning(f"Invalid secret name: {name}")
923
925
  return None
924
926
 
925
- # Use retry logic for transient failures
926
- @tenacity.retry(
927
- stop=tenacity.stop_after_attempt(_MAX_RETRIES),
928
- wait=tenacity.wait_exponential(multiplier=1, min=1, max=5),
929
- retry=tenacity.retry_if_exception(_is_retryable_error),
930
- reraise=True,
931
- )
932
- def _fetch_secret() -> httpx.Response:
933
- return self._send_settings_request(
927
+ try:
928
+ # _send_settings_request already retries transient failures.
929
+ resp = self._send_settings_request(
934
930
  "GET", f"{self._settings_base_url}/secrets/{name}"
935
931
  )
936
-
937
- try:
938
- resp = _fetch_secret()
939
932
  return resp.text
940
933
  except httpx.HTTPStatusError as e:
941
934
  if e.response.status_code == 404:
@@ -27,7 +27,7 @@ def check_port_available(port: int) -> bool:
27
27
  try:
28
28
  sock.bind(("0.0.0.0", port))
29
29
  return True
30
- except OSError:
30
+ except (OSError, OverflowError): # OverflowError: port outside 0-65535
31
31
  time.sleep(0.1)
32
32
  return False
33
33
  finally:
@@ -361,8 +361,11 @@ class DockerWorkspace(RemoteWorkspace):
361
361
  return self
362
362
 
363
363
  def __exit__(self, exc_type, exc_val, exc_tb) -> None: # type: ignore[no-untyped-def]
364
- """Context manager exit - cleans up the Docker container."""
365
- self.cleanup()
364
+ """Send the completion callback, then clean up the Docker container."""
365
+ try:
366
+ super().__exit__(exc_type, exc_val, exc_tb)
367
+ finally:
368
+ self.cleanup()
366
369
 
367
370
  def __del__(self) -> None:
368
371
  """Clean up the Docker container when the workspace is destroyed."""
@@ -377,7 +380,12 @@ class DockerWorkspace(RemoteWorkspace):
377
380
  if self._container_id:
378
381
  # Stop logs streaming
379
382
  self._stop_logs.set()
380
- if self._logs_thread and self._logs_thread.is_alive():
383
+ # __del__ can run on the logs thread itself, which cannot join itself.
384
+ if (
385
+ self._logs_thread
386
+ and self._logs_thread.is_alive()
387
+ and self._logs_thread is not threading.current_thread()
388
+ ):
381
389
  self._logs_thread.join(timeout=2)
382
390
 
383
391
  # Stop and remove the container
@@ -311,7 +311,7 @@ class APIRemoteWorkspace(RemoteWorkspace):
311
311
  headers=self._api_headers,
312
312
  )
313
313
  data = resp.json()
314
- pod_status = data.get("pod_status", "").lower()
314
+ pod_status = (data.get("pod_status") or "").lower()
315
315
  logger.info(f"Pod status: {pod_status}")
316
316
 
317
317
  # Log additional details for debugging
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openhands-workspace
3
- Version: 1.60.2
3
+ Version: 1.62.0
4
4
  Summary: OpenHands Workspace - Docker and container-based workspace implementations
5
5
  Project-URL: Source, https://github.com/OpenHands/software-agent-sdk
6
6
  Project-URL: Homepage, https://github.com/OpenHands/software-agent-sdk
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "openhands-workspace"
3
- version = "1.60.2"
3
+ version = "1.62.0"
4
4
  description = "OpenHands Workspace - Docker and container-based workspace implementations"
5
5
 
6
6
  requires-python = ">=3.12"