Skip to content

fix(install): programmatically clean gga clone dir to avoid collision#961

Open
decode2 wants to merge 1 commit into
Gentleman-Programming:mainfrom
decode2:fix/issue-31-reinstall-temp-dir-collision
Open

fix(install): programmatically clean gga clone dir to avoid collision#961
decode2 wants to merge 1 commit into
Gentleman-Programming:mainfrom
decode2:fix/issue-31-reinstall-temp-dir-collision

Conversation

@decode2

@decode2 decode2 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the GGA agent installation collision issue where \git clone\ fails because the target temporary directory \gentleman-guardian-angel\ already exists and is not empty from a previous install attempt.

Problem

When reinstalling or upgrading, the installer clones GGA into the temporary directory \gentleman-guardian-angel. If a previous installation attempt left files in that directory, \git clone\ fails with exit code 128:
\
fatal: destination path 'C:\Users\user\AppData\Local\Temp\gentleman-guardian-angel' already exists and is not an empty directory.
\`n

Solution

Programmatically clean the destination directory before cloning by calling \os.RemoveAll()\ inside
esolveGGAInstall\ at resolution time. This ensures the target directory is completely gone before the clone starts, while maintaining compatibility with the existing shell cleanup commands asserted in the unit tests.

Closes #31

Summary by CodeRabbit

  • Bug Fixes
    • Improved install cleanup handling so temporary files and directories are removed more reliably before installation steps run.
    • Reduced redundant cleanup commands in the Linux package flow and added earlier cleanup for the Windows flow, helping avoid leftover install artifacts.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 40a5b9ee-667b-4fb3-8d0b-ddf42d01ba22

📥 Commits

Reviewing files that changed from the base of the PR and between 0e15d84 and 99010b8.

📒 Files selected for processing (1)
  • internal/installcmd/resolver.go

📝 Walkthrough

Walkthrough

resolveGGAInstall now performs Go-side cleanup of existing temporary directories before assembling install commands for the apt/pacman/dnf and winget paths.

Changes

Installer temp cleanup

Layer / File(s) Summary
Pre-cleanup before command sequence
internal/installcmd/resolver.go
resolveGGAInstall removes the temp directory in Go for the apt/pacman/dnf path and removes the winget clone destination before building the returned command sequence.

Sequence Diagram(s)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main fix: cleaning the GGA clone directory programmatically to avoid reinstall collisions.
Linked Issues check ✅ Passed The PR addresses the linked install collision by removing the existing clone directory before cloning; the backup-menu items are separate scope.
Out of Scope Changes check ✅ Passed No clear out-of-scope code changes are present; the edits stay focused on pre-cleaning install temp directories before cloning.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

Error reinstalling agent: existing temp directory causes git clone failure + backups menu select not working

1 participant