Repository navigation
fix(openhands-automation): read secrets from the OpenHands API on Cloud and Enterprise runs - #709
Merged
Merged
Conversation
…ud and Enterprise runs
The skill's get_secret() helper only read AGENT_SERVER_URL, which the
automation service injects in local mode only. On OpenHands Cloud and
Enterprise the service runs in cloud mode: it injects
OPENHANDS_CLOUD_API_URL, SANDBOX_ID and SESSION_API_KEY instead, and user
secrets are served by the app server at
/api/v1/sandboxes/{SANDBOX_ID}/settings/secrets/{name}, not by the
sandbox's agent server. Scripts built from the skill therefore failed
with "unknown url type", and pointing them at the agent server's own
/api/settings/secrets returned 404 because nothing populates that store
in cloud mode.
- Branch all three get_secret() copies on AGENT_SERVER_URL, the same
signal the automation service's presets use: keep the agent-server
lookup when it is set, otherwise call the sandbox-scoped endpoint on
OPENHANDS_CLOUD_API_URL with the same X-Session-API-Key header.
- Document OPENHANDS_CLOUD_API_URL and SANDBOX_ID in the run environment
table, mark AGENT_SERVER_URL as local Agent Canvas only, and update the
prose and troubleshooting lines that described the old lookup.
- Regenerate skills/index.js.
Refs OHE-3347
saurya
approved these changes
Sep 30, 2026
Contributor
|
🚀 Released in v0.26.0. |
enyst
added a commit
that referenced
this pull request
Oct 4, 2026
…on Cloud The worked example added by this PR carried the pre-#709 get_secret, which only reads from the agent server. Match the helper now on main so the example also fetches secrets from the OpenHands API on Cloud and Enterprise runs. Regenerate skills/index.js. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
enyst
added a commit
that referenced
this pull request
Oct 4, 2026
…ic scripts (#686) * fix(openhands-automation): stop steering agents away from deterministic scripts The skill's rule 0 tells agents to prefer a no-LLM custom script for deterministic tasks, but the rest of the text pulled the other way: - Prompt-preset examples modelled deterministic tasks (hourly health check, run tests on push, weekly temp-file cleanup). Replace them with tasks that need judgment: error triage, bug reproduction, dependency review, flagging risky pushes. - references/custom-automation.md opened with "Do NOT use this reference unless the user has explicitly requested a custom automation", which contradicted rule 0 and the Reference Files section. Remove it and list deterministic tasks as a first-class reason to use the custom path. - Add a complete no-LLM worked example (hourly health check with Slack alert) next to the prompt-preset examples, so both paths are equally concrete. - Make consent symmetric: present the options side by side and build the one the user picks. The "ready to deploy?" confirmation applies to every path; custom scripts no longer need an extra permission step. Also drops a duplicated references/security.md bullet and regenerates the skills catalog. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(openhands-automation): fix rule cross-reference and rebalance README Address review feedback on #686: - SKILL.md: the polling section pointed at rule 5, which became rule 4 when rules 2-4 were collapsed. - README.md: stop presenting the prompt preset as the recommended default and custom automations as advanced-only; list custom scripts alongside prompt-based creation and point to the no-LLM worked example. - Regenerate skills/index.js. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(openhands-automation): make the no-LLM example's get_secret work on Cloud The worked example added by this PR carried the pre-#709 get_secret, which only reads from the agent server. Match the helper now on main so the example also fetches secrets from the OpenHands API on Cloud and Enterprise runs. Regenerate skills/index.js. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * chore: remove tracker file committed by mistake b588ba6 picked up .beads/issues.jsonl through the local bd pre-commit hook, which stages that file on every commit. It is local task-tracker data and does not belong in this repository. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HUMAN:
I verified the changes.
AGENT:
Why
The
openhands-automationskill tells custom scripts to read secrets with aget_secret()helper that only usesAGENT_SERVER_URL. The automation service sets that variable in local mode only (backends/local.py). OpenHands Cloud and Enterprise run the service in cloud mode, where a run getsOPENHANDS_CLOUD_API_URL,SANDBOX_IDandSESSION_API_KEYinstead (backends/cloud.py,dispatcher.py), and user secrets are served by the app server at/api/v1/sandboxes/{SANDBOX_ID}/settings/secrets/{name}— the same endpointOpenHandsCloudWorkspace.get_secrets()calls.On Enterprise, a Slack DM automation built from the skill's own no-LLM example failed with
unknown url type: '/api/settings/secrets/SLACK_BOT_TOKEN'. Pointing it at the sandbox's agent server instead returned 404, because nothing fills that store in cloud mode, and the OpenHands agent ended up hardcoding the Slack token intomain.py.Summary
get_secret()copies (theSKILL.mdhelper, plus the deterministic-script section and the complete no-LLM example incustom-automation.md) now branch onAGENT_SERVER_URL, the same signal the service's presets use to detect local mode. When it is set, the agent-server lookup is unchanged; otherwise the helper calls the sandbox-scoped endpoint onOPENHANDS_CLOUD_API_URLwith the sameX-Session-API-Keyheader. A missing cloud variable raises aKeyErrorthat names it instead of an opaque URL error.OPENHANDS_CLOUD_API_URLandSANDBOX_IDand marksAGENT_SERVER_URLas local Agent Canvas only; the prose and troubleshooting lines that described the old lookup now match.skills/index.jsregenerated withnpm run build:skills.Issue Number
OHE-3347
How to Test
get_secret()copy from the two docs, so it exercises exactly what gets copied into a script, and calls each one against a local stub server in both modes.main, cloud mode reproduces the reported failure for all three copies:ValueError: unknown url type: '/api/settings/secrets/SLACK_BOT_TOKEN'./api/v1/sandboxes/<SANDBOX_ID>/settings/secrets/<name>and local mode still requests/api/settings/secrets/<name>, both with the session key header.uv run --group test pytest tests/— 1091 passed, 23 skipped.python scripts/sync_extensions.py --checkpasses, andnpm run build:skillsleavesskills/index.jsunchanged.Stub check and output
Output on this branch:
Not exercised against a live Cloud or Enterprise sandbox. The endpoint contract comes from the app server's sandbox router (
X-Session-API-Keyauth,text/plainbody), which the SDK'sOpenHandsCloudWorkspace.get_secrets()and the prompt/plugin presets already rely on.Video/Screenshots
N/A — documentation-only change. The stub output above shows the before/after behavior.
Notes
Scope is the skill's guidance only. The same local-only lookup is still in:
get_secret()helper of the shipped automation scripts (skills/{slack-channel-monitor,news-digest,github-pr-reviewer,github-issue-to-pr,github-repo-monitor,github-agents-md-maintainer,gitlab-issue-to-mr,jira-issue-to-pr}/scripts/main.py);custom-automation.md, which passAGENT_SERVER_URLascloud_api_url;LookupSecretURLs inreferences/security.md.These need their own changes (several of the scripts have tests), so they are left for follow-ups.
docs: turn automation creation into a phased interview, close reliability gaps #455 edits the same two files and keeps the old helper, so it will need a rebase after this lands.