Repository navigation
fix(agent-server): resolve provider connection in profile validate - #5755
Conversation
POST /api/profiles/{name}/validate sent the posted LLM unchanged, so a
draft linked to a provider connection without an inline key was checked
keyless and reported valid:false. Resolve provider_connection_id before
the pre-flight, as activation and switch_llm do; a dangling link is a
422 naming the missing connection.
Drop the F23.validate-linked-draft known-bug marker from the
verify-agent-server map.
Fixes #5644
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014MKndVj7XWvRQmvW9w2bDg
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).
Review: PR #5755 — resolve provider connection in profile validate
Verdict: clean, well-scoped fix that mirrors the established resolution pattern. No material findings.
Scope
Belongs in this repository. The change touches the agent-server REST API (openhands-agent-server/openhands/agent_server/profiles_router.py) plus the verify-agent-server feature map and router tests, all owned here per the root AGENTS.md cross-repository boundaries. It is a backend behavior fix, not a client or another-repo concern.
Correctness
validate_profilenow callsget_llm_profile_store().resolve_provider_connection(llm, cipher=cipher)understore_errors()immediately after decrypting the posted secrets. This is byte-for-byte the pattern already used byswitch_llm(conversation_router.py:647-648) and activation viaLLMProfileStore.load(profiles_router.py:486-487), so the pre-flight now runs on the connection'sapi_key/base_urlexactly like the paths it claims to mirror.- Placement is correct: resolution runs after decryption and before the subscription branch, matching the issue's suggested fix and keeping the subscription credential path intact.
_resolve_provider_connectionis a no-op whenprovider_connection_idis unset or no provider store is configured, so the ordinary inline-key and unlinked-draft paths are unchanged (the existing validate tests pass unchanged).- A dangling
provider_connection_idraisesProviderConnectionNotFound, whichstore_errors()maps to 422 with a message naming the connection — the same answer activation andswitch_llmgive, satisfying acceptance criterion 2.
Tests
- Both new tests in
tests/agent_server/test_profiles_router.pyuse the realProviderConnectionStorefixture (no mocking of the resolution path). The linked-draft test asserts the connection'sapi_key/base_urlactually reach the LLM call, and the dangling-link test asserts 422 naming the connection and that no LLM call is made. I ran the suite: 111 passed.
Map / acceptance
- The known-bug marker on
F23.validate-linked-draftis removed and the prose updated to the expected behavior.control-agent-server map checkreportsok: true(34 files, 935 ids, no problems). - The PR body documents authentic before/after evidence on the real
F23.validate-linked-draftrecipe (xfail on the base checkout, xpass on this head,passafter marker removal), which meets the repository's live-evidence expectation for a runtime-path bug fix.
CI
All check runs on head 217927e9 are green (pre-commit, integration-test, smoke-test, coverage-report, endpoint-audit, OpenAPI breakage check, docstrings, builds).
No correctness, security, compatibility, or acceptance-criterion defect found on the current head.
✅ APPROVED
HUMAN:
This PR proposes a fix for a bug uncovered during the first full agentic run of
verify-agent-server.AGENT:
Why
Profile validation checked a provider-linked draft without the saved connection’s key, reporting an authentication failure even though activating the same draft worked.
Summary
Resolve the provider connection before validation using the same store error mapping as activation and model switching. Clients can validate a linked draft without possessing or resending its key.
Source: profiles_router.py.
Issue Number
Fixes #5644
How to Test
Previously recorded verification
uv run pytest tests/agent_server/test_profiles_router.py: 111 passed. Both new tests failed onmainbefore the fix.uv run pre-commit run --files <changed files>: all passed (ruff, pycodestyle, pyright, import rules).control-agent-server map run --file F23 --only F23.validate-linked-draft --fresh --repeat 2 --checkout <main checkout at dfd8fe8>reportedxfailin both attempts.xpassin both attempts.control-agent-server map checkis ok (34 files, 935 ids, no problems), andmap run --file F23 --only F23.validate-linked-draft --freshreportspass.Video/Screenshots
n/a
Type
Notes
The implemented dangling-link policy is HTTP 422, rather than 200 with
valid: false, consistent with activation andswitch_llm. The detail contains the connection ID and fixed text, not credentials. Request and response models remain unchanged. Original triage: #5644.Visual explanation by Codex using HumanLayer show-me.
🐳 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:217927e-pythonRun
All tags pushed for this build
About Multi-Architecture Support
217927e-python) is a multi-arch manifest supporting both amd64 and arm64217927e-python-amd64) are also available if needed