Skip to content

Sleep: the ring sometimes ends the night early, could Bedtime help catch it? #148

Open

Description

@Albabit

Hi @foureight84,

A small idea for the Sleep screen, nothing urgent.

What happens: this ring closes the night when I get up, but it doesn't always start a new record when I fall back asleep. Last night (RC2) it ended at 07:48 after a short get-up. I read the ring's memory to make sure: one record, 02:59 to 07:48, nothing after. I actually woke up around 09:20 and turned Bedtime off at 09:27.

Seen 3 times so far:

  • Oct 12: the ring ended at 06:58 without me getting up, I woke at 07:25, Bedtime off at 07:26.
  • Nov 3: it ended at 07:34 after a short get-up, I was probably back asleep until about 08:49, Bedtime off at 08:49.
  • Nov 15: it ended at 07:48 after a short get-up, I woke around 09:20, Bedtime off at 09:27.

Each time, the ring logged no steps between the end of its record and Bedtime off, and Bedtime off was close to when I really woke up.

Idea: when the ring's last record ends while Bedtime is still on, and no steps follow until Bedtime goes off, the Sleep screen could suggest the real end of the night, pre-filled from the Bedtime off time. Something like "The ring stopped at 7:48 but Bedtime stayed on until 9:27 with no steps. Were you still asleep?". One button would open the edit with the end already set to 9:27, so the user only has to confirm it or adjust it, and "No" would dismiss it. The edit already does the rest (added time, not staged or scored), and its 120 min limit covered all three nights.

I'd keep it a suggestion the user confirms rather than a silent change, since lying awake in bed looks the same to the ring.

Thanks!

Activity

  1. foureight84 commented on Nov 19, 2026

    @foureight84
    Owner

    @Albabit Thanks for the detailed examples — we built an RC build to test this workflow in PR #149 (https://github.com/foureight84/PulseLoopAndroid/pull/149):

    What it does

    • On the Sleep screen, when Track Bedtime / DND mode is enabled and a ring record ends 15–120 minutes before Bedtime turns off, a post-Bedtime full sync has completed, and there are no step buckets logged in the gap between the ring's end and Bedtime turning off, a "Were you still asleep?" prompt card appears under the hero card.
    • Because lying awake still looks identical to sleep to an idle ring sensor, nothing is edited automatically:
      • Tapping Extend to ... opens the sleep record edit dialog pre-filled with Bedtime's end time (snapped to the record's minute grid and respecting the 120m / 7 PM caps) so you can confirm or adjust it before saving — the added minutes stay unstaged and out of the score breakdown, just like manual edits.
      • Tapping No dismisses the prompt for that record.

    Quick test tip

    Because the check runs dynamically for whichever day is open in the Sleep → Day view, you can scroll back to Nov 15 right away to test it on your existing 02:59–07:48 / 09:27 night (as long as that night's Bedtime window is still in local Zen history and the record hasn't already been manually extended/edited), as well as on future mornings. Let us know how it behaves!

  2. Albabit commented on Nov 20, 2026

    @Albabit
    Author

    @foureight84, thanks! I installed v2.12.1+91-rc1 this morning and went back through the last few days in Sleep → Day.

    Where the card showed up:

    • Nov 16: "The ring stopped at 07:54, but Bedtime stayed on until 08:52 with no steps." Extend opened the edit dialog with the end already set to 08:52. I saved it, and the night now shows 00:14 to 08:52.
    • Nov 17 (night in 2 parts): the card was on the last part, 07:53 → 08:35. I tapped No and it went away.

    Where it didn't, all as expected:

    • Nov 15: I had already extended that night by hand to 09:20.
    • Nov 18: the ring ended at 08:22, a minute after Bedtime ended (08:21).
    • Nov 19: only a 10 min gap.
    • Nov 20: the ring's battery died around 03:52 and Bedtime ended at 09:10, so the gap is over 2 hours.

    On both mornings with a card, the phone screen stayed off for the whole gap and there were no steps, so the conditions look right. I honestly don't remember if I was still asleep. The ring's hourly heart rate was a decent hint on Nov 16: 58 at 08:00, close to my night values, then 104 at 09:00. On Nov 17 it was 81 to 92 all night, so no help there.

    Score dropped after the extension:
    Nov 16 went from 81 to 75 when I saved, even though the added minutes are meant to stay out of the score. I think it's the coverage test in SleepInsights.calculate. That night has no Awake blocks at all (460 min of light, REM and deep, the whole span), so before the edit coveredStageMin >= span * 0.95 was true and the awake part got its full 15 points. After the edit the span is 518 min but coveredStageMin is still 460 (ADDED is filtered out), so 89 %, hasAwakeSignal turns false and the awake part falls to 15 × 0.55. The comment there says added minutes leave the coverage test, but since they stay in span they still count. Comparing against span - added would probably fix it. On Nov 4 an extension didn't change the score, but that night had Awake blocks.

    Small idea: when the ring took an hourly reading inside the gap, the card could show it (something like "Heart rate at 08:00: 58"). It would make the question easier to answer.

  3. foureight84 commented on Nov 20, 2026

    @foureight84
    Owner

    @Albabit Thanks for walking through RC1 across the whole week — and good eye tracking down why Nov 16 dropped from 81 to 75!

    We updated PR #149 (https://github.com/foureight84/PulseLoopAndroid/pull/149) and cut RC3 with your feedback addressed:

    What changed in RC3

    1. Outward-extension score fix (SleepScore.calculate): Your diagnosis was spot on — rather than span - added (which would shrink the span over #106 interior between-record fills), SleepScore.calculate now measures span across the ring's own measured blocks whenever ADDED minutes are present. That preserves interior between-record gaps as intended while keeping outward head/tail extensions completely score-neutral even on nights with zero AWAKE blocks. Your Nov 16 night should jump straight back from 75 → 81 on launch without needing to re-edit it.
    2. In-gap heart rate hint on the prompt card: When the ring logged non-demo heart rate readings inside the suggested gap (before Bedtime turned off), the card now shows them alongside your night's mean HR — e.g., "Heart rate at 08:00: 58 bpm · night avg 59 bpm" for an hourly ring, a compact list for 2–3 readings, or an avg/range summary on rings that sample more densely (with per-minute dedup so 1 Hz live HR doesn't skew the night mean).
    3. Sync-gate hardening: Sleep-only queries (SyncSleepNow) on YCBT rings no longer stamp lastFullSyncAt, so the prompt waits until SPORT (steps) and HEART history have also synced after Bedtime ends (and safely requires at least one observable step bucket interval before claiming "with no steps").

    Let us know how Nov 16's score and any new prompts look in RC3!

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions