Skip to content

fix: retry a failed update check sooner - #809

Open
zimeg wants to merge 11 commits into
mainfrom
zimeg-fix-retry-failed-update-check
Open

zimeg wants to merge 11 commits into
mainfrom
zimeg-fix-retry-failed-update-check

Conversation

@zimeg

@zimeg zimeg commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Changelog

The Slack CLI now checks for updates again after about an hour when a check fails, such as while offline, instead of waiting a full day.

Summary

This pull request checks for a Slack CLI update again after about 1 hour when the check fails, instead of waiting 24 hours.

  • Before, every check stamped last_update_checked_at with the current time, even when the Slack CLI metadata couldn't be fetched. One command run offline delayed the next update notice by a full day.
  • A failed Slack CLI check now sets a new last_update_check_failed_at field in config.json to the current time and leaves last_update_checked_at alone, so slack doctor still shows the last successful check.
  • While that failure is less than 1 hour old, background checks skip, so working offline doesn't wait on a check (with its 60 second timeout) after every command. After that, the next command checks again.
  • A successful check stamps last_update_checked_at, as before, and removes last_update_check_failed_at.
  • Only the Slack CLI check counts. A failing check-update hook is specific to a project, so it counts as a successful check and waits the usual 24 hours.

Stacked on #808.

Testing

With a build of this branch and an empty config folder (mkdir -p /tmp/fix-check):

  1. HTTPS_PROXY=http://127.0.0.1:9 ./bin/slack upgrade --config-dir /tmp/fix-check errors with cli_update_check_error (from fix: report a failed update check from the upgrade command #808) and exits 1. At 12:09:54 it wrote "last_update_check_failed_at": "2026-11-18T12:09:54-08:00" and left last_update_checked_at unset.
  2. HTTPS_PROXY=http://127.0.0.1:9 ./bin/slack auth list --config-dir /tmp/fix-check --verbose right after prints "You are not logged in to any Slack accounts", exits 0, logs no CheckForUpdate, and leaves both fields unchanged.
  3. With last_update_check_failed_at edited to 2 hours ago, the same auth list runs the background check, logs CheckForUpdate for *update.CLIDependency failed only in the debug output, exits 0, and moves last_update_check_failed_at to the current time (12:10:06).
  4. ./bin/slack upgrade --config-dir /tmp/fix-check while online prints "✔ You are using the latest Slack CLI version", exits 0, stamps last_update_checked_at (12:10:06), and removes last_update_check_failed_at.
  5. ./bin/slack doctor --config-dir /tmp/fix-check then shows Last updated: 2026-11-18 12:10:06 -08:00.

Notes

  • The new field uses omitzero so that clearing it removes the key. omitempty doesn't omit a zero time.Time. Because of that, a config whose only check so far failed shows "last_update_checked_at": "0001-01-01T00:00:00Z". A zero time is treated as never checked, as on main.
  • A forced check (slack upgrade) always runs, even within an hour of a failure.
  • Test_UpdateNotification_CheckForUpdate checks both fields after each check: a failure sets last_update_check_failed_at and leaves the stamp, a background check within 1 hour of a failure skips, one after 1 hour runs, a failure time in the future counts as expired, a recent success still waits 24 hours after an older failure, a success clears the field, and a hook-only failure counts as a success. Each case also checks that a background check right after is skipped. Test_Config_GetLastUpdateCheckFailedAt and Test_Config_SetLastUpdateCheckFailedAt cover reading the field and removing its key. Each case fails without the change it covers.

Requirements

🤖 Generated with Claude Code

zimeg and others added 2 commits November 18, 2026 11:18
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg zimeg added this to the Next Release milestone Nov 18, 2026
@zimeg zimeg added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented changelog Use on updates to be included in the release notes semver:patch Use on pull requests to describe the release version increment labels Nov 18, 2026
@zimeg zimeg self-assigned this Nov 18, 2026
@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.37209% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.24%. Comparing base (249a48f) to head (5aa0c0f).

Files with missing lines Patch % Lines
internal/config/system.go 80.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #809      +/-   ##
==========================================
+ Coverage   80.18%   80.24%   +0.06%     
==========================================
  Files         244      244              
  Lines       18736    18778      +42     
==========================================
+ Hits        15024    15069      +45     
+ Misses       3712     3709       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg
zimeg marked this pull request as ready for review November 18, 2026 20:14
@zimeg
zimeg requested a review from a team as a code owner November 18, 2026 20:14
@zimeg
zimeg requested a review from mwbrooks November 18, 2026 20:14

@mwbrooks mwbrooks left a comment

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.

✅ Thanks @zimeg! Keeping the failure in its own field means slack doctor still shows the last check that actually worked.

Comment thread internal/update/update.go Resolved
zimeg and others added 2 commits November 18, 2026 12:24
Co-authored-by: Michael Brooks <21328+mwbrooks@users.noreply.github.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

@WilliamBergamin WilliamBergamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧪 Thanks @zimeg! Checking both fields after every row, then running a second background check, pins the retry window nicely.
Left a few comments, nothing blocking 💯

Comment thread internal/update/update.go Resolved
Comment thread internal/update/update.go Resolved
Comment thread internal/update/update_test.go Resolved
Comment thread internal/update/update.go Resolved
Comment thread internal/update/update.go
checkErr = err
}
if _, ok := v.(*CLIDependency); ok {
cliCheckFailed = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💯 praise: Counting only the Slack CLI check as a failure keeps a broken project hook from turning on hourly retries.

zimeg and others added 4 commits November 18, 2026 16:54
Co-authored-by: William Bergamin <25348381+WilliamBergamin@users.noreply.github.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-authored-by: William Bergamin <25348381+WilliamBergamin@users.noreply.github.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg
zimeg changed the base branch from zimeg-fix-upgrade-check-error to main November 19, 2026 01:21
@zimeg
zimeg requested a review from a team as a code owner November 19, 2026 01:21
zimeg and others added 2 commits November 18, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented changelog Use on updates to be included in the release notes semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants