Skip to content

fix(skills): allow tenant admins to delete tenant skill folders#195

Open
Atlas-SZ wants to merge 1 commit intodataelement:mainfrom
Atlas-SZ:fix/skills-delete-180
Open

fix(skills): allow tenant admins to delete tenant skill folders#195
Atlas-SZ wants to merge 1 commit intodataelement:mainfrom
Atlas-SZ:fix/skills-delete-180

Conversation

@Atlas-SZ
Copy link
Contributor

@Atlas-SZ Atlas-SZ commented Mar 25, 2026

Summary

  • allow org_admin to manage tenant-scoped custom skills from enterprise settings
  • keep builtin and cross-tenant skills read-only for tenant admins
  • avoid the lazy-load path in browse/write when creating a new skill folder
  • show delete actions for directory entries in the shared FileBrowser, so agent skill folders expose the backend delete capability

Fixes #180
Fixes #169

Changed Files

  • backend/app/api/skills.py
  • backend/tests/test_skills_api.py
  • frontend/src/components/FileBrowser.tsx

Simplifications

  • reused the existing get_current_admin role boundary instead of introducing new auth helpers
  • centralized tenant scoping and write-access checks inside the skills API
  • fixed the missing delete affordance in the shared file browser with a one-line UI change instead of adding skill-specific UI logic

Verification

  • cd backend && .venv/bin/python -m pytest tests/test_skills_api.py -q
  • cd backend && .venv/bin/python -m ruff check app/api/skills.py tests/test_skills_api.py
  • cd frontend && npm run build
  • manual API verification as orgadmin: PUT /api/skills/browse/write, DELETE /api/skills/browse/delete, and DELETE /api/skills/{id} all returned 200
  • manual browser verification: skill folders now show the delete button in the agent Skills tab

Remaining Risks

  • tenant admins still cannot edit or delete builtin skills; this is intentional in this patch, but if product expectation differs it will need a separate decision
  • verification covered focused backend regression tests and local UI/manual checks, not a full end-to-end automated browser flow across all roles

…ctions

Issue dataelement#180 mixed two failures: enterprise skill management was still platform-admin only, and the shared FileBrowser hid delete actions for directories, which made agent skill folders look undeletable even when the backend delete path worked.

This change scopes skill CRUD and browse writes/deletes to the current tenant for org admins, keeps builtin and cross-tenant skills read-only for them, and avoids iterating lazy files on freshly created skills. The FileBrowser now shows delete actions for directories so skill folders expose the same operation the backend already supports.

Constraint: org_admin access must stay tenant-bounded and must not allow editing builtin platform skills
Rejected: Grant org_admin full platform_admin-equivalent skill access | would let tenant admins modify builtin or other-tenant skills
Rejected: Fix only backend permissions | leaves skill folders with no visible delete affordance in the agent UI
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep skill write/delete rules aligned between direct CRUD and browse endpoints; changing one without the other will reintroduce inconsistent UI behavior
Tested: backend/.venv/bin/python -m pytest backend/tests/test_skills_api.py -q; backend/.venv/bin/python -m ruff check backend/app/api/skills.py backend/tests/test_skills_api.py; cd frontend && npm run build; manual API verification for orgadmin browse-write/browse-delete/direct-delete
Not-tested: full end-to-end browser deletion flow after page reload under every role combination
@yaojin3616
Copy link
Collaborator

@wisdomqin 属于功能层面的pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skills 无法删除 技能管理中新建文件夹报错

2 participants