Skip to content

fix: add --force flag to uv cache clean to prevent deadlock#63

Merged
bkrabach merged 1 commit intomainfrom
fix/uv-cache-clean-force-flag
Jan 26, 2026
Merged

fix: add --force flag to uv cache clean to prevent deadlock#63
bkrabach merged 1 commit intomainfrom
fix/uv-cache-clean-force-flag

Conversation

@bkrabach
Copy link
Collaborator

Summary

  • Fix amplifier reset hanging indefinitely when cleaning UV cache
  • Add --force flag to uv cache clean command to bypass exclusive lock check
  • Add 60-second timeout as a safeguard against future hangs

Problem

The amplifier reset command was hanging indefinitely while cleaning the UV cache. The root cause:

  1. uv cache clean without --force waits for an exclusive lock on the cache directory
  2. Since amplifier itself runs as a uv-installed tool, the cache is always "in use" when running amplifier reset
  3. This creates an unresolvable deadlock - uv waits for the lock that can never be released

Solution

Per uv's documentation, the --force flag bypasses the in-use check. This is the intended solution for this scenario.

Additional safeguards added:

  • 60-second timeout to prevent any future indefinite hangs
  • Proper handling of subprocess.TimeoutExpired exception
  • Updated docstring explaining why --force is required

Test plan

  • Verified amplifier reset no longer hangs
  • Tested with --dry-run flag shows correct command
  • Confirmed cache is properly cleaned when running amplifier reset

🤖 Generated with Amplifier

The `amplifier reset` command was hanging indefinitely while cleaning
the UV cache because `uv cache clean` without `--force` waits for an
exclusive lock on the cache directory. Since amplifier itself runs as
a uv-installed tool, the cache is always "in use" when running
`amplifier reset`, causing an unresolvable deadlock.

Changes:
- Added `--force` flag to bypass the in-use check (per uv's docs)
- Added a 60-second timeout as a safeguard
- Added handling for `subprocess.TimeoutExpired` exception
- Updated docstring to explain why `--force` is required

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@bkrabach bkrabach merged commit c6e8752 into main Jan 26, 2026
@bkrabach bkrabach deleted the fix/uv-cache-clean-force-flag branch January 26, 2026 03:32
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.

1 participant

Comments