Skip to content

fix: re-run setup.sh when deployed agent VERSION mismatches repo#358

Merged
marcusquinn merged 1 commit intomainfrom
bugfix/update-always-deploy-agents
Feb 6, 2026
Merged

fix: re-run setup.sh when deployed agent VERSION mismatches repo#358
marcusquinn merged 1 commit intomainfrom
bugfix/update-always-deploy-agents

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 6, 2026

Summary

  • Fixes aidevops update skipping agent deployment when the git repo is already at the latest commit
  • When repo is current but ~/.aidevops/agents/VERSION doesn't match, re-runs setup.sh to sync

Root Cause

cmd_update only ran setup.sh when new commits were pulled. If the repo was already up-to-date (e.g., previous setup.sh was interrupted, failed, or the repo was updated manually), the deployed agents remained stale with no way to fix them short of running ./setup.sh manually.

Changes

  • aidevops.sh: Added VERSION mismatch check in the "already up to date" branch of cmd_update
  • Compares $INSTALL_DIR/VERSION against ~/.aidevops/agents/VERSION
  • Re-runs setup.sh only when they differ (no unnecessary re-deploys)

Testing

  • ShellCheck: zero violations
  • Bash syntax check: OK
  • Manually verified the fix resolves the original issue (agents were at 2.100.20, repo at 2.101.0)

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced the update process to detect version mismatches between the repository and deployed agents.
    • When versions diverge, the system automatically re-synchronizes agents and displays a warning to inform users.
    • This ensures consistency between local and deployed components even when the repository is already current.

When 'aidevops update' finds the repo already at the latest commit, it
skips setup.sh entirely. This leaves deployed agents stale if a previous
setup.sh run was interrupted or failed. Now checks VERSION file in
~/.aidevops/agents/ against the repo and re-runs setup when they differ.
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue in the aidevops update command where agents might not be properly updated if the local repository was already current. The change introduces a robust version comparison mechanism, ensuring that the deployed agents always reflect the latest state of the repository, thereby preventing inconsistencies and improving the reliability of the update process.

Highlights

  • Agent Deployment Fix: Resolves an issue where aidevops update would skip agent deployment even if the repository was already at the latest commit, potentially leaving deployed agents in a stale state.
  • Version Mismatch Check: Introduces a check within the cmd_update function to compare the VERSION file in the repository with the VERSION of the deployed agents. If they differ, setup.sh is automatically re-run.
  • Proactive Synchronization: Ensures that deployed agents are always synchronized with the repository's version, even if a previous setup.sh run was interrupted or failed, or if the repository was manually updated.
Changelog
  • aidevops.sh
    • Added logic within the cmd_update function to check if the local git repository is up-to-date.
    • Implemented a version comparison between $INSTALL_DIR/VERSION (repository version) and ~/.aidevops/agents/VERSION (deployed agent version).
    • If a version mismatch is detected while the repository is current, bash "$INSTALL_DIR/setup.sh" is executed to re-sync the agents.
Activity
  • The author, marcusquinn, created this pull request to fix an issue where aidevops update was not re-running setup.sh when the repo was already up-to-date but agents were stale.
  • The proposed solution involves adding a version check in aidevops.sh to ensure deployed agents match the repository version.
  • Testing included ShellCheck, Bash syntax check, and manual verification of the fix.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Walkthrough

The change adds conditional re-synchronization logic to cmd_update in aidevops.sh. When the repository is already current, the code now compares the repo version with deployed agents version and re-runs setup if they differ, ensuring agent consistency.

Changes

Cohort / File(s) Summary
Version Sync Logic
aidevops.sh
Added version comparison between INSTALL_DIR/VERSION and $HOME/.aidevops/agents/VERSION in cmd_update. When repository is up-to-date but versions differ, prints warning and re-runs setup.sh to synchronize deployed agents.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #248: Modifies version-check behavior to read deployed agents' VERSION from ~/.aidevops path—directly related to version comparison logic added in this PR.
  • PR #146: Fixes and adds validation in setup.sh's deploy_aidevops_agents—directly related since this PR's re-run of setup.sh will interact with those deployment changes.
  • PR #85: Adds pre-command version mismatch warning—complementary approach to version detection, both addressing CLI vs agents consistency.

Poem

🔄 Versions now speak in perfect harmony,
When repo and agents drift apart with glee,
A gentle nudge from setup runs swift,
Keeping deployments aligned—no rift! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: adding logic to re-run setup.sh when deployed agent versions mismatch the repository version.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/update-always-deploy-agents

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 and usage tips.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 4 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Fri Feb 6 01:02:06 UTC 2026: Code review monitoring started
Fri Feb 6 01:02:07 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 4
Fri Feb 6 01:02:07 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Fri Feb 6 01:02:09 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 4
  • VULNERABILITIES: 0

Generated on: Fri Feb 6 01:02:12 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fix to ensure aidevops update re-runs the setup script when the deployed agent version is out of sync with the repository version, even if the git repository itself is up to date. This correctly handles cases where a previous setup was interrupted or failed. The implementation is sound. I've added one suggestion to improve maintainability by reusing an existing helper function and a predefined variable, which makes the code cleaner and more consistent.

Comment on lines +552 to +553
repo_version=$(cat "$INSTALL_DIR/VERSION" 2>/dev/null || echo "unknown")
deployed_version=$(cat "$HOME/.aidevops/agents/VERSION" 2>/dev/null || echo "none")

Choose a reason for hiding this comment

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

medium

For better maintainability and consistency, it's recommended to use the existing get_version function to get the repository version and the $AGENTS_DIR variable for the path to the deployed agents' version file. This avoids code duplication and hardcoded paths.

Suggested change
repo_version=$(cat "$INSTALL_DIR/VERSION" 2>/dev/null || echo "unknown")
deployed_version=$(cat "$HOME/.aidevops/agents/VERSION" 2>/dev/null || echo "none")
repo_version=$(get_version)
deployed_version=$(cat "$AGENTS_DIR/VERSION" 2>/dev/null || echo "none")

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