Repository navigation
feat(sdk): express meta-profile routing on Agent Profiles - #5408
simonrosenberg merged 3 commits into
Conversation
`OpenHandsAgentProfile` gains `enable_classify_and_switch_llm_tool` and `meta_profile_ref`. `resolve` copies the meta-profile and every LLM it routes to into the settings, so a runtime without the stores (a Docker container) can still route, and a dangling meta-profile or routed LLM joins the one `UnresolvedProfileReferences`. The `default` seed carries the routing settings. Co-authored-by: openhands <openhands@all-hands.dev> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: openhands <openhands@all-hands.dev> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||||||||||||
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope. SDK / Agent Server change (launch resolution plus two Agent Profile fields) — belongs in this repository per the AGENTS.md cross-repository boundaries. The linked epic #5398 is open with ready-for-dev; this is one of its split-out PRs.
Current state (re-read now). Head aa403a63e5a0ac56fe82dce1f29ddfe5d56295a6 matches the requested SHA; the PR is open with no labels, no prior reviews, and no comments from any other account (only the coverage bot). Every check-run on this head is green (sdk-tests, agent-server-tests, cross-tests, workspace-tests, tools-tests, pre-commit, check-docstrings, endpoint-audit, …).
What I verified.
resolvenow copies the named meta-profile and every LLM it routes to into the resolved settings (meta_profile,meta_profile_llms), so a store-less runtime can still route. A missing meta-profile or routed LLM joins the singleUnresolvedProfileReferences422 asdangling_meta_profile_ref/dangling_meta_profile_llms, andpreview_launchsurfaces both. The field-ownership table now classifies the four routing settings fields as profile-owned.- Routing is only resolved when
enable_classify_and_switch_llm_toolis on; a disabled profile with a stalemeta_profile_refstill launches (test_a_disabled_routing_tool_ignores_its_meta_profile_ref). - Credentials: routed LLMs loaded from the store carry their
api_keyintometa_profile_llms. I confirmed that an ordinarymodel_dump(mode="json")of the built agent redacts every key, and thatforward_to_runtimeencrypts them (no plaintext in the forwarded payload). The only plaintext copies are the existing trusted-backendexpose_secretspaths. uv run pytest tests/sdk/launch tests/sdk/profiles tests/sdk/settings -q→ 277 passed. Thetests/agent_server/test_launch_parity.pylaunch/forward cases are not runnable in this sandbox (conversation-dir permission), so for that path I relied on the greenagent-server-testscheck.- No distributable package version changed.
Non-blocking observation. In _load_meta_profile, when stores.meta_profiles is None the function reports the name as a dangling reference (return None, {}, name, []). For a LaunchStores that simply does not wire the meta-profile store, the user then sees a Meta-profile 'X' not found 422 rather than a store-not-wired error. The agent-server path always wires the store, so this is not blocking — but a distinct message would be clearer if a future caller omits it.
Assessment. The change is scoped to the launch pipeline and traced through resolve → preview → seed → forward/validate, with unit coverage plus the author's Docker e2e evidence. No material correctness, security, compatibility, or acceptance-criterion defect on this head.
✅ APPROVED
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope. SDK / Agent Server change (launch resolution plus two Agent Profile fields) — belongs in this repository per the AGENTS.md cross-repository boundaries. The linked epic #5398 is open with ready-for-dev; this is one of its split-out PRs.
Current state (re-read now). Head is c838c5df8889d4b5191e5a9100036167339cd804; the PR is open with no labels, no review comments, and no comments from any other account (only the coverage bot). Every check-run on this head is green (sdk-tests, agent-server-tests, cross-tests, workspace-tests, tools-tests, windows-tests, pre-commit, check-docstrings, endpoint-audit, …).
Delta since my earlier review of aa403a63. The only change is the automated chore: Remove PR-only artifacts commit, which deletes the four .pr/ evidence files. git diff aa403a63 c838c5df -- ':!.pr' is empty, so the reviewed code is byte-for-byte identical; the earlier findings and verdict carry over unchanged.
What the code does, verified on this head.
OpenHandsAgentProfilegainsenable_classify_and_switch_llm_toolandmeta_profile_ref;resolvecopies the named meta-profile and every LLM it routes to into the resolved settings (meta_profile,meta_profile_llms) so a store-less runtime can still route. A missing meta-profile or routed LLM joins the singleUnresolvedProfileReferences422 asdangling_meta_profile_ref/dangling_meta_profile_llm_refs, andpreview_launchsurfaces both. The field-ownership table now classifies the four routing settings fields as profile-owned.- Routing is only resolved when the tool is enabled; a disabled profile with a stale
meta_profile_refstill launches. - Credentials: routed LLMs loaded from the store carry their
api_keyintometa_profile_llms; an ordinarymodel_dump(mode="json")of the built agent redacts every key, andforward_to_runtimeencrypts them (no plaintext in the forwarded payload). Only the existing trusted-backendexpose_secretspaths carry plaintext. uv run pytest tests/sdk/launch tests/sdk/profiles tests/sdk/settings -q→ 277 passed. No distributable package version changed.
Non-blocking observation (unchanged). In _load_meta_profile, when stores.meta_profiles is None the function reports the name as a dangling reference rather than a store-not-wired error; the agent-server path always wires the store, so this is not blocking.
Assessment. Scoped to the launch pipeline and traced through resolve → preview → seed → forward/validate, with unit coverage plus the author's Docker e2e evidence. No material correctness, security, compatibility, or acceptance-criterion defect on this head.
✅ APPROVED
beb5cf8
into
agent-launch-resolve-finalize
HUMAN:
Meta-profile routing on Agent Profiles, split out of #5406 at my request (part of #5398). The agent verified it end to end in the Docker runtime, paired with #5406. Evidence is in
.pr/meta_profile_routing_e2e.md.AGENT:
Why
The #4287 meta-profile routing fields never reached Agent Profiles. Routing therefore works on an
agent_settingslaunch and silently does not on a profile launch. In the Docker runtime it could not work even if a profile named the meta-profile, because the container's HOME has no meta-profile store.Summary
OpenHandsAgentProfilegainsenable_classify_and_switch_llm_toolandmeta_profile_ref.resolvecopies the meta-profile and every LLM it routes to into the settings (meta_profile,meta_profile_llms). A runtime without the stores can then route. Direct routing (a meta-profile with aprompt_template) may pick any saved LLM profile, so every readable one is copied.UnresolvedProfileReferences422 (dangling_meta_profile_ref,dangling_meta_profile_llm_refs).materializereports both.defaultseed carries the routing settings from the global settings.NotOnProfilegap besidesuser_message_suffixandregistered_marketplaces.Issue Number
Part of #5398
How to Test
Stacked on #5406, which adds the launch pipeline this extends.
Unit suites on this branch and on #5406:
End to end:
python .pr/launch_docker_e2e.py --sdk <checkout> --image <agent-server image> --container-browser yes|no --mock-llm <canvas>/tests/e2e/mock-llm/scripts/mock-llm-server.py. It runs a host in Docker runtime mode, and each container image is built from the same commit. The container's HOME has no stores. The profile names a meta-profile whose classifier and class use two saved LLM profiles.dangling_meta_profile_ref), and no container starts.meta_profile_refcannot be saved (422), so both routing checks fail. The other 12 checks pass on both..pr/meta_profile_routing_e2e.md.Video/Screenshots
API-level change.
Design Doc
#5398 ("The #4287 meta-profile fields can be set on a profile through
meta_profile_ref", and routing in a Docker runtime with no meta-profile store).Type
Notes
meta_profile_ref: nullwith the tool enabled keeps today's behavior: the tool falls back to the first meta-profile in the runtime's own store.meta_profile_ref, so a stale reference on a disabled profile does not fail its launch.clients/typescriptis not updated. Its hand-written profile models already lagmain, so the two profile fields and three diagnostics fields go with that refresh.🤖 Generated with Claude Code