Repository navigation
Description
Is there an existing issue for the same bug?
- I have searched existing issues and this is not a duplicate.
Bug Description
PROVIDER_TOKEN_NAMES in openhands/sdk/workspace/repo.py L46–L50 names git provider tokens github_token, gitlab_token and bitbucket_token. RemoteWorkspace.clone_repos() / OpenHandsCloudWorkspace.clone_repos() request the token under that name through _get_secret_value().
Elsewhere in the OpenHands ecosystem, the same credential is called GITHUB_TOKEN:
- Enterprise conversations receive
GITHUB_TOKEN. OVERRIDABLE_SYSTEM_SECRETSandtokenEnvVarin the app server useGITHUB_TOKEN.- The GitHub skill tells agents to use
GITHUB_TOKEN. - The enterprise-cookbook documents
${GITHUB_TOKEN}for private plugin sources.
The only server-side match for the lowercase name is the Cloud sandbox secrets endpoint, which is tracked as a bug in OpenHands/enterprise#750. The agent server's git_provider_service.py L26–L31 already accepts both names (github_token, GITHUB_TOKEN, GH_TOKEN, github).
Secret names are case-sensitive throughout, so github_token and GITHUB_TOKEN are different secrets. Because of that, the token for a user's connected GitHub account has a different name depending on which route delivered it.
Expected Behavior
There is one name per provider token (GITHUB_TOKEN, GITLAB_TOKEN, BITBUCKET_TOKEN). clone_repos, ${GITHUB_TOKEN} expansion in plugin sources, and the agent's shell environment all use it.
Actual Behavior
clone_reposusesgithub_token.- On Cloud,
clone_reposworks only because the sandbox endpoint also uses the lowercase name. - On a local agent server, when a user stores their token under the documented name
GITHUB_TOKEN,clone_reposclones without credentials and private repos fail to clone. This is demonstrated below.
Steps to Reproduce
- Start a
RemoteWorkspaceagainst an agent server that has a secret namedGITHUB_TOKENand none namedgithub_token. - Call
workspace.clone_repos(["https://github.com/<owner>/<private-repo>"]). clone_reposrequests onlygithub_token, getsNone, and runsgit clonewithout credentials.
Demonstrated on main (acca181) by running the real clone_repos and git clone against a local bare repo that git could reach only through a token-bearing github.com URL (an insteadOf rewrite, as in recipe F18.sdk-clone-repos):
token names requested: ['github_token']
[clone] Failed: ... fatal: could not read Username for 'https://github.com': terminal prompts disabled
cloned: 0 failed: ['https://github.com/owner/private-repo']
With the fix in #5730, the same run requests GITHUB_TOKEN and clones 1/1. The new unit test test_clone_authenticates_with_token_stored_under_env_var_name fails on main for GitHub, GitLab and Bitbucket and passes with the fix.
Acceptance Criteria
PROVIDER_TOKEN_NAMESusesGITHUB_TOKEN/GITLAB_TOKEN/BITBUCKET_TOKEN.clone_reposfalls back to the lowercase name for a deprecation window, so it keeps working against app servers that predate the fix in Sandbox secrets endpoint names provider tokens github_token instead of GITHUB_TOKEN enterprise#750.- Custom secret names and their case are unchanged.
SDK Version
main at acca181 (2026-10-12)
This issue was created by an AI agent (OpenHands) on behalf of @jpshackelford. Found while reviewing private plugin sources for OpenHands/automation#579. Fix: #5730.
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
Confirmed against main (acca181): PROVIDER_TOKEN_NAMES in openhands-sdk/openhands/sdk/workspace/repo.py maps each provider to a lowercase secret name (github_token, gitlab_token, bitbucket_token), and RemoteWorkspace.clone_repos() / OpenHandsCloudWorkspace.clone_repos() fetch the token via _get_secret_value(name) -> GET /api/settings/secrets/{name}. Secret names are case-sensitive, and the agent server's own git_provider_service.py already accepts the uppercase names first, so the clone path and the rest of the ecosystem disagree on the name. This repository owns the fix; the Cloud sandbox endpoint that still serves the lowercase name is tracked separately in OpenHands/enterprise#750.
Scope: rename the three provider token names to GITHUB_TOKEN / GITLAB_TOKEN / BITBUCKET_TOKEN, and keep clone_repos working against servers that only have the lowercase secret by falling back to it.
Non-goals: changing the Cloud sandbox secrets endpoint (enterprise#750); renaming or case-normalizing any custom secret; changing the agent-server /api/settings/secrets contract or its secret-name validation.
Acceptance Criteria
-
PROVIDER_TOKEN_NAMESmapsGitProvider.GITHUB,GITLAB, andBITBUCKETtoGITHUB_TOKEN,GITLAB_TOKEN, andBITBUCKET_TOKENrespectively, andRepoSource.get_token_name()returns those values. - With only the uppercase secret stored on an agent server,
RemoteWorkspace.clone_repos()andOpenHandsCloudWorkspace.clone_repos()fetch it and authenticate the clone (_get_secret_value("GITHUB_TOKEN")returns the stored value). - Backward compatibility: when only the lowercase secret (e.g.
github_token) exists,clone_reposstill authenticates by falling back to that name; when both exist, the uppercase name takes precedence. - When neither name exists, behavior is unchanged:
_get_secret_valuereturnsNone(404) and the clone proceeds unauthenticated. - The agent-server GitHub token resolution in
git_provider_service.pystill resolves a stored token, and its candidate list is not left with a duplicated first entry after the rename. - Custom secret names and their case are unchanged; only the three provider token names are affected.
- Credential redaction is not regressed: a failing clone whose stderr echoes the token still redacts it in the logs.
- Docstrings and the
verify-agent-serverfeature-map references that name the lowercase token forclone_repos(F15, F18) reflect the new uppercase name. - Existing tests asserting the old lowercase token names are updated, and a test covers the lowercase fallback.
Activity