Skip to content

Sleep: coach card written from half a night, and a short gap not drawn as Awake #140

Open

Description

@Albabit

Two small things from last night (Nov 8 to 9), seen on RC6 (80). The code involved is the same in RC7.

The ring recorded the night in two parts: 23:04 to 00:07 and 00:08 to 07:56, 8h 50m in total.

1. The sleep coach card gets written in the middle of the night:

A background sync at 02:04 only got the first part, since the ring hands a record over once it's closed. CoachSleepSyncGate.sleepDaySafeToSummarize passed anyway (that part had ended more than 30 min earlier, and a full sync finished after it), so the card was written at 02:04:42 from a 1h 03m night. When I checked it in bed after waking up, it said the night was too short and I should wind down earlier. It was only rewritten at 08:30:57, after the 08:29 sync ("Solid night overall").

The export shows the same thing on other mornings (coachSummaries):

  • Nov 4: card created 07:03, night ended 07:57, rewritten 09:07
  • Nov 6: card created 01:50, night ended 06:59, rewritten 07:36
  • Nov 8: card created 06:23, night ended 06:39, rewritten 08:41

On Nov 4 and Nov 8 the rewrite came about 2 hours after the first card, which looks like the 2 h minIntervalMs floor.

Ideas: when Bedtime tracking is on, wait for Bedtime mode to end before writing the card. And maybe let the rewrite skip the 2 h floor when the night got longer.

2. A gap under a minute is counted as Awake but not drawn:

The real gap between the two parts was 41 s (00:07:20 to 00:08:01, read from the ring). The Records card says "Awake 1m between" and the Awake card counts it (2m: that minute plus 1 min awake at 07:55), but the hypnogram shows nothing there.

In hypnogramBlocks, the first part's blocks end at minute 63 and the second part starts at minute 63, so untilMinute <= fromMinute and no block is added, while betweenRecordAwakeMinutes returns its 1 minute floor. A small one, but it's the case #111 was meant to close: the chart and the two cards disagree again. Maybe draw a 1 minute block whenever betweenRecordAwakeMinutes is above 0.

Activity

  1. foureight84 commented on Nov 13, 2026

    @foureight84
    Owner

    @Albabit thanks for digging through the export, those timestamps made this easy 🙏

    Both parts are in v2.11.3+85-rc1 (versionCode 85, PR #144):

    1. Coach card from half a night: while your Bedtime mode is still on (or the sleep quiet-hours window is open), the card now waits, for at most 8 h after the night's last stored minute. It only counts a DND window that started by the time the night ended, so an afternoon DND won't hold it back. And if a later sync adds 15+ minutes of sleep, the card gets rewritten right away instead of waiting out the 2 h floor. One limit: if Bedtime and quiet hours are both off, or they end before you actually wake up (like Nov 4), you can still get an early card first. The faster rewrite should fix it shortly after.
    2. Sub-minute gap: went with your idea. The hypnogram now draws that 1-minute Awake block even when the gap rounds to nothing on the minute grid, so the chart matches the Records and Awake cards again.

    Could you keep an eye on the next couple of split nights? Mainly: no card before Bedtime ends, the card rewritten after the morning sync, and the little awake sliver showing up between parts. Thanks!

  2. foureight84 commented on Nov 14, 2026

    @foureight84
    Owner

    @Albabit quick note: v2.11.3+86-rc2 replaces RC1. The coach card and hypnogram changes for this issue are unchanged; RC2 only adds the Bluetooth-off status fix from #136. Nothing new to check here, keep watching the split nights on RC2.

  3. foureight84 commented on Nov 15, 2026

    @foureight84
    Owner

    @Albabit quick update: v2.11.3+87-rc3 (versionCode 87, PR #144) replaces RC2 — the coach card timing and hypnogram gap changes for this issue are unchanged (RC3 only updates scheduled SpO₂ Doze handling from #142).

    Friendly check-in whenever you get a couple of split nights on it — let me know if the Bedtime hold, faster rewrite, and 1-minute Awake sliver look good!

  4. Albabit commented on Nov 17, 2026

    @Albabit
    Author

    @foureight84, Another night in 2 parts on 87 (Nov 16→17):

    • Gap: the parts are 01:13:02→07:11:02 and 07:12:01→07:53:01, so 59 s between them, both ends in the same minute (same case as the 41 s gap in my first report). It's now drawn as Awake on the graph, and the Records card says "Awake 1m between".
    • Coach card: created at 08:36:25, right after Bedtime ended (08:35:10) and the sync that brought the whole night. Nothing was written during the night.

    Not a full test of the card fix yet: no sync managed to connect between the end of part 1 (07:11) and 08:35 (one try at 08:08 failed), so the app never had only half of the night. I'll keep an eye on the next ones.

    screenshot_nuit_16_17_Novembre_2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions