HealthKit workout deletion does not remove Exercise Minutes and Active Energy generated during the session

I’m developing a watchOS application for Apple Watch Ultra 2 that continuously monitors heart rate during non-sporting activities, such as driving.
The application uses:
● HKWorkoutSession
● HKLiveWorkoutBuilder
● HKAnchoredObjectQuery to retrieve heart rate samples
I have observed that starting a workout session allows frequent heart rate measurements to continue even when the Apple Watch display becomes dimmed.
However, this creates an unwanted side effect: although the user is not exercising, the session contributes to the Activity rings.
In my tests, a workout recorded as type .other generated Exercise Minutes and Active Energy, even though the saved workout itself reported 0 active calories.
The problem occurs when deleting the workout.
After selecting Delete Workout & Data in the Health/Fitness interface:
1. The workout disappears from the workout history.
2. The Exercise Minutes generated during the session remain in HealthKit.
3. The Active Energy samples generated during the same interval also remain.
4. The corresponding Activity ring totals are not immediately corrected.
I subsequently deleted the Exercise Minutes samples manually from the Health app.
This corrected the numerical Exercise Minutes total.
The Active Energy samples required separate handling.
In some tests, the numerical values and the graphical representation of the Activity rings also appeared temporarily inconsistent.
My questions are:
1. Is this the expected behavior of HealthKit when deleting a workout created using HKWorkoutSession and HKLiveWorkoutBuilder?
2. Why does Delete Workout & Data leave Exercise Minutes and Active Energy samples generated during the workout interval?
3. Are these samples considered independent system-generated measurements rather than data associated with the workout?
4. Is there a supported way to prevent a monitoring session from contributing to the Activity rings while still maintaining frequent heart rate acquisition in the background?
My objective is to monitor physiological parameters during activities that are not exercise, without modifying the user’s fitness statistics.
I would appreciate clarification about the intended behavior of these APIs and the recommended implementation approach.

Yeah, I believe the behavior you described is expected.

Deleting a workout doesn't remove the associated Exercise Minutes and Active Energy samples because:

  • The samples (.appleExerciseTime and .activeEnergyBurned) are not added via the your workout builder. They are generated by the system, and are considered system-generated measurements rather than data associated with the workout. (To your question 3).

  • Deleting the samples will imply that the user had zero exercise minutes and burned zero active energy in the timeframe, which isn't quite reasonable.

After a workout is added or deleted, the system calculates the exercise minutes and active energy using its own algorithm. For a workout of .other activity type, the system awards active energy burn equivalent to a brisk walk for every minute the workout is active, even though you don't provide calorie samples for the workout. The calculation is asynchronous, and the update on the rings in the UI often lags behind the update on the data. These factors may lead to the "temporarily inconsistent" you see.

There is no API to tell the algorithm to ignore a workout, but you can check if the following helps:

  1. Avoid using a workout of the .other activity type.
  2. Discard the workout by not calling finishWorkout, as mentioned here. With this, you still monitor the parameter during the workout, but don't persist the the workout to HealthKit.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

i tried out .mindAndBody but it didn't help. exercise minutes seems to rise just because a workoutsession is ontoing. no matter what is the exercise you are doing. calories are impacted too. it looks lke i can define my own exercise but i can't declare calories burn ratio.
Not calling finishWorkout() do not alter the training sessions but rings remain updated by the workoutsession the same as ping as they are updated during session not at the end while finalising it.
thank you