Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions frontend/src/api/option-service/option.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/constants/settings-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ export const SAAS_NAV_ITEMS: SettingsNavItem[] = [
subtitle: "SETTINGS$PAGE_AGENT_SUBLINE",
section: "personal",
},
{
icon: <MemoryIcon width={ICON_SIZE} height={ICON_SIZE} />,
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: <CircuitIcon width={ICON_SIZE} height={ICON_SIZE} />,
to: "/settings",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
}
17 changes: 17 additions & 0 deletions frontend/src/i18n/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
1 change: 1 addition & 0 deletions frontend/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
100 changes: 100 additions & 0 deletions frontend/src/routes/agent-context-settings.tsx
Original file line number Diff line number Diff line change
@@ -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<boolean | undefined>(
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 (
<div
data-testid="agent-context-settings-screen"
className="h-full relative"
>
<div className="flex flex-col gap-6">
<div className={formControlSwitchFieldClassName}>
<SettingsSwitch
testId="agent-context-enable-memory-context"
isToggled={isMemoryEnabled}
isDisabled={isPending}
onToggle={setMemoryOverride}
>
{t(I18nKey.SETTINGS$ENABLE_MEMORY_CONTEXT)}
</SettingsSwitch>
<Typography.Paragraph
className={cn(
formControlSwitchDescriptionClassName,
"text-xs leading-5 text-[var(--oh-muted)]",
)}
>
{t(I18nKey.SETTINGS$ENABLE_MEMORY_CONTEXT_HELPER)}
</Typography.Paragraph>
</div>
</div>

<div className="sticky bottom-0 bg-base py-4">
<BrandButton
testId="agent-context-save-button"
type="button"
variant="primary"
isDisabled={isPending || !isDirty}
onClick={handleSave}
>
{isPending
? t(I18nKey.SETTINGS$SAVING)
: t(I18nKey.SETTINGS$SAVE_CHANGES)}
</BrandButton>
</div>
</div>
);
}
8 changes: 7 additions & 1 deletion frontend/src/routes/agent-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -317,7 +323,7 @@ export default function AgentSettingsScreen() {
) : null}

{/* Agent Context: persistent memory toggle (OpenHands mode) */}
{!isAcp && (
{!isAcp && !hasAgentContextPage && (
<div className="border-t border-[var(--oh-border)] pt-6 mt-2">
<h3 className="text-lg font-medium mb-2">
{t(I18nKey.SETTINGS$AGENT_CONTEXT)}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/routes/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 22 additions & 0 deletions frontend/src/utils/settings-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ export const ADMIN_ONLY_SETTINGS_PATHS = new Set<string>([
"/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.
Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'),
)


Expand Down
11 changes: 11 additions & 0 deletions openhands/app_server/web_client/web_client_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Loading