Skip to content

Add urgent upgrade warning when CLI is many versions behind#163

Merged
Sayan- merged 4 commits into
mainfrom
hypeship/very-old-version-warning
May 18, 2026
Merged

Add urgent upgrade warning when CLI is many versions behind#163
Sayan- merged 4 commits into
mainfrom
hypeship/very-old-version-warning

Conversation

@Sayan-
Copy link
Copy Markdown
Contributor

@Sayan- Sayan- commented May 14, 2026

Summary

The CLI already shows a friendly "a new release is available" banner once a day via update.MaybeShowMessage. This adds a louder variant for users who are very far behind modeled on the Pulumi-style "you are running a very old version and should upgrade as soon as possible" prompt.

A version is considered "very old" when either:

  • the latest release is a full major version ahead, or
  • the latest release is at least 5 minor versions ahead within the same major.

When that condition fires, the banner switches from pterm.Info to pterm.Warning and uses urgent copy. Otherwise behavior is unchanged.

Test plan

  • go test ./pkg/update/... passes (added TestIsVeryOldVersion covering same-version, one/four/five minor behind, major bump, patch-only, v-prefix, non-semver).
  • go build ./... succeeds.

Note

Low Risk
Low risk: changes are limited to update-notification messaging and when the banner is shown (TTY-only), with no impact on core command execution beyond suppressing output in piped/redirected scenarios.

Overview
Adds a new IsVeryOldVersion semver check (2+ major versions behind, or 5+ minors behind within the same major) and uses it to escalate the update banner from pterm.Info to a more urgent pterm.Warning message.

Upgrade messaging is now consistently written to stderr, and MaybeShowMessage skips printing the banner when stdout is not a TTY (e.g., piped/redirected). A dedicated TestIsVeryOldVersion suite covers the new version-threshold logic and error cases.

Reviewed by Cursor Bugbot for commit 26c8729. Bugbot is set up for automated code reviews on this repo. Configure here.

Sayan- and others added 3 commits May 14, 2026 17:41
When the installed CLI is a full major version or 5+ minor versions
behind the latest release, escalate the periodic update banner from
"A new release is available" to "You are running a very old version
and should upgrade as soon as possible".
Three changes on top of the urgent-upgrade-warning banner:

1. IsVeryOldVersion now requires a 2+ major gap (not any major gap).
   This avoids telling every up-to-date v0.x user "you are running a
   very old version" the moment v1.0.0 ships. The 5-minor rule inside
   the same major is unchanged.

2. MaybeShowMessage skips when stdout is not a terminal. Pipes,
   redirects, and CI logs no longer get banner text mixed into
   machine-readable output (e.g. `kernel browsers list -o json | jq`).

3. printUpgradeMessage now writes to stderr instead of stdout, so the
   banner stays out of stdout in any edge case the TTY check misses.

Tests updated: dropped the single-major-bump escalation case and added
coverage for the v0.x → v1.0 cusp plus a true 2-major gap.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Sayan- Sayan- changed the title add urgent upgrade warning when CLI is many versions behind Add urgent upgrade warning when CLI is many versions behind May 18, 2026
@Sayan- Sayan- requested review from hiroTamada and masnwilliams May 18, 2026 21:39
@Sayan- Sayan- marked this pull request as ready for review May 18, 2026 21:39
@firetiger-agent
Copy link
Copy Markdown

Firetiger deploy monitoring skipped

This PR didn't match the auto-monitor filter configured on your GitHub connection:

Any PR that changes the kernel API. Monitor changes to API endpoints (packages/api/cmd/api/) and Temporal workflows (packages/api/lib/temporal) in the kernel repo

Reason: PR modifies CLI update warning logic, not kernel API endpoints or Temporal workflows as specified in the filter.

To monitor this PR anyway, reply with @firetiger monitor this.

Copy link
Copy Markdown
Contributor

@masnwilliams masnwilliams left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5841202. Configure here.

Comment thread pkg/update/check.go
@Sayan- Sayan- merged commit f375eaa into main May 18, 2026
7 checks passed
@Sayan- Sayan- deleted the hypeship/very-old-version-warning branch May 18, 2026 21:44
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.

2 participants