Repository navigation
fix(workspace): stop retrying cloud secret fetches twice - #6595
Conversation
OpenHandsCloudWorkspace._get_secret_value wrapped _send_settings_request, which already retries 3 times, in another 3-attempt tenacity retry, so a persistent 5xx made 9 requests with nested backoff. Call it directly.
Coverage Report •
|
||||||||||||||||||||
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope: Belongs in this repository. The change touches OpenHandsCloudWorkspace._get_secret_value in the Python SDK workspace package and directly implements the corresponding item from issue #6348 (labeled bug, ready-for-dev).
Verification
- Head
1e3c3478matches the review request; all GitHub Actions checks on this head are green, includingworkspace-testsandsdk-tests. - Ran the focused suite in the workspace:
uv run pytest tests/workspace/test_cloud_workspace.py tests/workspace/test_cloud_workspace_repos.py— 139 passed, including the newtest_get_secret_value_retries_at_most_three_times. - Confirmed the pinned test reproduces the reported bug against the
mainversion of the function (AssertionError: assert 9 == 3) and passes on this head (3 requests), matching the PR description.
Assessment: The duplicated tenacity wrapper around _send_settings_request is removed correctly. The inner method already carries the same policy (stop_after_attempt(_MAX_RETRIES), _is_retryable_error, reraise=True), so a persistent 5xx now yields at most 3 HTTP attempts per secret lookup instead of 9. The surrounding try/except is unchanged, so 404 handling, logging, and the None-on-error return contract behave exactly as before, and the docstring's "Retries up to 3 times on transient failures" is now accurate.
No material correctness, security, or compatibility findings.
✅ APPROVED
HUMAN:
just fixing a bug
AGENT:
Why
OpenHandsCloudWorkspace._get_secret_valuewraps its request in a local@tenacity.retry(3 attempts, exponential wait), but the call inside it,_send_settings_request, is already decorated with the same 3-attempt retry. When the settings API keeps returning a 5xx, one secret lookup sends 9 requests and waits through both backoffs before giving up, and repo cloning does this for each token it looks up.Summary
_send_settings_requestdirectly, which keeps exactly the retry policy the docstring describes ("Retries up to 3 times on transient failures"). Error handling and the return values are unchanged.httpx.Client(sleep patched out).Issue Number
Part of #6348 (item: "_get_secret_value nests a 3-attempt retry around the 3-attempt _send_settings_request, so a persistent 5xx makes 9 requests").
How to Test
test_get_secret_value_retries_at_most_three_timesfails onmain(9 requests) and passes here (3). Everything else in those two files passes except fourTestCloneReposIntegrationcases, which error identically onmainon my machine because of a globaltag.gpgsigngit setting, not because of this change.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:1e3c347-pythonRun
All tags pushed for this build
About Multi-Architecture Support
1e3c347-python) is a multi-arch manifest supporting both amd64 and arm641e3c347-python-amd64) are also available if needed