Skip to content

fix: use ~/.git-ai/tmp/ for install script instead of /tmp#644

Open
txf0096 wants to merge 1 commit intogit-ai-project:mainfrom
txf0096:fix/upgrade-use-home-tmp-dir
Open

fix: use ~/.git-ai/tmp/ for install script instead of /tmp#644
txf0096 wants to merge 1 commit intogit-ai-project:mainfrom
txf0096:fix/upgrade-use-home-tmp-dir

Conversation

@txf0096
Copy link
Contributor

@txf0096 txf0096 commented Mar 6, 2026

Problem

The background auto-upgrade silently fails on systems where /tmp is mounted with noexec or has restricted write permissions (common in corporate/hardened environments).

In run_install_script (Unix path), the install script is written to std::env::temp_dir() (typically /tmp) before execution. If File::create fails, the background process exits with code 1 — but since stdout/stderr are suppressed in the background worker, the user sees nothing and stays on the old version indefinitely.

Closes #643

Fix

Use ~/.git-ai/tmp/ (via config::git_ai_dir_path()) as the temp dir for the install script. git-ai already has guaranteed write access to this directory (it stores config, internal state, etc. there). The directory is created if it doesn't exist. Falls back to std::env::temp_dir() if the home path is unavailable.

Changes

  • src/commands/upgrade.rs: replace std::env::temp_dir() with ~/.git-ai/tmp/ for the Unix install script temp path

Open with Devin

/tmp may be mounted noexec or have restricted write permissions on some
systems, causing the background auto-upgrade to silently fail when
writing the temporary install script.

Use ~/.git-ai/tmp/ which git-ai already has guaranteed write access to.
Fall back to std::env::temp_dir() if the home-based path is unavailable.

Fixes git-ai-project#643
@git-ai-cloud-dev
Copy link

No AI authorship found for these commits. Please install git-ai to start tracking AI generated code in your commits.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@svarlamov
Copy link
Member

Thank you for the contribution! Will make sure to test throughly soon and excited to merge this

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.

Auto-upgrade silently fails when /tmp is noexec or permission-restricted

2 participants