Skip to content

Fix on-call timezone bug, channel resolution, and weekend DM skip#3

Merged
ewels merged 1 commit intomainfrom
fix/oncall-timezone-channel-weekend
Mar 24, 2026
Merged

Fix on-call timezone bug, channel resolution, and weekend DM skip#3
ewels merged 1 commit intomainfrom
fix/oncall-timezone-channel-weekend

Conversation

@ewels
Copy link
Copy Markdown
Member

@ewels ewels commented Mar 24, 2026

Summary

  • Timezone bug fix: Daily on-call reminders now use the user's local date (not UTC) for determining which week they're in. Fixes incorrect DMs for users in far-ahead timezones (e.g. Chris in NZ at UTC+12 getting a DM about the previous week).
  • Channel resolution: #core channel is now resolved by name via conversations.list (cached for process lifetime) instead of passing the channel name string directly to chat_postMessage. Fixes channel_not_found errors on private channels. Channel name is configurable via ONCALL_CHANNEL env var (defaults to core).
  • Weekend skip: Daily on-call reminder DMs are now only sent Monday–Friday, not on weekends.

Changes

File What
src/nf_core_bot/scheduler/oncall_jobs.py Extracted _get_user_local_datetime() from _is_user_local_morning(). Added _resolve_channel_id() with process-lifetime cache. Daily reminder block uses user-local date for week check + weekday filter.
src/nf_core_bot/config.py Added ONCALL_CHANNEL default (core)
tests/test_oncall_scheduler.py 8 new tests: NZ timezone regression, Saturday/Sunday skip, channel resolution (find, pagination, not found, caching, API error)

Verified

  • 368/368 tests pass
  • ruff clean
  • mypy 0 errors

CloudWatch evidence

The channel_not_found error was confirmed in yesterday's logs (2026-03-23 08:00:54 UTC):

SlackApiError: The request to the Slack API failed. error: channel_not_found

…weekend DMs

- Use user's local date (not UTC) for daily reminder week-range check,
  fixing incorrect DMs for users in far-ahead timezones (e.g. NZ UTC+12)
- Resolve #core channel ID by name via conversations.list (cached for
  process lifetime) instead of hardcoding channel name, fixing
  channel_not_found errors on private channels
- Skip daily on-call reminder DMs on Saturday and Sunday
- Add ONCALL_CHANNEL config (defaults to 'core') for channel name lookup
- 8 new tests: NZ timezone regression, weekend skip, channel resolution
@ewels ewels merged commit c8b214d into main Mar 24, 2026
3 checks passed
@ewels ewels deleted the fix/oncall-timezone-channel-weekend branch March 24, 2026 10:06
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.

1 participant