Repository navigation
fix(agent-profiles): keep the member's agent kind in sync with the active agent profile (OHE-3851) - #1150
Merged
hieptl merged 2 commits intoNov 5, 2026
Conversation
…tive agent profile (OHE-3851) Activating an agent profile only moved the member's pointer, so the agent_kind in org_member.agent_settings_diff kept whatever onboarding or POST /api/v1/settings last wrote. After an ACP setup and a switch back to an OpenHands profile, a plain settings load still composed agent_kind "acp": - GET /api/settings reported ACP, so Canvas showed the ACP model picker. - A launch with no active profile ran the composed settings and started an ACP conversation. - The managed-key helpers classify from the plain load, so the launch-time refresh skipped the member and never verified or rotated a stale managed key. Activation now writes the profile's agent_kind into the member diff when it differs from the composed kind, for personal and organization profiles. Saving the active personal profile with a different kind does the same, because an overwrite keeps the profile id and the pointer never moves. Nothing else from the profile is written; its settings are still resolved at conversation start.
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
hieptl
marked this pull request as ready for review
November 4, 2026 07:34
…switching-the-active-agent
hieptl
deleted the
hiep/ohe-3851-stale-member-agent_kind-after-switching-the-active-agent
branch
November 5, 2026 14:31
Contributor
|
🚀 Released in 1.87.0. |
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:
AGENT:
Why
Activating an agent profile only writes
org_member.active_agent_profile_id. Theagent_kindinorg_member.agent_settings_diffkeeps whatever onboarding orPOST /api/v1/settingslast wrote, and a plainSaasSettingsStore.load()composesagent_kindfrom that diff. After a user sets up an ACP agent and then switches the active agent profile back to OpenHands, the persisted view still saysacpwhile the launch view runs OpenHands:GET /api/settingsreports ACP. When no active profile resolves, Canvas falls back to that value and shows the ACP model picker on the home page.get_current_managed_llm_key,clear_stale_org_level_llm_key_if_managedandrotate_managed_llm_keyclassify from the plain load and bail for ACP._maybe_refresh_managed_llm_keythen logsskip_no_current_managed_keyand never verifies or rotates a stale managed key on an OpenHands launch.Summary
agent_kindinto the member'sagent_settings_diffwhen it differs from the composed kind. Only the discriminator is written: the profile's settings are still resolved at conversation start, andagent_settings_appliedstaysfalse.tests/unit/test_agent_profiles.pycover the switch back for the settings view, the managed-key check the launch refresh relies on, a kind-changing save, and a launch with no active profile.Issue Number
OHE-3851. Fixes #1005.
How to Test
uv run python -m pytest tests/unit/test_agent_profiles.py uv run python -m pytest tests/unit/test_saas_settings_store.py -k "managed_key or acp or agent_profile"97 tests pass (the store tests start Postgres through Docker), and the 5 new tests fail on
main.ruff0.12.5, the version pre-commit pins, is clean, and mypy reports nothing new on the touched file.To check it by hand on a cloud account:
GET /api/settingsreturnsagent_settings.agent_kind: "acp".GET /api/settingsnow returns"openhands".GET /api/settingsreturns"acp"again.I have not run this on a deployed environment yet.
Video/Screenshots
Backend only.
Type
Notes
agent_kind, so the composedacp_serverstays whatever onboarding wrote. Launches still use the profile's own ACP settings.Enterprise server image for this PR: