Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Fix 'text file busy' error during CLI updates#254

Merged
jhaynie merged 4 commits intomainfrom
devin/1746025551-fix-cli-upgrade
Apr 30, 2025
Merged

Fix 'text file busy' error during CLI updates#254
jhaynie merged 4 commits intomainfrom
devin/1746025551-fix-cli-upgrade

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Description

Fixes the issue where the CLI fails to update with a 'text file busy' error when the binary is currently running.

Solution

  • Enhanced the checkWritePermission function to detect when the binary is running
  • Added a new updateRunningBinary function that uses file renaming instead of direct overwrites
  • Modified the replaceBinary function to use the new update mechanism when the binary is running

Fixes the error reported in the alerts channel: insufficient permissions to update binary: open /home/copydataai/.local/bin/agentuity: text file busy

Link to Devin run

https://app.devin.ai/sessions/5c38ea5ff3c44fa58a280c1120a3b45a

Requested by

jhaynie@agentuity.com

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
@devin-ai-integration devin-ai-integration Bot requested a review from jhaynie April 30, 2025 15:08
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
Comment thread internal/util/upgrade.go Outdated
return fmt.Errorf("failed to set permissions on new binary: %w", err)
}

script := fmt.Sprintf(`#!/bin/sh
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i think this will only work on non-windows systems? can this method ever be called from windows?

Comment thread internal/util/upgrade.go Outdated
rm "%s"
`, currentExe, oldBinary, tmpBinary, currentExe, oldBinary)

updateScript := filepath.Join(dir, ".agentuity_updater.sh")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does this script get deleted? should we check for it later on startup and delete it? how can we handle it?

devin-ai-integration Bot and others added 2 commits April 30, 2025 16:15
…cleanup

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
@jhaynie jhaynie merged commit a59fd53 into main Apr 30, 2025
12 checks passed
@jhaynie jhaynie deleted the devin/1746025551-fix-cli-upgrade branch April 30, 2025 17:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant