fix(ui): refresh the run session id live, close the stale handoff pane

A task selected before its run started kept LatestRunSessionId null, so the
roadblock reply box and Continue stayed dead until it was re-selected.

The handoff left the Phase 1-2 tile open so its last message could be read, but
its process is gone by then and the terminal renders empty -- a dead
placeholder. It is closed on handoff now.

Also drops the WARN flood from worktree cleanup (already-unregistered worktree
and already-deleted branch are normal outcomes, not failures) and replaces the
fixed sleep in UsageGate_TransitionLogging_FiresOncePerChange with the polling
helper that already sits three lines below it in the same file.
This commit is contained in:
mika kuns
2026-08-06 10:20:54 +02:00
parent 56f7d64f07
commit f106c890b3
5 changed files with 79 additions and 22 deletions
@@ -459,15 +459,17 @@ public sealed class QueueServiceTests : IDisposable
using var cts = new CancellationTokenSource();
await service.StartAsync(cts.Token);
// Several backstop ticks (50ms interval) all observe the same blocked state.
await Task.Delay(200);
cts.Cancel();
// Wait for the first backstop tick to log the transition, then keep observing: every
// further tick (50ms interval) sees the same blocked state and must stay silent. A fixed
// sleep was flaky here — on a loaded machine no tick fit inside the window at all.
await AssertStableCountAsync(CountWarnCalls, 1);
var warnCalls = _hubContext.Proxy.Calls
.Count(c => c.Method == "WorkerLog" && (WorkerLogLevel)c.Args[1]! == WorkerLogLevel.Warn);
Assert.Equal(1, warnCalls);
cts.Cancel();
}
private int CountWarnCalls() => _hubContext.Proxy.Calls
.Count(c => c.Method == "WorkerLog" && (WorkerLogLevel)c.Args[1]! == WorkerLogLevel.Warn);
// Polls until `read()` reaches `expected` (or times out), then waits a further grace period
// to make sure the count doesn't keep climbing past it — needed because slot fills happen
// concurrently and a fixed sleep is either flaky (too short) or slow (too long).