Repository navigation
fix(agent-profiles): honor profile settings in cloud launches - #15228
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
|
👋 Thanks for opening this PR! Before review, please add a short note in the Please put that note between |
enyst
left a comment
There was a problem hiding this comment.
Left a little nit question inline. We are trying to use stronger types, because they help the agent; they enable the agent-generated code to hit errors when it makes weird stuff, thus I think maybe it reduces the potential for avoidable bugs.
In other codebases, agent-sdk and openhands-cli I’m pretty sure, we have really tried to avoid getattr and the like as much as possible. I think not so much in the openhands codebase, it’s an older more chaotic codebase… but IMHO it’s not too late to start, if we can.
all-hands-bot
left a comment
There was a problem hiding this comment.
✅ QA Report: PASS
Verified the Agent Profile launch path before/after the PR; the PR preserves profile-selected tools and context while keeping planning launches constrained.
Does this PR achieve its stated goal?
Yes. On origin/main, the same launch scenarios reproduced the reported bug: a bare profile (tools: []) and an explicit terminal-only profile both launched with the default cloud toolset, profile context was dropped, and SwitchLLMTool was re-added despite the profile disabling it. On PR head 41c038438, actual app-conversation start-request construction preserved tools: [], explicit tools, profile suffixes, secrets, skills, disabled skills, and the switch-LLM gate; planning launches still used only planning tools.
| Phase | Result |
|---|---|
| Environment Setup | ✅ uv sync --frozen completed and the backend launch path imported successfully. |
| CI Status | ✅ All sampled GitHub checks were green; only qa-changes was in progress because this QA review was running. |
| Functional Verification | ✅ Before/after execution showed the bug on base and fixed behavior on the PR. |
Functional Verification
Test 1: resolved Agent Profile settings drive the launched agent
Step 1 — Reproduce / establish baseline without the fix:
Ran the harness against origin/main after creating a detached worktree:
git worktree add -f --detach /tmp/oh-main origin/main
cd /tmp/oh-main
PYTHONPATH=/tmp/oh-main /home/runner/work/OpenHands/OpenHands/pr-repo/.venv/bin/python /tmp/qa_agent_profile_launch.pyRelevant output:
{
"bare_profile": {
"tool_count": 4,
"tool_names": ["terminal", "file_editor", "task_tracker", "browser_tool_set"],
"system_suffix": "REQUEST_SUFFIX",
"secret_names": ["LAUNCH_SECRET"],
"skill_names": [],
"disabled_skills": [],
"include_default_tools": ["FinishTool", "ThinkTool", "SwitchLLMTool"]
},
"explicit_tools_profile": {
"tool_count": 4,
"tool_names": ["terminal", "file_editor", "task_tracker", "browser_tool_set"]
}
}This confirms the bug: profile-selected tools and profile context were overwritten by cloud launch defaults, and the disabled switch-LLM tool was restored.
Step 2 — Apply the PR's changes:
Checked out the PR head already present in the workspace: 41c038438eb4637e04a45ab2eb062260d4ee02ff.
Step 3 — Re-run with the fix in place:
Ran the same harness against the PR checkout:
cd /home/runner/work/OpenHands/OpenHands/pr-repo
uv run python /tmp/qa_agent_profile_launch.pyRelevant output:
{
"bare_profile": {
"tool_count": 0,
"tool_names": [],
"system_suffix": "PROFILE_SUFFIX\n\nREQUEST_SUFFIX",
"secret_names": ["LAUNCH_SECRET", "PROFILE_SECRET"],
"skill_names": ["profile-skill"],
"disabled_skills": ["member-disabled-skill", "disabled-profile-skill"],
"include_default_tools": ["FinishTool", "ThinkTool"]
},
"default_tools_profile": {
"tool_count": 4,
"tool_names": ["terminal", "file_editor", "task_tracker", "browser_tool_set"]
},
"explicit_tools_profile": {
"tool_count": 1,
"tool_names": ["terminal"]
}
}This shows the PR fixes the core launch behavior: tools: [] stays bare, tools: null still gets cloud defaults, explicit tools are preserved, profile and launch context are merged, and the profile-disabled switch-LLM tool remains disabled.
Test 2: planning launches remain constrained
The same before/after harness also exercised a planning launch from a bare profile. On origin/main, planning already used the planning-only toolset but lost the profile suffix. On PR head, planning still launched with only planning tools and retained the profile context:
{
"planning_from_bare_profile": {
"tool_count": 3,
"tool_names": ["glob", "grep", "planning_file_editor"],
"system_suffix": "PROFILE_SUFFIX\n\n<IMPORTANT_PLANNING_BOUNDARIES>...\n\nREQUEST_SUFFIX"
}
}This confirms the PR did not regress the intentionally constrained planning toolset while fixing profile context preservation.
Issues Found
None.
AI disclosure: This QA review was created by an AI agent (OpenHands) on behalf of the requester.
|
@OpenHands do a /codereview-roasted on this pr. post your feedback as a review on gh api |
|
Uh oh! There was an unexpected error starting the job :( |
enyst
left a comment
There was a problem hiding this comment.
Hi — I’m OpenHands-GPT-5.6 on Engel’s MacBook.
🟢 Good taste
I independently traced the launch path against the SDK 1.36.0 contracts and found no blocking issue. The change resolves one launch snapshot and consistently reuses it for agent selection, construction, disabled-skill filtering, ACP metadata, and profile provenance. That removes the prior time-of-check/time-of-use mismatch without adding another source of truth.
The OpenHands branch now preserves the profile’s tri-state tool semantics (None = cloud defaults, [] = deliberately bare, explicit list = exact list), uses the resolved AgentContext as the base while additively composing launch suffixes and secrets, and leaves switch-LLM gating to the SDK setting. The ACP branch likewise keeps the resolved profile settings and deny-list while applying launch-only context. The explicit planning-tool override is clear and intentional.
The regression coverage exercises the important boundaries: tri-state tools, profile/member skill exclusions, profile and launch context composition, switch-tool disablement, planning launches, ACP context, one resolution per start, and matching provenance. The PR also includes concrete runtime evidence, and all required checks pass on the reviewed head.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟡 MEDIUM
This touches the central cloud conversation-start path and both OpenHands and ACP launch behavior, so the blast radius is meaningful. The implementation is narrowly scoped, preserves existing launch overlays, adds strong regression coverage, and has successful end-to-end and CI validation, which keeps the residual risk controlled.
VERDICT:
✅ Worth merging: The profile is now the authoritative launch base, while cloud-only overlays remain explicit and additive.
KEY INSIGHT:
A single resolved snapshot eliminates both configuration drift during startup and provenance drift after startup.
AI disclosure: This review was generated by OpenHands on Engel’s behalf.
|
🚀 Released in cloud-1.47.0. |
HUMAN:
AGENT:
Implemented and verified by Codex.
What this fixes
In simple terms: selecting an Agent Profile in OpenHands Cloud did not fully control the agent that launched.
Cloud correctly resolved the selected profile, but later launch code replaced parts of it. This could remove the profile's instructions, replace its chosen tools, and prevent
tools: []from creating a bare agent. The profile was also resolved a second time for provenance, so an edit made during startup could make the recorded profile revision differ from the settings that actually launched.User-visible behavior
tools: nullreceives the normal cloud and browser tools.tools: []launches a deliberately bare agent.There are no new UI components or API-contract changes. Existing UI that shows the launched Agent Profile now receives reliable profile ID and revision data.
Implementation
Validation
Real local HTTP validation
Started a local app-server harness using the production
stream-startrouter,LiveStatusAppConversationService,SaasSettingsStore, and SDK profile resolver. It sent real requests to a separately running OpenHands agent-server throughPOST /api/conversations. Only cloud sandbox allocation/workspace bootstrap was replaced with a fixed local sandbox descriptor.Five conversation launches reached
READY:terminalwas present; the referenced MCP server was retained; provenance recorded the override while the ambient pointer remained unchanged.The instrumentation recorded five resolved-profile loads for five starts: exactly one per conversation-start attempt.
Local automated checks
148 passed: app-conversation service tests underpytest --forked -n 4.45 passed: enterprise Agent Profile tests underpytest --forked -n 4.During review, the first CI run exposed a nondeterministic UUID generated during pytest collection. The parametrization was made deterministic and the production-style xdist topology was rerun locally.
GitHub CI
Current head
41c038438completed all required CI checks successfully, including root and enterprise Python tests and lint, frontend lint, package/version checks, coverage, and app/enterprise image builds for both architectures.Issues
Closes OpenHands/enterprise#59
Closes OpenHands/enterprise#51
Related: OpenHands/software-agent-sdk#3713 and OpenHands/software-agent-sdk#3978.
Type
Video/Screenshots
Not applicable; this is a backend correctness change with no visual layout changes.
To run this PR locally, use the following command:
GUI with Docker: