Skip to content

fix: stop polling activity logs after an auth error - #680

Merged
mwbrooks merged 3 commits into
mainfrom
mwbrooks-fix-activity-auth-retry
Sep 29, 2026
Merged

mwbrooks merged 3 commits into
mainfrom
mwbrooks-fix-activity-auth-retry

Conversation

@mwbrooks

@mwbrooks mwbrooks commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Changelog

Fixed an issue where slack activity --tail and slack run kept requesting activity logs every few seconds after the login token became invalid. The command now exits with the auth error.

Summary

This pull request stops activity log polling when the activity API returns an auth error.

  • While tailing, apps.activities.list errors were logged at debug level and retried on every tick (3 seconds by default) until the idle timeout. For slack run, the idle timeout is 24 hours.
  • invalid_auth, not_authed, token_expired, and token_revoked now return the error and stop polling, because every later request with the same token would fail too.
  • Other errors keep the current behavior of retrying on the next tick.

This is a follow-up to #679, which stops retrying token rotation with an invalid refresh token. The two changes are independent and can merge in either order.

Preview

$ slack activity --tail
✨ user of Example Workspace
☁️  2026-09-28 17:36:22 [info] Application Created by user 'U0123456789' on team 'E0123456789'
Check ~/.slack/logs/slack-debug-20260929.log for error logs
The following error was returned by the apps.activities.list Slack API method

🚫 Your token has already been revoked (token_revoked)

💡 Suggestion
   Use the command `slack login` to authenticate again

Testing

  1. Run slack activity --tail for an app.
  2. In another terminal, revoke the token used by the CLI, e.g. slack logout for that workspace.
  3. Confirm slack activity --tail exits with an auth error on the next poll instead of continuing to poll.
  4. Repeat with slack run and confirm it exits with the auth error.

Notes

  • In slack run, an auth error from activity polling now ends the run session, which is consistent with how other errors from the run goroutines are handled.

Requirements

Tailing activity logs with `slack activity --tail` or `slack run` now
returns when the activity API responds with invalid_auth, not_authed,
token_expired, or token_revoked instead of polling again every few
seconds until the idle timeout.
@mwbrooks mwbrooks added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch Use on pull requests to describe the release version increment labels Sep 28, 2026
@mwbrooks mwbrooks self-assigned this Sep 28, 2026
@mwbrooks mwbrooks added this to the Next Release milestone Sep 28, 2026
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.23%. Comparing base (7076706) to head (073e9b0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #680      +/-   ##
==========================================
+ Coverage   78.22%   78.23%   +0.01%     
==========================================
  Files         239      239              
  Lines       18144    18149       +5     
==========================================
+ Hits        14193    14199       +6     
+ Misses       3951     3950       -1     

☔ 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.

@mwbrooks
mwbrooks marked this pull request as ready for review September 29, 2026 18:32
@mwbrooks
mwbrooks requested a review from a team as a code owner September 29, 2026 18:32

@srtaalej srtaalej 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.

thank you for quick followups!

@mwbrooks

Copy link
Copy Markdown
Member Author

Thanks a lot for the second pair of eyes @srtaalej! 🙇🏻

@mwbrooks
mwbrooks merged commit 20dd730 into main Sep 29, 2026
13 checks passed
@mwbrooks
mwbrooks deleted the mwbrooks-fix-activity-auth-retry branch September 29, 2026 21:54
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 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.

2 participants