Repository navigation
fix(agent-server): map profile-store errors in scoped secrets list - #5898
Merged
enyst merged 2 commits intoOct 17, 2026
Merged
Conversation
GET /api/settings/secrets?agent_profile_id= read the agent profile outside store_errors(), so a profile file that no longer validates answered an unhandled 500 (agent-profile routes: 400) and a lock timeout answered 500 (agent-profile routes: 503 'Profile store is busy'). Wrap the lookup in store_errors(), add unit tests, and drop the F18 known-bug markers (the first bullet now also declares its dependency on F18.secret-put-list-get). Fixes #5883 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MKndVj7XWvRQmvW9w2bDg
Contributor
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
Contributor
enyst
marked this pull request as ready for review
October 14, 2026 01:29
all-hands-bot
approved these changes
Oct 14, 2026
all-hands-bot
left a comment
Collaborator
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope
This change is correctly placed: it fixes an Agent Server REST route (GET /api/settings/secrets), which this repository owns. No cross-repo move is warranted.
Findings
No material findings.
- Root cause and fix.
list_secrets(openhands-agent-server/openhands/agent_server/settings_router.py:467-475) previously calledAgentProfileStore.name_for_id/loadoutsidestore_errors(), soValueError(unloadable profile) andTimeoutError(held lock) surfaced as an unhandled 500. Wrapping the reads inwith store_errors():routes them through the same mapping the agent-profile routes use (_secrets_exposure.py:127): 400 with theFailed to load profile ...detail, 503Profile store is busy. Please retry.. This matches the linked issue #5883 root cause exactly. - Non-regression of adjacent behavior. The
HTTPException(404, "Agent profile not found")for an unknown id is raised inside thetrybut is not caught bystore_errors()(it is not aValueError/TimeoutError), so the 404 is preserved.ProviderConnectionNotFound(aValueErrorsubclass) is handled before the generic arm;AgentProfileStore.loaddoes not raise it, so no behavior is altered. Scoping of the returned names and thesecret_refs is Noneunscoped path are unchanged. - Tests.
test_list_secrets_unloadable_agent_profile_is_400andtest_list_secrets_busy_agent_profile_store_is_503exercise the two new paths; the existing 404 (test_list_secrets_rejects_unknown_agent_profile) and success-scope (test_list_secrets_scoped_by_agent_profile) cases are retained. I ranuv run pytest tests/agent_server/test_settings_router.py tests/agent_server/test_agent_profiles_router.pyon this head: 166 passed. The 503 test assertsresponse.json()["exception"] == "503: Profile store is busy. Please retry.", which matches the_http_exception_handler5xx shape inapi.py. - Feature map. Removing the two
# bugmarkers and rewriting the prose to expected behavior is consistent with the known-bug contract;map check --file F18reportsok: true. AddingRequires: F18.secret-put-list-getto the first bullet is correct — it readsQA_F18_TOKEN, created by that earlier recipe. - CI. All check runs for
a2d4e8bb8d487d808471ad93590afd2693ae2213are green (agent-server-tests,coverage-report,build-binary-and-test, etc.).
The PR notes a possible trivial rebase conflict with #5851 (adjacent docstrings/Gotchas bullet); that is a merge-mechanics concern, not a defect in this head. The held-lock 30 s stall is #5632 and explicitly out of scope.
✅ APPROVED
…e-profile-errors Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S978x74H7Drsnw7bzoGWc8
enyst
enabled auto-merge (squash)
October 17, 2026 01:04
enyst
deleted the
claude/umbrella-bug-fixes-tgz9ai-secret-scope-profile-errors
branch
October 17, 2026 01:04
Merged
1 of 7 tasks
5 tasks
1 of 5 tasks
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:
This PR proposes a fix for a bug uncovered during the first full agentic run of
verify-agent-server.AGENT:
I'm an AI agent (Claude Code) helping Engel Nyst (@enyst) with project maintenance.
Why
GET /api/settings/secrets?agent_profile_id=<id>answered an unhandled 500 when the named agent profile's file no longer validates, and a 500 after the 30 s lock timeout when another process holds the agent-profile store lock. The agent-profile routes answer the same two conditions with 400 (Failed to load profile ...) and 503 (Profile store is busy. Please retry.).list_secretscalledAgentProfileStore.name_for_id/loadoutsidestore_errors().Summary
list_secretsnow reads the scoping profile insidestore_errors(), so the route answers 400 / 503 like the agent-profile routes; unknown ids still answer 404 and valid ids still scope the list.tests/agent_server/test_settings_router.py(unloadable profile -> 400, lock timeout -> 503).F18.secret-scope-profile-errors:# bugmarkers removed, prose and the Gotchas line rewritten as expected behaviour, and the first bullet now declaresRequires: F18.secret-put-list-get(it reads theQA_F18_TOKENsecret that bullet creates, so--onlyfailed in arrange instead of reaching the marker).Issue Number
Fixes #5883
How to Test
uv run pytest tests/agent_server/test_settings_router.py tests/agent_server/test_agent_profiles_router.py: 166 passed. The two new tests fail on main (unhandledValueError: Failed to load profile .../TimeoutError) and pass here.Requires:line added, markers still in place):control-agent-server map run --file F18 --only F18.secret-scope-profile-errors --fresh --repeat 2 --checkout <main checkout>: both bulletsxfailtwice.xpasstwice.map checkok,map run --only F18.secret-scope-profile-errors --fresh: pass 4 / fail 0.uv run pre-commit run --files <changed files>: all passed.Video/Screenshots
n/a
Type
Notes
#5851 edits two docstrings in the same
settings_router.pyand the neighbouringF18.secret-name-contractGotchas bullet; this PR only toucheslist_secretsand thesecret-scope-profile-errorsGotchas bullet, which sits right below it, so a merge of one may need a trivial rebase of the other. A held store lock still stalls the whole server for 30 s, which is #5632 and out of scope here.🐳 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:cce4211-pythonRun
All tags pushed for this build
About Multi-Architecture Support
cce4211-python) is a multi-arch manifest supporting both amd64 and arm64cce4211-python-amd64) are also available if needed