Repository navigation
fix(workspace): retry a null pod_status like any unknown status - #6586
Conversation
data.get("pod_status", "") returns None when the runtime API sends
"pod_status": null, so .lower() raised AttributeError and startup failed
instead of retrying. Treat null as an empty (unknown) status.
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
Coverage Report •
|
||||||||||||||||||||
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope: The change is in openhands-workspace/openhands/workspace/remote_api/workspace.py, owned by this repository. It fixes a tracked item from #6348 (issue is open, labeled bug / priority:medium / ready-for-dev) and correctly references it as "Part of #6348" per that tracker's instructions. No REST/OpenAPI/TypeScript-client surface is affected — this is internal error-handling around an HTTP poll.
Correctness: On main, data.get("pod_status", "") returns None for a JSON null (the default only applies when the key is missing), so .lower() raises AttributeError, which the tenacity retry loop (retrying only RuntimeError) does not catch — workspace startup fails on the first poll. The fix maps null to the existing "Unknown pod status" branch, raising RuntimeError so it is retried like any other unrecognized status. No non-null value changes behavior.
Verification in the workspace:
test_null_pod_status_is_retriedfails onmain's source with exactlyAttributeError: 'NoneType' object has no attribute 'lower'and passes on this head — a real before/after reproduction of the reported bug.uv run pytest tests/workspace/test_api_remote_workspace.py: 10 passed.uv run pytest tests/workspace/: 253 passed.
CI on this exact head (39eb8ae): All checks pass, including sdk-tests, cross-tests, integration-test, pre-commit, and windows-tests. The single failing check, Build & Push (python-amd64), fails with a Docker registry infrastructure error (blob sha256:...: not found) during image build; this +14/−1 Python-only diff (one source line, one test) contains no Dockerfile, dependency, or packaging change, so the failure is unrelated to the PR.
No material correctness, security, compatibility, or acceptance-criterion defects found.
✅ APPROVED
HUMAN:
just fixing a bug
AGENT:
Why
APIRemoteWorkspace._wait_until_runtime_alive_oncereadsdata.get("pod_status", "").lower(). The default only applies when the key is missing; when the runtime API sends"pod_status": nullthe value isNone,.lower()raisesAttributeError, and since the retry loop only retriesRuntimeError, workspace startup fails on the first poll.Summary
(data.get("pod_status") or "").lower(), so null falls into the existing "Unknown pod status" branch, which raisesRuntimeErrorand is retried._wait_until_runtime_alive_once, reusing the file's_make_workspacehelper.Issue Number
Part of #6348 (item: "a JSON null pod_status raises AttributeError instead of being retried like other unknown statuses").
How to Test
test_null_pod_status_is_retriedfails onmain(AttributeError: 'NoneType' object has no attribute 'lower') and passes here; the file passes (10).Type
🐳 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-jdkpython-node-runtimepython-node-runtimepython-node-runtimegolang: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:39eb8ae-pythonRun
All tags pushed for this build
About Multi-Architecture Support
39eb8ae-python) is a multi-arch manifest supporting both amd64 and arm6439eb8ae-python-amd64) are also available if needed