Skip to content

Fix join reminder notifications: status filter bug and daily 8 AM scheduling#99

Merged
a-type merged 4 commits intomainfrom
copilot/fix-reminder-notification-date
Mar 28, 2026
Merged

Fix join reminder notifications: status filter bug and daily 8 AM scheduling#99
a-type merged 4 commits intomainfrom
copilot/fix-reminder-notification-date

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 28, 2026

Two bugs caused join reminder notifications to show incorrect dates and be sent to the wrong recipients. Additionally, the reminder scheduling has been changed to a daily cadence.

Bugs fixed

  • AdminStore.getInvitedPlayerIds — status filter silently dropped
    Kysely builders are immutable; the .where(statusFilter) result was never reassigned, so { statusFilter: 'pending' } was ignored and all invitations (including accepted/declined) were returned.

    // Before — filter discarded
    const builder = this.#db.selectFrom(...).select([...]);
    if (statusFilter) {
      builder.where('status', '=', statusFilter); // new builder thrown away
    }
    
    // After — filter applied
    let builder = this.#db.selectFrom(...).select([...]);
    if (statusFilter) {
      builder = builder.where('status', '=', statusFilter);
    }
  • GameSession.#scheduleJoinRemindersTask — reminder rescheduled on every DO wake-up
    The reminder was scheduled as addHours(new Date(), 24). After the initial reminder fired (deleting the task from the scheduler), any subsequent DO hibernation/wake cycle with the game still pending would schedule another reminder 24h from that new wake time — producing repeated notifications with ever-increasing "N days ago" counts.

Scheduling change

Join reminders now fire at 8 AM every day (in the session's timezone) instead of once 24 hours after session creation. After each send, #sendJoinReminders reschedules itself for 8 AM the next day — mirroring the existing turn-reminder pattern. Rescheduling stops automatically when the game session is no longer pending or when there are no remaining pending invitees.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI linked an issue Mar 28, 2026 that may be closed by this pull request
Two bugs fixed:
1. AdminStore: getInvitedPlayerIds was silently discarding the status
   filter due to Kysely's immutable builder pattern. Changed const to let
   and reassigned the builder to properly apply the filter.
2. GameSession: #scheduleJoinRemindersTask was scheduling 24h from the
   current time (DO startup) rather than from session creation time. After
   the initial reminder fired and the task was deleted, a DO restart would
   reschedule another reminder 24h in the future, causing repeated
   notifications with ever-increasing 'days ago' counts. Fixed to always
   schedule relative to sessionData.createdAt, and skip if that time has
   already passed.

Agent-Logs-Url: https://github.com/a-type/rout/sessions/8bb42897-cd20-46ff-acff-fabe64647b99

Co-authored-by: a-type <2829772+a-type@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix join reminder notification date Fix join reminder notifications firing repeatedly with stale dates Mar 28, 2026
Copilot AI requested a review from a-type March 28, 2026 14:54
Copy link
Copy Markdown
Owner

@a-type a-type left a comment

Choose a reason for hiding this comment

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

Please change the game join reminder to be scheduled for 8 am every day, until the game session is no longer pending.

…er pending

Instead of a one-shot 24h reminder, the join reminder now fires every day
at 8 AM (in the session's timezone) as long as there are still pending
invitees. After sending, #sendJoinReminders reschedules for 8 AM the next
day (mirroring the turn-reminder pattern). Also removes unused addHours
import.

Agent-Logs-Url: https://github.com/a-type/rout/sessions/6cf1b1ce-9199-4a4f-8d22-f3a0e46cb8a7

Co-authored-by: a-type <2829772+a-type@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 28, 2026

Please change the game join reminder to be scheduled for 8 am every day, until the game session is no longer pending.

Done in 7228a10. Join reminders now fire at 8 AM every day in the session's timezone. After each send, #sendJoinReminders calls #scheduleJoinRemindersTask() to queue the next day's 8 AM alarm — matching the same pattern as turn reminders. Rescheduling stops automatically when the game is no longer pending (early-exit guard at the top of #sendJoinReminders) or when there are no remaining pending invitees.

Copilot AI changed the title Fix join reminder notifications firing repeatedly with stale dates Fix join reminder notifications: status filter bug and daily 8 AM scheduling Mar 28, 2026
Copilot AI requested a review from a-type March 28, 2026 15:09
@a-type a-type marked this pull request as ready for review March 28, 2026 17:33
@a-type a-type merged commit d0e8e53 into main Mar 28, 2026
1 check passed
@a-type a-type deleted the copilot/fix-reminder-notification-date branch March 28, 2026 19:15
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.

Join reminder notification date seems wrong

2 participants