Skip to content

Commit 33b32ac

Browse files
kevinelliottclaude
andcommitted
fix: correctly handle version check success with no updates
- Return latest version even when no update is needed - Show "You're running the latest version" with version number - Fix logic to properly distinguish between check failure and up-to-date The issue was that when running the latest version, we returned an empty string which made it look like the check failed, when it actually succeeded. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6455699 commit 33b32ac

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

cmd/version.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ func runVersion(cmd *cobra.Command, args []string) {
4545
fmt.Printf(" Latest version: %s\n", latestVersion)
4646
fmt.Printf("\n Update with: brew upgrade agentpipe\n")
4747
fmt.Printf(" Or download from: https://github.com/kevinelliott/agentpipe/releases/latest\n")
48-
} else if latestVersion == "" {
49-
// Silently skip if we couldn't determine the latest version (likely rate limited)
50-
fmt.Printf(" ℹ️ Update check unavailable at this time\n")
48+
} else if latestVersion != "" {
49+
fmt.Printf(" ✅ You're running the latest version! (%s)\n", latestVersion)
5150
} else {
52-
fmt.Printf(" ✅ You're running the latest version!\n")
51+
// Couldn't determine the latest version
52+
fmt.Printf(" ℹ️ Update check unavailable at this time\n")
5353
}
5454
}
5555
}

internal/version/version.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ func CheckForUpdate() (bool, string, error) {
5050
}
5151
defer resp.Body.Close()
5252

53-
if resp.StatusCode != http.StatusFound {
53+
// Check if we got a redirect (302 or 301)
54+
if resp.StatusCode != http.StatusFound && resp.StatusCode != http.StatusMovedPermanently {
5455
// Try the API as a fallback (will hit rate limits but worth a try)
5556
return checkViaAPI()
5657
}
@@ -78,7 +79,8 @@ func CheckForUpdate() (bool, string, error) {
7879
return true, latestTag, nil
7980
}
8081

81-
return false, "", nil
82+
// Return false with the latest version so we know the check succeeded
83+
return false, latestTag, nil
8284
}
8385

8486
// checkViaAPI is a fallback that uses the GitHub API (subject to rate limits)

0 commit comments

Comments
 (0)