Skip to content

feat: add passive version check notification - #5279

Open
Aayushyaash wants to merge 2 commits into
rtk-ai:developfrom
Aayushyaash:feat/version-check-notification
Open

Aayushyaash wants to merge 2 commits into
rtk-ai:developfrom
Aayushyaash:feat/version-check-notification

Conversation

@Aayushyaash

Copy link
Copy Markdown
Contributor

Summary

Added a background version check that lets users know when a newer RTK release is available, without interrupting their normal workflow.

  • Background checks: Checks GitHub Releases every 3 hours in a detached thread, so the check doesn't hold up command execution. If GitHub returns a rate-limit or access error (403/429), or the request fails due to a network issue, the next attempt is delayed for 24 hours.
  • Cached results: Stores the latest release tag and check timestamp in $RTK_DATA_DIR/.version_check.json. Uses atomic file replacement and timestamp pre-claiming to avoid concurrent processes making duplicate requests.
  • No extra output for agents: Regular commands such as rtk git, rtk cargo, rtk read, and rtk ls can trigger a check when one is due, but never print the notification. Hook and rewrite output streams are left untouched.
  • Notification on informational commands: Displays a one-line update notice after the normal output of rtk gain, rtk --version, and rtk --help.
  • Install-aware upgrade instructions: Detects how RTK was installed and suggests the appropriate upgrade command for Homebrew, Cargo (--git), the curl install script, Nix, or Winget. Falls back to the GitHub Releases page when the installation method cannot be identified.

Also updated .semgrep.yml to account for the new GitHub Releases request in src/core/version_check.rs, alongside the existing inline // nosemgrep annotation.

Closes #725

Test plan

  • Added 6 unit tests in src/core/version_check.rs covering:
    • Version parsing, including vX.Y.Z, X.Y.Z, and prerelease suffixes.
    • Version comparison.
    • Installation method detection.
    • Upgrade commands for each supported installation method.
    • Check intervals and error/rate-limit backoff.
    • Cache save/load roundtrip using test_isolation::root().
  • cargo test --lib core::version_check — 6 passed, 0 failed.
  • cargo clippy --all-targets -- -D warnings — passed with no warnings.
  • Manual testing:
    • rtk --version displays the version before the update notice.
    • rtk gain displays the complete gain analysis before the notice.
    • rtk git status produces no version notification on stdout or stderr.
    • Verified upgrade instructions for Homebrew, Cargo, the curl install script, Winget, and the fallback GitHub Releases link.

@Aayushyaash
Aayushyaash force-pushed the feat/version-check-notification branch from eab0356 to a289e00 Compare November 24, 2026 18:13
@Aayushyaash
Aayushyaash marked this pull request as draft November 24, 2026 18:19
@Aayushyaash
Aayushyaash force-pushed the feat/version-check-notification branch from a289e00 to 1454c7f Compare November 24, 2026 19:42
@Aayushyaash
Aayushyaash marked this pull request as ready for review November 24, 2026 19:50
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.

feat: version check notification (no auto-update)

1 participant