diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/__tests__/index.spec.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/__tests__/index.spec.tsx
index 3629a8b1fc3..2c35ec80525 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/__tests__/index.spec.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/__tests__/index.spec.tsx
@@ -1399,7 +1399,28 @@ describe('AgentSkills', () => {
)
})
- it('should disable add and remove actions when viewing a version', () => {
+ it('should disable add and remove actions when viewing a version', async () => {
+ const user = userEvent.setup()
+ mocks.agentSkillBindingsQueryOptions.mockImplementation((options) => {
+ const { input } = options as { input: { params: { agent_id: string } } }
+
+ return {
+ queryKey: ['workspace-agent-skills', input],
+ queryFn: async () => ({
+ agent_id: input.params.agent_id,
+ skill_ids: ['workspace-skill-1'],
+ data: [
+ {
+ ...createWorkspaceSkill(),
+ priority: 0,
+ status: 'published',
+ file_count: 1,
+ latest_published_at: 1,
+ },
+ ],
+ }),
+ }
+ })
const { container } = renderAgentSkills({
apiContext: {
agentId: 'agent-1',
@@ -1414,6 +1435,20 @@ describe('AgentSkills', () => {
screen.queryByRole('button', { name: /agentV2\.agentDetail\.configure\.skills\.add/i }),
).not.toBeInTheDocument()
expect(container.querySelector('[data-agent-skill-remove-button]')).toBeNull()
+
+ await user.click(
+ await screen.findByRole('button', {
+ name: 'agentV2.agentDetail.configure.skills.moreActions:{"name":"Refund approval"}',
+ }),
+ )
+
+ expect(
+ screen.getByText('agentV2.agentDetail.configure.skills.openInLibrary'),
+ ).toBeInTheDocument()
+ expect(
+ screen.queryByText('agentV2.agentDetail.configure.skills.removeAction'),
+ ).not.toBeInTheDocument()
+ expect(mocks.replaceAgentSkillBindingsMutationFn).not.toHaveBeenCalled()
})
it('should keep the add menu available for build draft skills', async () => {
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/index.tsx
index 4d5dacd7440..9b1bc9455d9 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/index.tsx
@@ -304,9 +304,11 @@ function WorkspaceSkillSelector({
}
function WorkspaceAgentSkillItem({
+ canRemove,
skill,
onRemove,
}: {
+ canRemove: boolean
skill: AgentSkillBindingItemResponse
onRemove: (skillId: string) => void
}) {
@@ -359,14 +361,16 @@ function WorkspaceAgentSkillItem({
{t(($) => $['agentDetail.configure.skills.openInLibrary'])}
- onRemove(skill.id)}
- >
-
- {t(($) => $['agentDetail.configure.skills.removeAction'])}
-
+ {canRemove && (
+ onRemove(skill.id)}
+ >
+
+ {t(($) => $['agentDetail.configure.skills.removeAction'])}
+
+ )}
@@ -426,6 +430,8 @@ export function AgentSkills() {
const replaceWorkspaceSkillBindings = useCallback(
(skillIds: string[], onSuccess?: () => void) => {
+ if (isViewingVersion) return
+
replaceAgentSkillBindings(
{
params: {
@@ -446,7 +452,13 @@ export function AgentSkills() {
},
)
},
- [apiContext.agentId, invalidateAgentSkillBindings, replaceAgentSkillBindings, t],
+ [
+ apiContext.agentId,
+ invalidateAgentSkillBindings,
+ isViewingVersion,
+ replaceAgentSkillBindings,
+ t,
+ ],
)
const handleOpenUpload = useCallback((options?: AgentOrchestrateAddActionOptions) => {
@@ -634,6 +646,7 @@ export function AgentSkills() {
{workspaceSkills.map((skill) => (