section-11 icon indicating copy to clipboard operation
section-11 copied to clipboard

workout_summary labels the second step of a 2-step repeat as "rec" even when it has a higher power target

Open gcowan2 opened this issue 2 months ago • 1 comments

MD text below from Claude....

Version: sync.py VERSION 3.133 (examples/sync.py). The same logic is in the v11.43 and v11.49 copies.

What happens

_render_repeat_block treats every 2-step repeat block as work + rest. It never compares the two power targets. Over/under or alternating-endurance blocks get summarised as if the harder step were a recovery.

Example

Planned workout (Intervals.icu description, FTP 305W):

6x
- 10m 62%
- 10m 72%

Generated workout_summary:

6×10m @189W / 10m rec

The "rec" step is the 72% step (~220W), the harder of the two. The set is really 2h of continuous work with no recovery. Because the pre-workout report template says to use workout_summary as the source and leave out recovery steps, an AI coach following the protocol reports the wrong session structure and understates the load.

Cause

In _render_repeat_block, the simple case (len(nested) == 2) assigns work, rest = nested[0], nested[1] and prints / {rest} rec without a power check. The other detectors already guard against this. _detect_alternating_in_nested rejects pairs where w_power <= r_power, and the top-level alternating detector documents "Work power must be higher than rest power".

Suggested fix

Before labelling the second step as recovery, compare the powers. If the second step's power is equal or higher, render both steps as work:

if len(nested) == 2:
    work, rest = nested[0], nested[1]
    work_str = self._describe_work_step(work)
    work_power = self._get_power(work)
    second_power = self._get_power(rest)
    if (work_power is not None and second_power is not None
            and second_power >= work_power):
        second_str = self._describe_work_step(rest)
        if work_str and second_str:
            return f"{reps}×({work_str} + {second_str})"
    rest_str = self._describe_rest_duration(rest)
    ...  # existing logic unchanged

Output after the change:

Input Before After
6× (10m @189W, 10m @220W) 6×10m @189W / 10m rec 6×(10m @189W + 10m @220W)
3× (12m @299W, 7m @120W) 3×12m @299W / 7m rec unchanged
5× (1m @400W, 2m no target) 5×1m @400W / 2m rec unchanged

Open questions for maintainers

  • A step with a lower but still hard target (e.g. 5m @110% / 5m @95%) would still be labelled "rec". An absolute cut-off (e.g. a second step above ~55–60% FTP isn't a recovery) might be worth adding.
  • The template could also tell the AI to cross-check workout_summary against description when they disagree.

gcowan2 avatar Sep 23 '26 03:09 gcowan2

Resolved. Workout summaries no longer invent recovery intent, and the documentation now explains how optional step text can make recovery and connector intent explicit. Thanks for reporting this.

CrankAddict avatar Sep 29 '26 12:09 CrankAddict