Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(studio): restore saved setup and fix connection branding (#6148)

yufeng594f5f25d3e4
diff --git a/web-studio/src/components/account-switcher.hosted.test.tsx b/web-studio/src/components/account-switcher.hosted.test.tsx
index ec64e6003..8ce9a7e78 100644
--- a/web-studio/src/components/account-switcher.hosted.test.tsx
+++ b/web-studio/src/components/account-switcher.hosted.test.tsx
@@ -250,7 +250,7 @@ it('lists saved open-source connections beside hosted connections without mergin
screen
.getByRole('button', { name: /Open-source shared URL/ })
.querySelector('[role="img"][aria-label="provider.opensource"]'),
- ).toBeTruthy()
+ ).toBeNull()
expect(
screen.getByRole('button', { name: /Development server/ }),
).toBeTruthy()
diff --git a/web-studio/src/components/account-switcher.tsx b/web-studio/src/components/account-switcher.tsx
index dec80c227..272d614b3 100644
--- a/web-studio/src/components/account-switcher.tsx
+++ b/web-studio/src/components/account-switcher.tsx
@@ -5,7 +5,6 @@ import {
Building2Icon,
CheckIcon,
ChevronDownIcon,
- CodeXmlIcon,
LoaderCircleIcon,
PlusIcon,
SearchIcon,
@@ -73,9 +72,9 @@ function currentRuntimeIdentity(): string {
])
}
-function ServiceIcon({ hosted }: { hosted: boolean }) {
+function HostedServiceIcon() {
const { t } = useTranslation('accountSwitcher')
- const label = t(`provider.${hosted ? 'hosted' : 'opensource'}`)
+ const label = t('provider.hosted')
return (
<span
title={label}
@@ -83,46 +82,42 @@ function ServiceIcon({ hosted }: { hosted: boolean }) {
aria-label={label}
className="inline-flex size-4 shrink-0 items-center justify-center text-sidebar-foreground/70"
>
- {hosted ? (
- <svg
- viewBox="0 0 24 24"
- className="size-3.5 opacity-60"
- aria-hidden="true"
- >
- <g transform="translate(0.349 12.857)">
- <path
- d="M0 9.1584H6.34404L3.4718 0.221463C3.41951 0.0533704 3.23825 -0.0376799 3.07094 0.0148491C2.97333 0.0463665 2.89665 0.123409 2.86528 0.221463L0 9.1584Z"
- fill="#00DCFF"
- />
- </g>
- <g transform="translate(15.771 11.277)">
- <path
- d="M0 10.7483H7.36188L3.9842 0.221463C3.93191 0.0533704 3.75065 -0.03768 3.58334 0.0148491C3.48574 0.0463665 3.40905 0.123409 3.37768 0.221463L0 10.7483Z"
- fill="#00DCFF"
- />
- </g>
- <g transform="translate(7.012 1.716)">
- <path
- d="M0 20.3102H13.5804L7.09348 0.219641C7.03771 0.0515485 6.85993 -0.0395018 6.69262 0.0165291C6.59502 0.0480465 6.51833 0.125089 6.48696 0.219641L0 20.3102Z"
- fill="#006AFF"
- />
- </g>
- <g transform="translate(2.882 6.815)">
- <path
- d="M0.00348549 15.2114H10.2829L5.44472 0.219641C5.38895 0.0515482 5.21118 -0.0395018 5.04386 0.0165292C4.94626 0.0480466 4.86958 0.125089 4.83821 0.219641L0 15.2114H0.00348549Z"
- fill="#006AFF"
- />
- </g>
- <g transform="translate(5.736 9.355)">
- <path
- d="M0 12.6725H8.69343L4.64998 0.219641C4.5942 0.0515485 4.41643 -0.0395018 4.24912 0.0165291C4.15152 0.0480465 4.07832 0.125089 4.04694 0.219641L0.00348582 12.6725H0Z"
- fill="#00DCFF"
- />
- </g>
- </svg>
- ) : (
- <CodeXmlIcon className="size-4" strokeWidth={1.8} aria-hidden="true" />
- )}
+ <svg
+ viewBox="0 0 24 24"
+ className="size-3.5 opacity-60"
+ aria-hidden="true"
+ >
+ <g transform="translate(0.349 12.857)">
+ <path
+ d="M0 9.1584H6.34404L3.4718 0.221463C3.41951 0.0533704 3.23825 -0.0376799 3.07094 0.0148491C2.97333 0.0463665 2.89665 0.123409 2.86528 0.221463L0 9.1584Z"
+ fill="#00DCFF"
+ />
+ </g>
+ <g transform="translate(15.771 11.277)">
+ <path
+ d="M0 10.7483H7.36188L3.9842 0.221463C3.93191 0.0533704 3.75065 -0.03768 3.58334 0.0148491C3.48574 0.0463665 3.40905 0.123409 3.37768 0.221463L0 10.7483Z"
+ fill="#00DCFF"
+ />
+ </g>
+ <g transform="translate(7.012 1.716)">
+ <path
+ d="M0 20.3102H13.5804L7.09348 0.219641C7.03771 0.0515485 6.85993 -0.0395018 6.69262 0.0165291C6.59502 0.0480465 6.51833 0.125089 6.48696 0.219641L0 20.3102Z"
+ fill="#006AFF"
+ />
+ </g>
+ <g transform="translate(2.882 6.815)">
+ <path
+ d="M0.00348549 15.2114H10.2829L5.44472 0.219641C5.38895 0.0515482 5.21118 -0.0395018 5.04386 0.0165292C4.94626 0.0480466 4.86958 0.125089 4.83821 0.219641L0 15.2114H0.00348549Z"
+ fill="#006AFF"
+ />
+ </g>
+ <g transform="translate(5.736 9.355)">
+ <path
+ d="M0 12.6725H8.69343L4.64998 0.219641C4.5942 0.0515485 4.41643 -0.0395018 4.24912 0.0165291C4.15152 0.0480465 4.07832 0.125089 4.04694 0.219641L0.00348582 12.6725H0Z"
+ fill="#00DCFF"
+ />
+ </g>
+ </svg>
</span>
)
}
@@ -414,11 +409,9 @@ export function AccountSwitcher() {
<span className="min-w-0 truncate text-sm font-medium">
{profile.name}
</span>
- <ServiceIcon
- hosted={
- profile.connection.serviceSelection === 'volcengine'
- }
- />
+ {profile.connection.serviceSelection === 'volcengine' ? (
+ <HostedServiceIcon />
+ ) : null}
{showProfileId ? (
<span
className="shrink-0 font-mono text-[10px] text-muted-foreground"
@@ -475,9 +468,7 @@ export function AccountSwitcher() {
connection.accountId ||
t('hosted.currentWorkspace')}
</span>
- {provider !== 'unknown' ? (
- <ServiceIcon hosted={provider === 'volcengine'} />
- ) : null}
+ {provider === 'volcengine' ? <HostedServiceIcon /> : null}
</span>
<ChevronDownIcon className="size-4 shrink-0 text-muted-foreground group-data-[collapsible=icon]:hidden" />
</PopoverTrigger>
@@ -507,7 +498,6 @@ export function AccountSwitcher() {
<span className="min-w-0 truncate text-sm font-semibold">
{accountLabel}
</span>
- {provider === 'opensource' ? <ServiceIcon hosted={false} /> : null}
</span>
<ChevronDownIcon className="size-4 shrink-0 text-muted-foreground group-data-[collapsible=icon]:hidden" />
</PopoverTrigger>
@@ -579,7 +569,6 @@ export function AccountSwitcher() {
<span className="min-w-0 truncate text-sm font-medium">
{account.accountId}
</span>
- <ServiceIcon hosted={false} />
</span>
<span className="block text-xs text-muted-foreground">
{t('memberCount', { count: account.userCount })}
diff --git a/web-studio/src/components/app-shell.tsx b/web-studio/src/components/app-shell.tsx
index e4e7e3836..31528aa99 100644
--- a/web-studio/src/components/app-shell.tsx
+++ b/web-studio/src/components/app-shell.tsx
@@ -17,7 +17,6 @@ import {
BookOpenIcon,
BracesIcon,
BrainIcon,
- ChevronLeftIcon,
ChevronRightIcon,
ListChecksIcon,
HistoryIcon,
@@ -517,20 +516,6 @@ function AppShellInner({ children }: { children: React.ReactNode }) {
<Sidebar variant="sidebar" collapsible="icon">
<SidebarHeader className="h-12 border-b border-sidebar-border/70 px-2 py-0">
<div className="flex h-full items-center gap-1 group-data-[collapsible=icon]:justify-center">
- {!isGatewayHost ? (
- <Link
- to="/config"
- aria-label={t('header.backToConfig', { ns: 'appShell' })}
- title={t('header.backToConfig', { ns: 'appShell' })}
- className="flex size-7 shrink-0 items-center justify-center text-sidebar-foreground/45 transition-colors hover:text-sidebar-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring group-data-[collapsible=icon]:hidden"
- >
- <ChevronLeftIcon
- className="size-3.5"
- strokeWidth={1.75}
- aria-hidden="true"
- />
- </Link>
- ) : null}
<div className="min-w-0 flex-1 group-data-[collapsible=icon]:hidden">
<AccountSwitcher />
</div>
diff --git a/web-studio/src/components/studio-setup.test.tsx b/web-studio/src/components/studio-setup.test.tsx
index a3088f4b0..ef21995ff 100644
--- a/web-studio/src/components/studio-setup.test.tsx
+++ b/web-studio/src/components/studio-setup.test.tsx
@@ -36,7 +36,10 @@ vi.mock('#/lib/connection/onboarding', async (original) => ({
verifyStudioSetup: mocks.verify,
completeStudioSetup: mocks.complete,
}))
-afterEach(cleanup)
+afterEach(() => {
+ cleanup()
+ vi.unstubAllEnvs()
+})
beforeEach(() => {
vi.clearAllMocks()
localStorage.clear()
@@ -525,3 +528,11 @@ it('keeps each workspace draft isolated when switching on the first step', () =>
fireEvent.click(screen.getByRole('button', { name: 'next' }))
expect(key().value).toBe('synthetic-cloud')
})
+
+it('loads the logo from the deployment base path', () => {
+ vi.stubEnv('BASE_URL', '/studio/')
+ const { container } = render(<StudioSetup onComplete={vi.fn()} />)
+ expect(container.querySelector('img')?.getAttribute('src')).toBe(
+ '/studio/ov-logo.png',
+ )
+})
diff --git a/web-studio/src/components/studio-setup.tsx b/web-studio/src/components/studio-setup.tsx
index 74b648116..9fd9cd901 100644
--- a/web-studio/src/components/studio-setup.tsx
+++ b/web-studio/src/components/studio-setup.tsx
@@ -379,7 +379,11 @@ export function StudioSetup({
<main className="flex h-svh flex-col items-center overflow-y-auto bg-background px-5 py-6 text-foreground sm:px-8 sm:py-8 lg:pt-[max(2rem,calc((100svh-52rem)/2))]">
<div className="w-full max-w-5xl shrink-0">
<div className="mb-6 flex items-center gap-3 lg:mb-8">
- <img src="/ov-logo.png" alt="" className="size-10 rounded-xl" />
+ <img
+ src={`${import.meta.env.BASE_URL}ov-logo.png`}
+ alt=""
+ className="size-10 rounded-xl"
+ />
<span className="text-base font-semibold tracking-tight">
{t('brand')}
</span>
diff --git a/web-studio/src/lib/connection/onboarding.test.ts b/web-studio/src/lib/connection/onboarding.test.ts
index 047433c6a..fd8da47c3 100644
--- a/web-studio/src/lib/connection/onboarding.test.ts
+++ b/web-studio/src/lib/connection/onboarding.test.ts
@@ -52,15 +52,20 @@ describe('first-use detection', () => {
)
expect(needsStudioSetup()).toBe(true)
})
- it('shows workspace choice even when a profile or legacy connection exists', () => {
+ it('restores a legacy connection even after the upgrade marked setup pending', () => {
+ localStorage.setItem(SETUP_STORAGE_KEY, 'pending')
localStorage.setItem('ov_console_connection', JSON.stringify(draft))
- expect(needsStudioSetup()).toBe(true)
- localStorage.clear()
+ expect(needsStudioSetup()).toBe(false)
+ })
+ it('restores saved profiles in a new tab without a session marker', () => {
localStorage.setItem(
PROFILES_STORAGE_KEY,
- JSON.stringify({ profiles: [{ connection: draft }] }),
+ JSON.stringify({
+ activeId: 'saved',
+ profiles: [{ id: 'saved', name: 'Saved', connection: draft }],
+ }),
)
- expect(needsStudioSetup()).toBe(true)
+ expect(needsStudioSetup()).toBe(false)
})
it('does not treat an automatically persisted empty same-origin connection as configured', () => {
localStorage.setItem(
@@ -76,9 +81,11 @@ describe('first-use detection', () => {
)
expect(needsStudioSetup()).toBe(false)
expect(sessionStorage.getItem(WORKSPACE_SESSION_KEY)).toBe('selected')
+ sessionStorage.clear()
+ expect(needsStudioSetup()).toBe(false)
localStorage.removeItem(PROFILES_STORAGE_KEY)
+ expect(needsStudioSetup()).toBe(false)
localStorage.removeItem('ov_console_connection')
- sessionStorage.removeItem(WORKSPACE_SESSION_KEY)
expect(needsStudioSetup()).toBe(true)
})
it('completes setup when randomUUID is unavailable on an HTTP origin', () => {
diff --git a/web-studio/src/lib/connection/onboarding.ts b/web-studio/src/lib/connection/onboarding.ts
index 38fc1a4b9..702b39613 100644
--- a/web-studio/src/lib/connection/onboarding.ts
+++ b/web-studio/src/lib/connection/onboarding.ts
@@ -66,7 +66,12 @@ function hasConnection(value: unknown, completed = false): boolean {
export function needsStudioSetup(): boolean {
try {
- return sessionStorage.getItem(WORKSPACE_SESSION_KEY) !== 'selected'
+ // A new tab must reuse an existing connection, including pre-onboarding
+ // installations. The session marker alone only survives a tab reload.
+ return (
+ sessionStorage.getItem(WORKSPACE_SESSION_KEY) !== 'selected' &&
+ savedSetupConnections().length === 0
+ )
} catch {
return true
}
@@ -103,7 +108,12 @@ export function savedSetupConnections(): Array<{
const legacy: unknown = JSON.parse(
localStorage.getItem('ov_console_connection') || 'null',
)
- if (hasConnection(legacy))
+ if (
+ hasConnection(
+ legacy,
+ localStorage.getItem(SETUP_STORAGE_KEY) === 'complete',
+ )
+ )
return [
{
id: 'default',
diff --git a/web-studio/src/routes/settings/-components/connection-profiles.tsx b/web-studio/src/routes/settings/-components/connection-profiles.tsx
index ac92ad6b5..fc221d5fd 100644
--- a/web-studio/src/routes/settings/-components/connection-profiles.tsx
+++ b/web-studio/src/routes/settings/-components/connection-profiles.tsx
@@ -114,7 +114,12 @@ export function ConnectionProfilesList() {
{t(`providers.${profile.connection.serviceSelection}`)}
</Badge>
{profile.id === activeProfileId && (
- <Badge>{t('profiles.active')}</Badge>
+ <Badge
+ variant="outline"
+ className="border-emerald-600/20 bg-emerald-600/10 text-emerald-700 dark:border-emerald-400/25 dark:bg-emerald-400/10 dark:text-emerald-400"
+ >
+ {t('profiles.active')}
+ </Badge>
)}
</div>
<p className="mt-1 break-all text-sm text-muted-foreground">
@@ -187,7 +192,14 @@ export function ConnectionProfilesList() {
</Badge>
{group.some(
(profile) => profile.id === activeProfileId,
- ) && <Badge>{t('profiles.active')}</Badge>}
+ ) && (
+ <Badge
+ variant="outline"
+ className="border-emerald-600/20 bg-emerald-600/10 text-emerald-700 dark:border-emerald-400/25 dark:bg-emerald-400/10 dark:text-emerald-400"
+ >
+ {t('profiles.active')}
+ </Badge>
+ )}
<span className="text-xs text-muted-foreground">
{t('profiles.title')} · {group.length}
</span>