Skip to content

fix(tower-uv): use copy link mode when no cache dir is set#318

Merged
bradhe merged 2 commits into
developfrom
fix/uv-hardlink-copy-fallback
Jul 6, 2026
Merged

fix(tower-uv): use copy link mode when no cache dir is set#318
bradhe merged 2 commits into
developfrom
fix/uv-hardlink-copy-fallback

Conversation

@bradhe

@bradhe bradhe commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

When a Python app is set up, uv occasionally prints this warning into the setup logs:

warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
         If the cache and target directories are on different filesystems, hardlinking may not be supported.
         If this is intentional, set \`export UV_LINK_MODE=copy\` or use \`--link-mode=copy\` to suppress this warning.

Root cause

When tower_uv::Uv is constructed without an explicit cache dir, uv uses its default cache (~/.cache/uv). In sandboxed execution the default cache and the target virtualenv frequently live on different filesystems, so uv can't hardlink across them and falls back to copying, emitting the warning. It looks intermittent because it only surfaces on runs whose app actually has dependencies to materialize into the venv.

The copy fallback was already happening; the warning is just noise.

When no explicit cache dir is configured, uv uses its default cache
(~/.cache/uv). In containerized or sandboxed execution that default
often lives on a different filesystem than the target venv, so uv can't
hardlink across the two (EXDEV) and prints a noisy "Failed to hardlink
files; falling back to full copy" warning into the setup logs.

Force UV_LINK_MODE=copy on the sync/pip/run commands in that case so the
warning is suppressed (uv was already falling back to copy anyway).
Callers that pass an explicit cache dir on the same filesystem as the
venv are unaffected and keep fast hardlink/clone.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7febae3c-1628-4cd7-ae81-b84ffce1b08a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/uv-hardlink-copy-fallback

Comment @coderabbitai help to get the list of available commands.

@bradhe bradhe merged commit f4777a6 into develop Jul 6, 2026
28 checks passed
@bradhe bradhe deleted the fix/uv-hardlink-copy-fallback branch July 6, 2026 11:50
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.

2 participants