Skip to content

fix(skills): make setup_skills idempotent and add keep_skills opt-out - #1872

Open
SparshM8 wants to merge 1 commit into
anthropics:mainfrom
SparshM8:fix/setup-skills-race-condition
Open

fix(skills): make setup_skills idempotent and add keep_skills opt-out#1872
SparshM8 wants to merge 1 commit into
anthropics:mainfrom
SparshM8:fix/setup-skills-race-condition

Conversation

@SparshM8

Copy link
Copy Markdown

Summary

This PR addresses the race condition and redundant downloads in setup_skills reported in issue #1871.

Changes

  1. Idempotent Downloads: Added a .version file check in _skills.py. If the resolved skill version already exists on disk, the download and extraction are skipped. This prevents concurrent sessions from wiping each other's skill directories when they share a workdir.
  2. keep_skills Option: Added a keep_skills: bool = False flag to AgentToolContext. When set to True, _cleanup_skills becomes a no-op, allowing for persistent worker-level skill caching.

Verification

Verified with a reproduction script that simulates concurrent sessions sharing a workdir. Without this fix, the second session would re-download and the first session's exit would delete the skills being used by the second. With this fix, the skills remain intact.

Fixes #1871

@SparshM8
SparshM8 requested a review from a team as a code owner August 22, 2026 11:24
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.

setup_skills re-downloads and rmtrees skills on every session, racing when workers share a workdir

1 participant