Repository navigation
Description
Summary
With Profile → Set summary duration = Manual, the Set Summary card holds as designed after a completed set, but every tap on its visible Next Set button is rejected app-side: the screen stays frozen and each tap logs
WORKOUT_PERSISTENCE level=WARNING message=Rest transition install failed details=reason=AUTHORITY_REJECTED
Observed in-app on the iPad simulator with the Phantom provider through the ordinary UI (no harness taps into internals). 50 consecutive taps over ~24 minutes were each rejected; the summary never advanced. This was found while capturing the #1394 boundary acceptance on current main (9ae2124d); PR #1396 is not the cause — its diff does not touch this code path.
Steps to reproduce
- Profile → Set summary duration → Manual (ordinary Settings UI).
- Start a routine on the Phantom provider (simulator build), complete the first working set (simulated reps are fine).
- The Set Summary holds (correct). Tap Next Set.
Expected: the explicit continue installs the rest transition from the claimed set completion and the workout proceeds to the next set's readiness — exactly what the engine contract test autoplay off keeps manual readiness at duplicate boundary (Issue1394ConsecutiveDuplicateAutoAdvanceTest) asserts when it calls proceedFromSummary() at +1 s.
Actual: every tap logs Rest transition install failed reason=AUTHORITY_REJECTED and the screen stays frozen (byte-identical screenshots across taps).
Call chain (source at 9ae2124d)
SetSummaryCard "Next Set" Button(onClick = onContinue) → WorkoutTab onProceedFromSummary → MainViewModel.proceedFromSummary → DefaultWorkoutSessionManager.proceedFromSummary() / proceedFromSummaryFor → ActiveSessionEngine.startRestTimer(completion) / startRestTimerFor (the hasExpectedAuthority gate passes — a false result returns silently and logs transition=suppressed, which never appears) → installInitialRestPlan → hasCompletionRestAuthority returns false → InitialRestPlanInstallResult.AuthorityRejected → the observed WARNING.
One of hasCompletionRestAuthority's identity-coordinate conjuncts (profileId / routineId / routineSessionId / exerciseIndex / setIndex / routineExerciseId vs completion.routineIdentity) no longer matches the coordinator at tap time. The rest plan is installed successfully by the completion job at set-completion time (no install warning at completion in the captured log), so the coordinates drift silently while the summary is held. The exact drifting conjunct is not yet instrumented (Kermit Logger.d never reaches the unified log in this build; only the connection-log PHX-CAPTURE-LOG channel is observable).
Note the stale-completion guards are load-bearing and must survive any fix: installInitialRestPlan deliberately re-checks hasCompletionRestAuthority around replaceRuntimeDocument, and the executionGuard lease/claim machinery rejects superseded completions.
Evidence
From the #1394 boundary-capture run (issue-1394-boundary-capture-t_4538cc25):
logs/12-runR4-test04-findings.md— full symptom write-up and call-chain trace.logs/runR4-test04-autoplay-off-console.log— timeline: execution begun 17:50:43.368 → activated 17:50:43.414 → completion claimed + machine teardown begun/ready (elapsedMs=0) 17:50:54.0x → summary holds → first genuine tap ~17:51:43 produces WARNING id=431; all 50 taps (ids 431–480) produce one AUTHORITY_REJECTED each, with zero intervening app log entries between teardown-ready and the first rejection (the drift is silent).results/runR4-test04-config-frames.txt,pngs/runR4-test04-autoplay-off/.
Scope notes
- Distinct from [TestFlight] Rest timer controls not working — Pause and +30s unresponsive — iPhone17_1 #1360 (rest-timer +30s/Pause controls unresponsive during Resting) and from Rest-timer rest-control outcome contract + rejection feedback (diagnostics for #1360) #1398's rejection-feedback diagnostics — this seam is the summary continue entry into
installInitialRestPlan, before any rest control exists. - Distinct from Set Summary (unlimited) + per-set rest times: "Next Set" stuck on first set, then jumps to End Routine #656 (closed): that report covered per-set rest times in Single Exercise mode jumping to End Routine; this report is a hard
AUTHORITY_REJECTEDon the very first continue under Manual summary on currentmain. - Simulator evidence only; no physical hardware involved or needed.
Activity
9thLevelSoftware commentedon Nov 18, 2026
Status update — diagnosis, instrumentation and fix PR
What the capture evidence pins down (runR4-test04):
AUTHORITY_REJECTEDat every tap comes fromhasCompletionRestAuthority— but the same check passed when the completion job installed the rest plan at set-completion time (no install warning at completion in the connection log; the plan is installed while the summary is held).elapsedMs=0) and the first rejection (17:51:43.568), and zerotransition=suppressedentries in the entire run — so everyhasExpectedAuthoritylease gate passed andexecutionGuard.isCurrent(completion.lease)held for the full 24 minutes. That also proves no successor execution ever started — the drift is not a workout advance.DWSMTestHarness.Instrumentation (this PR):
hasCompletionRestAuthoritynow emits a privacy-safePHX-CAPTURE-LOGline naming the rejecting conjunct (conjunct=lease_not_current | profile_id | live_routine_positionwith index values), and a second line fires when the raw mirror flows drifted but the anchored position still accepted the transition (Rest transition live mirror drifted; entered position still authoritative, with identity/current/entered coordinates). The next simulator run names the drifting coordinate directly — even though the flow now proceeds.Fix (this PR): the rest-transition authority's live-position check no longer trusts the raw mirror flows (
currentRoutineId/currentRoutineSessionId/_currentExerciseIndex/_currentSetIndex) — exactly what drifts silently — and instead anchors on the loaded routine (id + exercise-id at the source index) and the last explicitly enteredRoutineFlowState.SetReadyposition, which every legitimate position transition writes atomically with the index flows. Lease currency, the completion claim, plan/document source coherence, cleanup fences and terminal supersession are unchanged and still reject stale completions (regression test: a genuineSetReady(1, 0)successor transition still rejects the superseded completion). The same anchor is applied at the duplicated raw-coordinate blocks inhasRestTransitionAuthorityIgnoringReadyProfile,hasPersistedRestTimerDispatchAuthorityLockedandconsumeNormalTransitionAndDispatchAwait, andstartNextSetOrExerciseFornow classifies entry boundaries from the anchored position (a drifted exercise-index mirror otherwise mis-classifies the boundary and strands the summary).Likely shared root cause with #1360: the dead
+30s/Pauserest controls run throughmutatePlanOwnedRest→hasRestTransitionAuthority, the same live-coordinate gates that die under this drift. If the instrumentation names the drift, #1360's remaining symptom should be re-tested against this fix.PR opened: #1414 (head f040282) with
Fixes #1413. Not merged by design — the merge gate isphoenix-rca. Full CI unit gate green on the exact head (6024 tests, 0 failures), including the #1398Issue1360RestControlOutcomeTestsuite (thePostWriteDriftcontract is preserved — the drift tolerance is scoped to the held-SetSummary context only).9thLevelSoftware commentedon Nov 18, 2026
RCA — #1413 Manual "Next Set" frozen /
AUTHORITY_REJECTED(phoenix-rca)Conclusion (high confidence, verified by execution): The first Next Set tap on a held Manual summary succeeds, and that success is the "silent drift". It advances the routine coordinates and enters
RoutineFlowState.SetReady, but it never publishesWorkoutState.Idle.ActiveWorkoutScreennavigates to SetReady only whenworkoutStateis notSetSummary, so the Set Summary card stays on screen. Every later tap re-entersproceedFromSummarywith the same claimed completion, whose identity is still at the completed set.hasCompletionRestAuthoritythen fails its_currentSetIndexconjunct and logsAUTHORITY_REJECTED, forever. The authority check is doing its job. The defect is the missing state publication on the manual successor path.PR #1414 (head
f0402823) does not fix this mechanism. Details and execution evidence are below.Evidence used
REPRODUCED, deterministic.Rest transition install failed reason=AUTHORITY_REJECTED(ids 431–480). Zerotransition=suppressedentries. Pre- and post-tap screenshots are byte-identical.Issue1413ManualNextSetReproTest(:shared:testAndroidHostTest), on a 2-set entry: tap 1 →routineFlowState=SetReady(0,1)whileWorkoutStatestaysSetSummary. Tap 2 →AuthorityRejected, conjunctsetIndex(coordinator=1, identity=0).startNextSetOrExerciseFor. It writes_currentSetIndexandRoutineFlowState.SetReadywithout starting an execution and without logging.Call chain (main
ca2fefe1)SettingsManager.kt:140:autoplayEnabled = summaryCountdownSeconds != 0, so Manual means autoplay is off.DefaultWorkoutSessionManager.proceedFromSummaryFor(~1361–1374): for a routine completion with aroutineIdentity, this is the install-first branch. It callsactiveSessionEngine.startRestTimer(completion)and thenreturn@launch. That bypasses the legacy autoplay-off branch (~1453–1497), which writesWorkoutState.IdlebeforeenterSetReady(the Set Summary (unlimited) + per-set rest times: "Next Set" stuck on first set, then jumps to End Routine #656 fix).ActiveSessionEngine.startRestTimerFor(12502+):installInitialRestPlan→Installed(NormalAdvance), and the plan is dispatched immediately because it is a NormalAdvance. ThenstartNextSetOrExerciseFor:_currentExerciseIndex/_currentSetIndexto the successor (13587–13588).!deferManualStart(13692–13712): both callstartWorkoutOrSetReady(lease, autoplay=false)(13464–13471), which only callsflowDelegate.enterSetReady(...).WorkoutState.Idle.deferManualStartsame-exercise arm (13713–13731) does. Its comment documents this exact strand: "ActiveWorkoutScreen only navigates to SetReady when workoutState is Idle. Leaving Resting/SetSummary after SetReady setup strands the user on the rest/summary UI."ActiveWorkoutScreen.kt(phoneMain, 383–404):isWorkoutActiveincludesSetSummary, so the SetReady navigation never fires.SetSummary, andclaimedCompletionstill has identity (0,0). IninstallInitialRestPlan(13150+),hasCompletionRestAuthority(13302–13315) runs before the idempotent already-installed short-circuit. It fails on_currentSetIndex(1) != identity.setIndex(0)→AuthorityRejected→ the WARNING at 13232.startRestTimerForthen returns silently.Why the #1394 contract test passes: its entries have 1 set each, so the boundary is a same-exercise entry change with autoplay off. That takes the
deferManualStartarm, which does write Idle. The bug shows up on every other Manual-summary routine progression: the next set within an entry, and a distinct-exercise boundary.Blast radius: every Manual ("Set summary duration = Manual") routine progression except adjacent same-exercise entries. The workout freezes after the first completed set. Severity: high.
advanceToNextSetInSingleExerciseis not affected, because it always callsstartWorkoutand never enters SetReady. The otherenterSetReadysites (2522, 3932, 11570) already publish Idle next to the call.PR #1414 does not resolve this (executed at head
f0402823)I ran the recreation's
Issue1413ManualNextSetReproTestagainst the PR head. Result: 7 tests, 1 failure.manual next set after multi-set first entry advances to the second setstill fails with "the tap at +48s on a multi-set entry must advance out of the summary".AUTHORITY_REJECTEDsignature still reproduces.Why: after tap 1, both the raw indices and the entered
SetReadyare at the successor (0,1). The PR's anchor still disagrees with identity (0,0), so the rejection stands, and the missing Idle write is untouched. The PR's own tests use 1-set entries (the healthydeferManualStartarm) and inject synthetic mirror drift, so they never exercise the failing arm. The PR also relaxes the live-position authority while a summary is held. That weakens a stale-completion guard to tolerate a drift whose writer turns out to be the legitimate tap-1 transition. Separately, itsiOS Test Target Compilecheck is failing.Fix direction (binding for the fixer)
ActiveSessionEngine.startNextSetOrExerciseFor, in both!autoplaymanual arms (theisChangingExercise && !deferManualStartarm and the within-entryelsearm), publishcoordinator._workoutState.value = WorkoutState.IdleafterenterSetReadyandapplyPendingRestRackSelection(nextExIdx to nextSetIdx). Guard the write withhasExpectedAuthority(lease, ...), mirroring 13729–13731. Doing it instartWorkoutOrSetReadyis acceptable only if Idle is still published after the rack-selection application.ca2fefe1. The RED test passes, and these suites stay green:Issue1394ConsecutiveDuplicateAutoAdvanceTest(27/27),Issue1360RestControlOutcomeTest(10/10),Issue1360RestTimerControlsTest(4/4),Issue1360RestTimerUiTest,DropSetRestTransitionTest(13/13),DWSMRoutineFlowTest(14/14),Issue656ReproTest, and the SetReady wiring tests.SetSummaryand is ignored.installInitialRestPlan, an idempotent retry for the sameexecutionId+logicalSetKeywhose plan was already installed and consumed should be a quiet no-op, not a WARNING. Do not loosenhasCompletionRestAuthorityfor genuinely stale completions.Acceptance criteria
WorkoutStateisIdle(notSetSummary),routineFlowState == SetReady(0,1),_currentSetIndex == 1, and the UI navigates to SetReady.SetReady(1,0).Rest transition install failedwarning.genuine successor transition still rejects the superseded completionand the [TestFlight] Rest timer controls not working — Pause and +30s unresponsive — iPhone17_1 #1360PostWriteDriftcontract stay green.Regression test target
Add
Issue1413ManualNextSetReproTest-style host tests inshared/src/commonTest/.../presentation/manager/usingDWSMTestHarnesswithsetActiveSummaryCountdownSeconds(0). Cover the 2-set entry case, the distinct-exercise boundary, and a second tap producing no warning. These tests must fail on main without the fix (verified: they do).Non-goals
ActiveWorkoutScreen.Scratch probe diff and test runs: local RCA artifacts (phoenix-rca). Issue state is unchanged; it closes only via the fix PR's
Fixes #1413.9thLevelSoftware commentedon Nov 18, 2026
Architecture review: #1413 (Manual Set Summary, Next Set rejected with AUTHORITY_REJECTED)
Verdict: APPROVED, subject to the binding constraints below. I checked the RCA fix direction against
main@ca2fefe1.What I checked
ActiveSessionEngine.startNextSetOrExerciseFor: both manual successor arms callstartWorkoutOrSetReady(lease, autoplay=false). That only callsenterSetReadyand never publishesWorkoutState.Idle. One arm handles a distinct exercise withoutdeferManualStart(~13692-13712). The other handles a later set inside the same entry (~13732-13744). Only thedeferManualStartarm (13713-13731) writes Idle, and its comment describes this exact strand.hasCompletionRestAuthority(13302-13315) compares the frozen completion identity with the live_currentSetIndex. After the first tap moves the index, every retry tap fails this check by design. The check is correct; the stranded SetSummary is what keeps it firing.advanceToNextSetInSingleExercise(13391+) always auto-starts, so it does not have this gap. No change is needed there.issue-1413-idle-probe.diff(6 lines, both arms,hasExpectedAuthority-guarded) is the right fix shape.Architectural assessment
ActiveWorkoutScreenalready expects.deferManualStartarm and the legacy DWSM autoplay-off branch from Set Summary (unlimited) + per-set rest times: "Next Set" stuck on first set, then jumps to End Routine #656.Binding constraints for the fix
WorkoutState.Idleat the two call sites, AFTERenterSetReadyandapplyPendingRestRackSelection(nextExIdx to nextSetIdx), guarded byhasExpectedAuthority(lease, ...). Do not move the write intostartWorkoutOrSetReadyahead of the rack-selection apply, because SetReady must see rest-screen edits first.hasCompletionRestAuthorityorexecutionGuard. The anchored-position authority change in PR fix(workout): publish Idle on manual summary continue so SetReady can navigate (#1413) #1414 is not an acceptable fix for this mechanism. Rework fix(workout): publish Idle on manual summary continue so SetReady can navigate (#1413) #1414 to this direction (or replace it), keepFixes #1413, and drop the authority relaxation unless it is proven independently necessary with its own RED test.executionId+logicalSetKeycan become a quiet no-op. If you do this, it must stay ordered so stale or superseded completions are still rejected. Do not move the idempotent check ahead of the authority check for genuinely different completions.deferManualStartarm unchanged.Issue1413ManualNextSetReproTest, covering a 2-set entry and a distinct-exercise boundary) must fail on main and pass with the fix. Issue1394 (27), Issue656Repro, DropSetRestTransition, DWSMRoutineFlow and the [TestFlight] Rest timer controls not working — Pause and +30s unresponsive — iPhone17_1 #1360 rest-control/PostWriteDrift suites must stay green. New commonTest names must be valid for Kotlin/Native (no,in backtick names), soiOS Test Target Compilepasses.Rest transition install failedwarning on later taps, is sufficient.Revert "fix(workout): anchor rest-transition authority to the entered…
fix(workout): publish Idle on manual summary continue so SetReady can…