From c8e6ff3ebfb9eb8c4de2b20c3cb1ecbef1eb6403 Mon Sep 17 00:00:00 2001 From: yyh Date: Wed, 1 Jul 2026 18:57:55 +0800 Subject: [PATCH] fix(agent-v2): show build draft env changes --- .../components/orchestrate/advanced/index.tsx | 1 + .../orchestrate/build-draft-changes-context.ts | 2 ++ .../common/__tests__/section.spec.tsx | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/index.tsx index 7f71c52fd6c..a6d2a14cccc 100644 --- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/index.tsx +++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/index.tsx @@ -17,6 +17,7 @@ export function AgentAdvancedSettings() { panelId={advancedSettingsPanelId} description={t('agentDetail.configure.advancedSettings.description')} defaultOpen={false} + buildDraftChangeSection="advancedSettings" rootClassName="gap-2 pt-1 pb-3" headerClassName="mb-0 pt-2" titleRowClassName="min-h-6" diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-changes-context.ts b/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-changes-context.ts index 3ba01f16da1..111952903cd 100644 --- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-changes-context.ts +++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-changes-context.ts @@ -9,10 +9,12 @@ export type AgentBuildDraftChangedKey = keyof AgentSoulConfigFormState export type AgentBuildDraftChangeSection = | 'skills' | 'files' + | 'advancedSettings' const changedKeysBySection: Record = { skills: ['skills'], files: ['files'], + advancedSettings: ['envVariables'], } const AgentBuildDraftChangedKeysContext = createContext>(new Set()) diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/__tests__/section.spec.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/__tests__/section.spec.tsx index fabcecab16f..0052bab0b05 100644 --- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/__tests__/section.spec.tsx +++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/__tests__/section.spec.tsx @@ -7,13 +7,19 @@ function renderSection({ section = 'skills', changedKeys, }: { - section?: 'skills' | 'files' + section?: 'skills' | 'files' | 'advancedSettings' changedKeys: AgentBuildDraftChangedKey[] }) { + const label = { + advancedSettings: 'Advanced Settings', + files: 'Files', + skills: 'Skills', + }[section] + return render( @@ -36,6 +42,12 @@ describe('ConfigureSection', () => { expect(screen.getByRole('heading', { name: 'Files' }).querySelector('.bg-text-warning-secondary')).toBeInTheDocument() }) + it('should show a build draft change dot when Advanced Settings changed', () => { + renderSection({ section: 'advancedSettings', changedKeys: ['envVariables'] }) + + expect(screen.getByRole('heading', { name: 'Advanced Settings' }).querySelector('.bg-text-warning-secondary')).toBeInTheDocument() + }) + it('should not show a build draft change dot when only another key changed', () => { renderSection({ section: 'skills', changedKeys: ['prompt'] })