Skip to content

fix(workspace): stop retrying cloud secret fetches twice - #6595

Merged
VascoSch92 merged 1 commit into
mainfrom
vasco/cloud-secret-single-retry
Nov 7, 2026
Merged

VascoSch92 merged 1 commit into
mainfrom
vasco/cloud-secret-single-retry

Conversation

@VascoSch92

@VascoSch92 VascoSch92 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

HUMAN:

just fixing a bug


AGENT:

Why

OpenHandsCloudWorkspace._get_secret_value wraps 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

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

uv run pytest tests/workspace/test_cloud_workspace.py tests/workspace/test_cloud_workspace_repos.py

test_get_secret_value_retries_at_most_three_times fails on main (9 requests) and passes here (3). Everything else in those two files passes except four TestCloneReposIntegration cases, which error identically on main on my machine because of a global tag.gpgsign git setting, not because of this change.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

🐳 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

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python-slim amd64, arm64 python-node-runtime Link
python-minimal amd64, arm64 python-node-runtime Link
python amd64, arm64 python-node-runtime Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:1e3c347-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-1e3c347-python \
  ghcr.io/openhands/agent-server:1e3c347-python

All tags pushed for this build

ghcr.io/openhands/agent-server:1e3c347-golang-amd64
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-golang-amd64
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-golang-amd64
ghcr.io/openhands/agent-server:1e3c347-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:1e3c347-golang-arm64
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-golang-arm64
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-golang-arm64
ghcr.io/openhands/agent-server:1e3c347-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:1e3c347-java-amd64
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-java-amd64
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-java-amd64
ghcr.io/openhands/agent-server:1e3c347-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:1e3c347-java-arm64
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-java-arm64
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-java-arm64
ghcr.io/openhands/agent-server:1e3c347-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:1e3c347-python-amd64
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-python-amd64
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-python-amd64
ghcr.io/openhands/agent-server:1e3c347-python-node-runtime-amd64
ghcr.io/openhands/agent-server:1e3c347-python-arm64
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-python-arm64
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-python-arm64
ghcr.io/openhands/agent-server:1e3c347-python-node-runtime-arm64
ghcr.io/openhands/agent-server:1e3c347-python-minimal-amd64
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-python-minimal-amd64
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-python-minimal-amd64
ghcr.io/openhands/agent-server:1e3c347-python-node-runtime-minimal-amd64
ghcr.io/openhands/agent-server:1e3c347-python-minimal-arm64
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-python-minimal-arm64
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-python-minimal-arm64
ghcr.io/openhands/agent-server:1e3c347-python-node-runtime-minimal-arm64
ghcr.io/openhands/agent-server:1e3c347-python-slim-amd64
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-python-slim-amd64
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-python-slim-amd64
ghcr.io/openhands/agent-server:1e3c347-python-node-runtime-slim-amd64
ghcr.io/openhands/agent-server:1e3c347-python-slim-arm64
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-python-slim-arm64
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-python-slim-arm64
ghcr.io/openhands/agent-server:1e3c347-python-node-runtime-slim-arm64
ghcr.io/openhands/agent-server:1e3c347-golang
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-golang
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-golang
ghcr.io/openhands/agent-server:1e3c347-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:1e3c347-java
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-java
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-java
ghcr.io/openhands/agent-server:1e3c347-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:1e3c347-python-minimal
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-python-minimal
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-python-minimal
ghcr.io/openhands/agent-server:1e3c347-python-node-runtime-minimal
ghcr.io/openhands/agent-server:1e3c347-python-slim
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-python-slim
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-python-slim
ghcr.io/openhands/agent-server:1e3c347-python-node-runtime-slim
ghcr.io/openhands/agent-server:1e3c347-python
ghcr.io/openhands/agent-server:1e3c347821d23c0e2499cfa17531bba121f93ba5-python
ghcr.io/openhands/agent-server:vasco-cloud-secret-single-retry-python
ghcr.io/openhands/agent-server:1e3c347-python-node-runtime

About Multi-Architecture Support

  • Each variant tag (e.g., 1e3c347-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 1e3c347-python-amd64) are also available if needed

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.
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-workspace/openhands/workspace/cloud
   workspace.py4059277%51, 247–249, 320, 339, 342–344, 347, 353, 355–357, 379, 382, 387, 389–390, 392–394, 396, 398–399, 402–405, 407–408, 410–411, 413, 415–417, 420–421, 425–436, 441, 510–511, 526–527, 532, 561–563, 822, 875–876, 920, 924–925, 932, 935, 939–941, 1004, 1013–1015, 1018, 1024–1026, 1031–1032, 1034–1044
TOTAL535642658450% 

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result: ✅ PASSED

Action log

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 1e3c3478 matches the review request; all GitHub Actions checks on this head are green, including workspace-tests and sdk-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 new test_get_secret_value_retries_at_most_three_times.
  • Confirmed the pinned test reproduces the reported bug against the main version 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

@VascoSch92
VascoSch92 merged commit 8884b9a into main Nov 7, 2026
52 of 53 checks passed
@VascoSch92
VascoSch92 deleted the vasco/cloud-secret-single-retry branch November 7, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants