Merge branch 'claudedo/f518b71f990643cfaf73174e8617b2b5'

Drop the unused deferredUntil parameter the branch added to HandoffRequested: the worker still sends three args, so the four-arg client handler would never bind. The reset time already arrives via HandlerHandoffDeferred.
This commit is contained in:
mika kuns
2026-09-29 08:54:14 +02:00
9 changed files with 67 additions and 0 deletions
@@ -25,6 +25,7 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
private readonly Action<string, IReadOnlyList<string>, string> _onHandoffRequested;
private readonly Action<string, IReadOnlyList<string>> _onListHandlerStartRequested;
private readonly Action<string, string> _onHandlerUsageWarning;
private readonly Action<string, DateTimeOffset> _onHandlerHandoffDeferred;
// Embedded ConPTY sessions (task-based only) — a manual cockpit detached from the
// review/merge/status machinery.
@@ -122,6 +123,8 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
_worker.ListHandlerStartRequestedEvent += _onListHandlerStartRequested;
_onHandlerUsageWarning = (taskId, message) => { _ = WarnHandlerSessionAsync(taskId, message); };
_worker.HandlerUsageWarningEvent += _onHandlerUsageWarning;
_onHandlerHandoffDeferred = (taskId, dueAt) => UpdateHandlerSessionTitleAsync(taskId, dueAt);
_worker.HandlerHandoffDeferredEvent += _onHandlerHandoffDeferred;
_ = RefreshQueueAsync();
_ = RefreshSessionTargetsAsync();
@@ -556,6 +559,17 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
ErrorReported?.Invoke(Loc.T("missionControl.usageWarningNotDelivered"));
}
// A handler session's handoff is deferred due to usage limits: update the pane title to show
// the reset time. No pane = nothing to update, not an error.
private void UpdateHandlerSessionTitleAsync(string taskId, DateTimeOffset dueAt)
{
if (string.IsNullOrEmpty(taskId)) return;
if (ConPtySessions.FirstOrDefault(s => s.TaskId == taskId) is not { } pane) return;
var suffix = Loc.T("missionControl.deferredHandoffTitleSuffix", dueAt.LocalDateTime.ToString("HH:mm"));
pane.DisplayTitle += $" — {suffix}";
}
// Wires a freshly built pane and shows it immediately — the pane resolves its own launch spec,
// so the tile is on screen (spinner running) while the worker is still preparing the worktree.
private void AddConPtyPane(ConPtyPaneViewModel pane, int? index = null)
@@ -725,6 +739,7 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
_worker.SessionHandoffRequestedEvent -= OpenSessionHandoff;
_worker.ListHandlerStartRequestedEvent -= _onListHandlerStartRequested;
_worker.HandlerUsageWarningEvent -= _onHandlerUsageWarning;
_worker.HandlerHandoffDeferredEvent -= _onHandlerHandoffDeferred;
ConPtySessions.CollectionChanged -= OnConPtySessionsChanged;
Panes.CollectionChanged -= OnPanesChanged;
foreach (var c in ConPtySessions.ToList())