diff --git a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingCoachLibrary.cpp b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingCoachLibrary.cpp index 039a728..fcf2ee1 100644 --- a/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingCoachLibrary.cpp +++ b/UnrealHyperTwist/Source/UnrealHyperTwist/Private/HyperTwistTraining/HyperTwistTrainingCoachLibrary.cpp @@ -1346,6 +1346,16 @@ FHyperTwistCoachBrief UHyperTwistTrainingCoachLibrary::DeriveCoachFollowUpBrief( || OutcomeSummary.RecognitionAttemptCount > 0; const bool bHasDeferredLaunchCases = OutcomeSummary.DeferredLaunchCaseIds.Num() > 0; const bool bHasLaunchedFollowUpCases = OutcomeSummary.FollowUpCaseIds.Num() > 0; + const bool bDeferredOverflowContinuationSource = + HyperTwistTrainingCoachLibraryInternal::IsDeferredOverflowDashboardHandoffSource( + ActionPlan.PreferredCoachHandoffSourceLabel + ); + const FString DeferredOverflowSourceLabel = + bDeferredOverflowContinuationSource + ? HyperTwistTrainingCoachLibraryInternal::DescribeCoachMemorySourceLabel( + ActionPlan.PreferredCoachHandoffSourceLabel + ) + : TEXT("none"); Brief.DeferredLaunchCaseCount = OutcomeSummary.DeferredLaunchCaseIds.Num(); Brief.bNeedsDeferredLaunchRecovery = bHasDeferredLaunchCases; Brief.bHasTightenedLaunchOverflow = @@ -1410,9 +1420,39 @@ FHyperTwistCoachBrief UHyperTwistTrainingCoachLibrary::DeriveCoachFollowUpBrief( else if (bHasDeferredLaunchCases) { Brief.FocusLane = EHyperTwistCoachFocusLane::ReviewBacklog; - Brief.Headline = TEXT("Resume the deferred coach slice excluded by the tighter launch budget"); - Brief.PrimaryActionLabel = TEXT("resume_deferred_launch_slice"); - Brief.SuggestedMode = ActionPlan.SuggestedMode; + switch (ActionPlan.PreferredCoachHandoffKind) + { + case EHyperTwistTrainingCoachHandoffKind::Queue: + Brief.Headline = bDeferredOverflowContinuationSource + ? TEXT("Resume the narrowed queued coach slice before broadening again") + : TEXT("Resume the deferred coach slice excluded by the tighter launch budget"); + Brief.PrimaryActionLabel = bDeferredOverflowContinuationSource + ? TEXT("resume_narrowed_queue_slice") + : TEXT("resume_deferred_launch_slice"); + break; + case EHyperTwistTrainingCoachHandoffKind::Recommended: + Brief.Headline = bDeferredOverflowContinuationSource + ? TEXT("Restore the narrowed recommended coach slice before broadening again") + : TEXT("Resume the deferred coach slice excluded by the tighter launch budget"); + Brief.PrimaryActionLabel = bDeferredOverflowContinuationSource + ? TEXT("restore_narrowed_recommended_slice") + : TEXT("resume_deferred_launch_slice"); + break; + case EHyperTwistTrainingCoachHandoffKind::FollowUp: + default: + Brief.Headline = bDeferredOverflowContinuationSource + ? TEXT("Continue the narrowed follow-up coach slice before broadening again") + : TEXT("Resume the deferred coach slice excluded by the tighter launch budget"); + Brief.PrimaryActionLabel = bDeferredOverflowContinuationSource + ? TEXT("continue_narrowed_follow_up_slice") + : TEXT("resume_deferred_launch_slice"); + break; + } + Brief.SuggestedMode = bDeferredOverflowContinuationSource + ? (Brief.bPreferRecognitionReplayReview + ? EHyperTwistTrainingDeliveryMode::RecognitionAssisted + : EHyperTwistTrainingDeliveryMode::CoachReviewed) + : ActionPlan.SuggestedMode; Brief.SuggestedSelectionPolicy = EHyperTwistTrainingSelectionPolicy::Scripted; } else if (Brief.bPreferRecognitionReplayReview) @@ -1453,6 +1493,14 @@ FHyperTwistCoachBrief UHyperTwistTrainingCoachLibrary::DeriveCoachFollowUpBrief( *Brief.Headline ); } + if (bDeferredOverflowContinuationSource && bHasDeferredLaunchCases) + { + Brief.Headline = FString::Printf( + TEXT("%s (%s)"), + *Brief.Headline, + *DeferredOverflowSourceLabel + ); + } FHyperTwistCoachSignal FollowUpSignal = HyperTwistTrainingCoachLibraryInternal::MakeSignal( Brief.PrimaryActionLabel, @@ -1460,7 +1508,7 @@ FHyperTwistCoachBrief UHyperTwistTrainingCoachLibrary::DeriveCoachFollowUpBrief( Brief.PriorityScore, Brief.Headline, FString::Printf( - TEXT("followUpCases=%d, deferredLaunchCases=%d, success=%d, failure=%d, timeout=%d, dnf=%d, launchBudget=%s, plannedLaunchCases=%d, requestedLaunchCases=%d, launchBudgetReason=%s"), + TEXT("followUpCases=%d, deferredLaunchCases=%d, success=%d, failure=%d, timeout=%d, dnf=%d, launchBudget=%s, plannedLaunchCases=%d, requestedLaunchCases=%d, launchBudgetReason=%s, preferredHandoff=%s, preferredHandoffSource=%s, deferredOverflowContinuation=%d"), Brief.FocusCaseIds.Num(), OutcomeSummary.DeferredLaunchCaseIds.Num(), OutcomeSummary.SuccessCount, @@ -1474,7 +1522,12 @@ FHyperTwistCoachBrief UHyperTwistTrainingCoachLibrary::DeriveCoachFollowUpBrief( OutcomeSummary.RequestedLaunchCaseCount, OutcomeSummary.LaunchBudgetReasonLine.IsEmpty() ? TEXT("none") - : *OutcomeSummary.LaunchBudgetReasonLine), + : *OutcomeSummary.LaunchBudgetReasonLine, + *HyperTwistTrainingCoachLibraryInternal::DescribeCoachHandoffKind( + ActionPlan.PreferredCoachHandoffKind + ), + *DeferredOverflowSourceLabel, + bDeferredOverflowContinuationSource ? 1 : 0), Brief.SuggestedMode, Brief.SuggestedSelectionPolicy ); @@ -1575,6 +1628,40 @@ FHyperTwistCoachSessionQueueSummary UHyperTwistTrainingCoachLibrary::DeriveCoach Entry.FocusCaseIds = Brief.FocusCaseIds; Entry.bRequiresFollowUp = bRequiresFollowUp; Entry.bRequiresArchiveRetentionTuning = bRequiresArchiveRetentionTuning; + const bool bDeferredOverflowContinuationPreferred = + HyperTwistTrainingCoachLibraryInternal::IsDeferredOverflowDashboardHandoffSource( + CoachMemorySnapshot.PreferredCoachHandoffSourceLabel + ); + const bool bDeferredOverflowQueueContinuation = + bDeferredOverflowContinuationPreferred + && CoachMemorySnapshot.PreferredCoachHandoffKind + == EHyperTwistTrainingCoachHandoffKind::Queue + && Brief.bNeedsDeferredLaunchRecovery; + const bool bDeferredOverflowFollowUpContinuation = + bDeferredOverflowContinuationPreferred + && CoachMemorySnapshot.PreferredCoachHandoffKind + == EHyperTwistTrainingCoachHandoffKind::FollowUp + && SourceLabel == TEXT("follow-up-brief"); + const bool bDeferredOverflowRecommendedContinuation = + bDeferredOverflowContinuationPreferred + && CoachMemorySnapshot.PreferredCoachHandoffKind + == EHyperTwistTrainingCoachHandoffKind::Recommended + && SourceLabel == TEXT("primary-brief"); + if (bDeferredOverflowQueueContinuation + || bDeferredOverflowFollowUpContinuation + || bDeferredOverflowRecommendedContinuation) + { + const FString ContinuationLabel = bDeferredOverflowQueueContinuation + ? TEXT("queue-first narrowed continuation") + : (bDeferredOverflowFollowUpContinuation + ? TEXT("narrowed follow-up continuation") + : TEXT("narrowed recommended continuation")); + Entry.Headline = FString::Printf( + TEXT("%s (%s)"), + *Entry.Headline, + *ContinuationLabel + ); + } if (CoachMemorySnapshot.PreferredLaunchBudgetBias != 0 && (CoachMemorySnapshot.BroadenedLaunchBudgetHistoryCount > 0 || CoachMemorySnapshot.TightenedLaunchBudgetHistoryCount > 0))