diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/__tests__/publish-bar.spec.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/__tests__/publish-bar.spec.tsx index a220f1f4c41..35a1e5c9ba4 100644 --- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/__tests__/publish-bar.spec.tsx +++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/__tests__/publish-bar.spec.tsx @@ -346,6 +346,20 @@ describe('AgentConfigurePublishBar', () => { ) }) + it('should show unpublished state for local edits when the active snapshot is not loaded', () => { + renderPublishBar({ + activeConfigIsPublished: true, + activeConfigSnapshot: null, + prompt: 'Updated system prompt', + }) + + expect(screen.getByText('agentV2.agentDetail.configure.publishBar.unpublishedChanges')).toBeInTheDocument() + expect(screen.getByRole('button', { name: /agentV2\.agentDetail\.configure\.publishBar\.publishUpdate/ })).toBeInTheDocument() + expect(hotkeyRegistrations.get('Mod+Shift+P')?.options).toEqual( + expect.objectContaining({ enabled: true, ignoreInputs: false }), + ) + }) + it('should initialize unpublished state when active config is not published', async () => { const { onPublish } = renderPublishBar({ activeConfigIsPublished: false, diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/index.tsx index ac214e8949c..1262b30ca95 100644 --- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/index.tsx +++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/index.tsx @@ -55,10 +55,13 @@ function getPublishState({ if (isPublishing) return 'publishing' + if (isDirty) + return 'unpublished' + if (!activeConfigSnapshot) return activeConfigIsPublished ? 'published' : 'draft' - if (!activeConfigIsPublished || isDirty) + if (!activeConfigIsPublished) return 'unpublished' return 'published'