You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Completed workouts can bypass Health export (endWorkout, stale-session reconcile, workout-only imports) #277
Found by CodeRabbit during #262 review (flagged as outside that PR's diff — filing separately so it isn't lost). Not a regression from #262; pre-existing behavior.
The gap
Three paths mark a session row done without ever reaching the Health store:
LocalRepositoryImpl.endWorkout — writes status: 'done' but never calls HealthExporter.exportWorkoutId / exportWorkout. Health export only picks sessions up inside exportAll's per-day_result scan.
Stale-session reconciliation (AppState._reconcileOrphanedLiveWorkout) — silently finalizes stale live rows (deliberately: no resurfacing a days-old banner), but those rows carry end_ts: null, so even if export scanned them there is no end time to export. They are permanently un-exportable as things stand.
Workout-only imports — an import that brings sessions but no/unchanged day_result rows can bypass exportAll's day scan entirely, so imported completed sessions never export.
Why it matters
AGENTS.md §4.7's exact failure class: capability wired into one call path but not all N. A user who finishes a workout offline (app killed mid-session → reconciled on next launch) or imports history gets silent gaps in Apple Health / Health Connect while the app shows the session as saved.
Suggested shape
endWorkout and reconciliation set a real end_ts (reconciliation may need to derive one — e.g. last sample ts or reconcile time, stated honestly) and then route through the existing HealthExporter.exportWorkoutId(...) after the DB write lands.
This looks fixed by #308, which lists all three paths (the coach's end_workout, the stale-session reconcile and the WHOOP CSV import) and has "Closes #277" in its description. The issue seems to have stayed open only because of how the close keywords were listed.
this is fixed. #308 (in 0.11.3) made workouts ended from the coach and from the whoop csv import go to health export, and the normal end workout path exports right away. one exception on purpose: if the app got killed mid workout and the session is cleaned up on next launch, it isn't exported, since we don't know when it really ended and didn't want to write a made up duration into apple health / health connect. closing. reopen this if you think it hasn't been fixed or there's more to discuss, happy to talk it through.
Activity
kurexw commentedon Nov 11, 2026
This looks fixed by #308, which lists all three paths (the coach's end_workout, the stale-session reconcile and the WHOOP CSV import) and has "Closes #277" in its description. The issue seems to have stayed open only because of how the close keywords were listed.
abdulsaheel commentedon Nov 17, 2026
this is fixed. #308 (in 0.11.3) made workouts ended from the coach and from the whoop csv import go to health export, and the normal end workout path exports right away. one exception on purpose: if the app got killed mid workout and the session is cleaned up on next launch, it isn't exported, since we don't know when it really ended and didn't want to write a made up duration into apple health / health connect. closing. reopen this if you think it hasn't been fixed or there's more to discuss, happy to talk it through.