From deae71e73dea0627f6b2890d06b0a0c17cd97eff Mon Sep 17 00:00:00 2001 From: hieptl Date: Sat, 24 Oct 2026 15:36:52 +0700 Subject: [PATCH 1/2] feat(settings): add feature flags for the Agent Context and Agent Profiles pages (OHE-3744) Two env-backed web-client feature flags, both default off: - enable_agent_context_page (ENABLE_AGENT_CONTEXT_PAGE) shows the dedicated Agent Context settings page. - enable_agent_profiles_page (ENABLE_AGENT_PROFILES_PAGE) replaces the personal Agent page with Agent Profiles, and implies the Agent Context page since the Agent page hosted the memory toggle. isSettingsPageHidden hides /settings/agent-context and /settings/agents unless the matching flag is on, so the nav item and the route redirect share one rule. No visible change while both flags are off. --- .../src/api/option-service/option.types.ts | 6 +++++ frontend/src/i18n/declaration.ts | 2 +- frontend/src/utils/settings-utils.ts | 22 +++++++++++++++++++ .../default_web_client_config_injector.py | 5 ++++- .../web_client/web_client_models.py | 11 ++++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/frontend/src/api/option-service/option.types.ts b/frontend/src/api/option-service/option.types.ts index 05e163bedd..ae8bdbf1d1 100644 --- a/frontend/src/api/option-service/option.types.ts +++ b/frontend/src/api/option-service/option.types.ts @@ -71,6 +71,12 @@ export interface WebClientFeatureFlags { * managed/OpenHands models, managed LLM key create/refresh) and show a * "Please enable LiteLLM to use this feature" placeholder instead. */ enable_litellm?: boolean; + /** When true, Personal Settings shows the dedicated Agent Context page + * (``/settings/agent-context``). Off by default until bug bash. */ + enable_agent_context_page?: boolean; + /** When true, the personal ``Agent`` page is replaced by Agent Profiles + * (``/settings/agents``). Off by default until bug bash. */ + enable_agent_profiles_page?: boolean; } export interface ACPModelOption { diff --git a/frontend/src/i18n/declaration.ts b/frontend/src/i18n/declaration.ts index 73e9d376b8..e7206053a3 100644 --- a/frontend/src/i18n/declaration.ts +++ b/frontend/src/i18n/declaration.ts @@ -1084,7 +1084,6 @@ export enum I18nKey { AUTH$DUPLICATE_EMAIL_ERROR = "AUTH$DUPLICATE_EMAIL_ERROR", AUTH$RECAPTCHA_BLOCKED = "AUTH$RECAPTCHA_BLOCKED", AUTH$ACCOUNT_DISABLED = "AUTH$ACCOUNT_DISABLED", - AUTH$GIT_PROVIDER_LOGIN_FAILED = "AUTH$GIT_PROVIDER_LOGIN_FAILED", AUTH$LETS_GET_STARTED = "AUTH$LETS_GET_STARTED", AUTH$INVITATION_PENDING = "AUTH$INVITATION_PENDING", AUTH$BITBUCKET_SIGNUP_DISABLED = "AUTH$BITBUCKET_SIGNUP_DISABLED", @@ -2185,6 +2184,7 @@ export enum I18nKey { SUPER_ADMIN$AUTH_PROVIDER_UPDATE_ERROR = "SUPER_ADMIN$AUTH_PROVIDER_UPDATE_ERROR", SUPER_ADMIN$AUTH_PROVIDER_DELETE_SUCCESS = "SUPER_ADMIN$AUTH_PROVIDER_DELETE_SUCCESS", SUPER_ADMIN$AUTH_PROVIDER_DELETE_ERROR = "SUPER_ADMIN$AUTH_PROVIDER_DELETE_ERROR", + AUTH$GIT_PROVIDER_LOGIN_FAILED = "AUTH$GIT_PROVIDER_LOGIN_FAILED", SUPER_ADMIN$BACK_TO_AUTH_PROVIDERS = "SUPER_ADMIN$BACK_TO_AUTH_PROVIDERS", SUPER_ADMIN$AUTH_PROVIDER_USER_LINKS = "SUPER_ADMIN$AUTH_PROVIDER_USER_LINKS", SUPER_ADMIN$AUTH_PROVIDER_USER_LINKS_SUBTITLE = "SUPER_ADMIN$AUTH_PROVIDER_USER_LINKS_SUBTITLE", diff --git a/frontend/src/utils/settings-utils.ts b/frontend/src/utils/settings-utils.ts index 3788535ab1..e436b02b72 100644 --- a/frontend/src/utils/settings-utils.ts +++ b/frontend/src/utils/settings-utils.ts @@ -43,6 +43,20 @@ export const ADMIN_ONLY_SETTINGS_PATHS = new Set([ "/settings/budgets", ]); +/** + * The Agent Context page (OHE-3456) is on when its own flag is, or when the + * Agent Profiles page is: that page replaces the Agent page which hosted the + * memory toggle, so it needs the toggle's new home too. + */ +export function isAgentContextPageEnabled( + featureFlags: WebClientFeatureFlags | undefined, +): boolean { + return !!( + featureFlags?.enable_agent_context_page || + featureFlags?.enable_agent_profiles_page + ); +} + /** * Checks if a settings page should be hidden based on feature flags. * Used by both the route loader and navigation hook to keep logic in sync. @@ -64,6 +78,14 @@ export function isSettingsPageHidden( return true; if (featureFlags?.hide_integrations_page && path === "/settings/integrations") return true; + // OHE-3456 pages stay hidden until their flag is turned on. + if ( + !isAgentContextPageEnabled(featureFlags) && + path === "/settings/agent-context" + ) + return true; + if (!featureFlags?.enable_agent_profiles_page && path === "/settings/agents") + return true; return false; } diff --git a/openhands/app_server/web_client/default_web_client_config_injector.py b/openhands/app_server/web_client/default_web_client_config_injector.py index 5e00cd73bf..e290f2f1a8 100644 --- a/openhands/app_server/web_client/default_web_client_config_injector.py +++ b/openhands/app_server/web_client/default_web_client_config_injector.py @@ -217,7 +217,8 @@ def _get_feature_flags() -> WebClientFeatureFlags: Reads ENABLE_BILLING, HIDE_LLM_SETTINGS, ENABLE_JIRA, ENABLE_JIRA_DC, ENABLE_LINEAR, HIDE_USERS_PAGE, HIDE_BILLING_PAGE, HIDE_INTEGRATIONS_PAGE, HIDE_PERSONAL_WORKSPACES, OH_ENABLE_ONBOARDING, ENABLE_AGENT_CANVAS_BANNER, - ENABLE_BYOR_EXPORT, ENABLE_SUPER_ADMIN, and ENABLE_OAUTH_V2_LOGIN from + ENABLE_BYOR_EXPORT, ENABLE_SUPER_ADMIN, ENABLE_OAUTH_V2_LOGIN, + ENABLE_AGENT_CONTEXT_PAGE, and ENABLE_AGENT_PROFILES_PAGE from environment. OH_ALLOW_USER_LLM_CONFIGURATION and ENABLE_ACP are the exceptions: they @@ -256,6 +257,8 @@ def _get_feature_flags() -> WebClientFeatureFlags: enable_super_admin=_env_flag_enabled('ENABLE_SUPER_ADMIN'), enable_oauth_v2_login=_env_flag_enabled('ENABLE_OAUTH_V2_LOGIN'), enable_litellm=_env_flag_enabled('ENABLE_LEGACY_LITELLM', 'true'), + enable_agent_context_page=_env_flag_enabled('ENABLE_AGENT_CONTEXT_PAGE'), + enable_agent_profiles_page=_env_flag_enabled('ENABLE_AGENT_PROFILES_PAGE'), ) diff --git a/openhands/app_server/web_client/web_client_models.py b/openhands/app_server/web_client/web_client_models.py index 99320b2954..eb1e2064f8 100644 --- a/openhands/app_server/web_client/web_client_models.py +++ b/openhands/app_server/web_client/web_client_models.py @@ -71,6 +71,17 @@ class WebClientFeatureFlags(BaseModel): # create/refresh) and show a "Please enable LiteLLM to use this # feature" placeholder instead. Set from the ENABLE_LEGACY_LITELLM env var. enable_litellm: bool = True + # OHE-3456 settings pages, hidden until bug bash is complete. Each gates + # one Personal Settings entry: ``enable_agent_context_page`` shows the + # dedicated Agent Context page (``/settings/agent-context``) and + # ``enable_agent_profiles_page`` replaces ``Agent`` with Agent Profiles + # (``/settings/agents``) and, because that Agent page hosted the memory + # toggle, also shows the Agent Context page. Set from ENABLE_AGENT_CONTEXT_PAGE and + # ENABLE_AGENT_PROFILES_PAGE (or the OH_WEB_CLIENT_FEATURE_FLAGS_* form). + # Default False so every existing install keeps today's settings UI. + # UI-level only -- the agent-profiles API is not gated. + enable_agent_context_page: bool = False + enable_agent_profiles_page: bool = False # This can be removed / replaced when a DeploymentMode (or similar) env var is created. @model_validator(mode='after') From 41816928a5c50eb7f52618f44a50989f82d0e05b Mon Sep 17 00:00:00 2001 From: hieptl Date: Sat, 24 Oct 2026 15:36:52 +0700 Subject: [PATCH 2/2] feat(settings): add the personal Agent Context page behind a feature flag (OHE-3745) Moves the "Enable Persistent Memory" toggle out of Settings > Agent into its own Personal Settings item, /settings/agent-context (SaaS only), shown when enable_agent_context_page (or enable_agent_profiles_page) is on. The page saves enable_memory_context through the existing settings endpoint. With the flag on, the Agent page no longer renders the inline section; with it off, the Agent page is unchanged. The item is OpenHands-only (disabledByAcp), as the inline section was. --- frontend/src/constants/settings-nav.tsx | 10 ++ frontend/src/i18n/declaration.ts | 1 + frontend/src/i18n/translation.json | 17 +++ frontend/src/routes.ts | 1 + .../src/routes/agent-context-settings.tsx | 100 ++++++++++++++++++ frontend/src/routes/agent-settings.tsx | 8 +- frontend/src/routes/settings.tsx | 1 + 7 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 frontend/src/routes/agent-context-settings.tsx diff --git a/frontend/src/constants/settings-nav.tsx b/frontend/src/constants/settings-nav.tsx index 6c2104fe38..ffe484eaf7 100644 --- a/frontend/src/constants/settings-nav.tsx +++ b/frontend/src/constants/settings-nav.tsx @@ -106,6 +106,16 @@ export const SAAS_NAV_ITEMS: SettingsNavItem[] = [ subtitle: "SETTINGS$PAGE_AGENT_SUBLINE", section: "personal", }, + { + icon: , + to: "/settings/agent-context", + text: "SETTINGS$AGENT_CONTEXT", + subtitle: "SETTINGS$PAGE_AGENT_CONTEXT_SUBLINE", + section: "personal", + // Persistent memory only applies to the OpenHands agent, as the inline + // section this page replaces did. + disabledByAcp: true, + }, { icon: , to: "/settings", diff --git a/frontend/src/i18n/declaration.ts b/frontend/src/i18n/declaration.ts index e7206053a3..91a2d2f67d 100644 --- a/frontend/src/i18n/declaration.ts +++ b/frontend/src/i18n/declaration.ts @@ -2202,4 +2202,5 @@ export enum I18nKey { SUPER_ADMIN$AUTH_PROVIDER_USER_LINK_SELECT_PLACEHOLDER = "SUPER_ADMIN$AUTH_PROVIDER_USER_LINK_SELECT_PLACEHOLDER", SUPER_ADMIN$AUTH_PROVIDER_USER_LINK_UPDATE_SUCCESS = "SUPER_ADMIN$AUTH_PROVIDER_USER_LINK_UPDATE_SUCCESS", SUPER_ADMIN$AUTH_PROVIDER_USER_LINK_UPDATE_ERROR = "SUPER_ADMIN$AUTH_PROVIDER_USER_LINK_UPDATE_ERROR", + SETTINGS$PAGE_AGENT_CONTEXT_SUBLINE = "SETTINGS$PAGE_AGENT_CONTEXT_SUBLINE", } diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.json index 2658fdd7dd..09e17b9ba5 100644 --- a/frontend/src/i18n/translation.json +++ b/frontend/src/i18n/translation.json @@ -37432,5 +37432,22 @@ "de": "Failed to update user link.", "uk": "Failed to update user link.", "ca": "Failed to update user link." + }, + "SETTINGS$PAGE_AGENT_CONTEXT_SUBLINE": { + "en": "Let the agent keep notes and recall them in new conversations.", + "ja": "エージェントがメモを保存し、新しい会話で思い出せるようにします。", + "zh-CN": "让代理保存笔记并在新对话中回忆起来。", + "zh-TW": "讓代理保存筆記並在新對話中回憶起來。", + "ko-KR": "에이전트가 메모를 저장하고 새 대화에서 기억하도록 합니다.", + "no": "La agenten lagre notater og hente dem frem i nye samtaler.", + "it": "Consenti all'agente di prendere appunti e richiamarli nelle nuove conversazioni.", + "pt": "Permita que o agente guarde notas e as recorde em novas conversas.", + "es": "Permite que el agente guarde notas y las recuerde en nuevas conversaciones.", + "ar": "دَع الوكيل يحتفظ بالملاحظات ويستعيدها في المحادثات الجديدة.", + "fr": "Laissez l'agent conserver des notes et les rappeler dans les nouvelles conversations.", + "tr": "Ajanın not tutmasına ve yeni konuşmalarda bunları hatırlamasına izin verin.", + "de": "Lässt den Agenten Notizen führen und sie in neuen Konversationen abrufen.", + "uk": "Дозвольте агенту вести нотатки та згадувати їх у нових розмовах.", + "ca": "Permet que l'agent desi notes i les recordi en converses noves." } } diff --git a/frontend/src/routes.ts b/frontend/src/routes.ts index 44f6165c6d..8eb0b83dcc 100644 --- a/frontend/src/routes.ts +++ b/frontend/src/routes.ts @@ -28,6 +28,7 @@ export default [ route("settings", "routes/settings.tsx", [ index("routes/llm-settings.tsx"), route("agent", "routes/agent-settings.tsx"), + route("agent-context", "routes/agent-context-settings.tsx"), route("condenser", "routes/condenser-settings.tsx"), route("verification", "routes/verification-settings.tsx"), route("org-defaults", "routes/org-default-llm-settings.tsx"), diff --git a/frontend/src/routes/agent-context-settings.tsx b/frontend/src/routes/agent-context-settings.tsx new file mode 100644 index 0000000000..c1c0eb5e74 --- /dev/null +++ b/frontend/src/routes/agent-context-settings.tsx @@ -0,0 +1,100 @@ +import { useState } from "react"; +import { AxiosError } from "axios"; +import { useTranslation } from "react-i18next"; +import { BrandButton } from "#/components/features/settings/brand-button"; +import { SettingsSwitch } from "#/components/features/settings/settings-switch"; +import { useSaveSettings } from "#/hooks/mutation/use-save-settings"; +import { useSettings } from "#/hooks/query/use-settings"; +import { I18nKey } from "#/i18n/declaration"; +import { Typography } from "#/ui/typography"; +import { + displayErrorToast, + displaySuccessToast, +} from "#/utils/custom-toast-handlers"; +import { + formControlSwitchDescriptionClassName, + formControlSwitchFieldClassName, +} from "#/utils/form-control-classes"; +import { createPermissionGuard } from "#/utils/org/permission-guard"; +import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message"; +import { cn } from "#/utils/utils"; + +export const clientLoader = createPermissionGuard("view_llm_settings"); + +/** + * Personal "Agent Context" page (SaaS): the persistent-memory toggle that used + * to sit at the bottom of the Agent page. Saves ``enable_memory_context`` on + * the user's settings; agent behaviour itself is configured per Agent Profile. + */ +export default function AgentContextSettingsScreen() { + const { t } = useTranslation(); + const { mutate: saveSettings, isPending } = useSaveSettings(); + const { data: settings, isLoading } = useSettings(); + + const initialMemoryEnabled = !!settings?.enable_memory_context; + const [memoryOverride, setMemoryOverride] = useState( + undefined, + ); + const isMemoryEnabled = memoryOverride ?? initialMemoryEnabled; + const isDirty = isMemoryEnabled !== initialMemoryEnabled; + + const handleSave = () => { + saveSettings( + { enable_memory_context: isMemoryEnabled }, + { + onError: (error) => { + const message = retrieveAxiosErrorMessage(error as AxiosError); + displayErrorToast(message || t(I18nKey.ERROR$GENERIC)); + }, + onSuccess: () => { + displaySuccessToast(t(I18nKey.SETTINGS$SAVED)); + setMemoryOverride(undefined); + }, + }, + ); + }; + + if (isLoading) return null; + + return ( +
+
+
+ + {t(I18nKey.SETTINGS$ENABLE_MEMORY_CONTEXT)} + + + {t(I18nKey.SETTINGS$ENABLE_MEMORY_CONTEXT_HELPER)} + +
+
+ +
+ + {isPending + ? t(I18nKey.SETTINGS$SAVING) + : t(I18nKey.SETTINGS$SAVE_CHANGES)} + +
+
+ ); +} diff --git a/frontend/src/routes/agent-settings.tsx b/frontend/src/routes/agent-settings.tsx index 31fedcf4b7..dd3fe844f1 100644 --- a/frontend/src/routes/agent-settings.tsx +++ b/frontend/src/routes/agent-settings.tsx @@ -21,6 +21,7 @@ import { displaySuccessToast, } from "#/utils/custom-toast-handlers"; import { createPermissionGuard } from "#/utils/org/permission-guard"; +import { isAgentContextPageEnabled } from "#/utils/settings-utils"; import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message"; import { coerceFieldValue, @@ -82,6 +83,11 @@ export default function AgentSettingsScreen() { const isAcpEnabled = !!config?.feature_flags?.enable_acp; const acpProviders = config?.acp_providers ?? EMPTY_ACP_PROVIDERS; + // OHE-3456: once the dedicated (SaaS-only) Agent Context page is on, the + // memory toggle lives there and this page no longer shows it. + const hasAgentContextPage = + config?.app_mode === "saas" && + isAgentContextPageEnabled(config?.feature_flags); // ── Parallel tool calls (OpenHands mode) ───────────────────────────────── // Surfaced only when the backend schema exposes the field, so older @@ -317,7 +323,7 @@ export default function AgentSettingsScreen() { ) : null} {/* Agent Context: persistent memory toggle (OpenHands mode) */} - {!isAcp && ( + {!isAcp && !hasAgentContextPage && (

{t(I18nKey.SETTINGS$AGENT_CONTEXT)} diff --git a/frontend/src/routes/settings.tsx b/frontend/src/routes/settings.tsx index 7c5eb54dec..a708c49378 100644 --- a/frontend/src/routes/settings.tsx +++ b/frontend/src/routes/settings.tsx @@ -36,6 +36,7 @@ import { useMe } from "#/hooks/query/use-me"; import { OrgWideSettingsBadge } from "#/components/features/settings/org-wide-settings-badge"; const SAAS_ONLY_PATHS = [ + "/settings/agent-context", "/settings/user", "/settings/billing", "/settings/credits",