Skip to content

Skill draft update leaves deleted resource files in storage #15705

Description

@saynoword

Describe the bug

Updating an existing Skill draft with a reduced resource-file set updates the version storage descriptor but does not delete the omitted files from the configured AI storage provider. The omitted files become unreferenced storage objects and cannot be cleaned by later draft or Skill deletion.

Expected behavior

A Skill draft update is a full-content replacement. After the update succeeds, files that were referenced by the previous storage descriptor but are absent from the new Skill content should be deleted through the provider persisted for that version.

Actually behavior

SkillOperationServiceImpl.updateDraft calls writeSkillToStorage for the new content and replaces the version storage descriptor with the returned file list. writeSkillToStorage only saves files present in the request. It does not compare the old and new file lists or delete removed files.

The removed files disappear from Skill query/download results because the new descriptor no longer references them, but their backing storage entries remain. Later deletion reads only the new descriptor, so those entries remain orphaned.

How to Reproduce

  1. Create a Skill draft containing SKILL.md and multiple resource files.
  2. Update the same draft while omitting one or more existing resource files.
  3. Query or download the draft and confirm that the omitted files are no longer returned.
  4. Inspect the configured AI storage provider and observe that the omitted file entries still exist.
  5. Delete the draft or Skill and observe that the orphaned entries are not cleaned because they are absent from the current storage descriptor.

Desktop (please complete the following information):

  • OS: All
  • Version: current develop
  • Module: ai
  • SDK: original

Additional context

The fix should preserve the version's persisted storage provider, compare the previous and replacement descriptors, and delete only the removed file keys. The Skill specification should also clarify that draft overwrite/update replaces the complete package content and removes omitted resource files from storage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions