fix(ui): restore turn/token counts on task reload
Turns/Tokens were never populated from history, so a reloaded terminal task showed "0/max". Restore them from the latest task_run.
This commit is contained in:
@@ -536,6 +536,10 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
|
|||||||
var latestRun = await runRepo.GetLatestByTaskIdAsync(row.Id, ct);
|
var latestRun = await runRepo.GetLatestByTaskIdAsync(row.Id, ct);
|
||||||
ct.ThrowIfCancellationRequested();
|
ct.ThrowIfCancellationRequested();
|
||||||
LatestRunSessionId = latestRun?.SessionId;
|
LatestRunSessionId = latestRun?.SessionId;
|
||||||
|
// Restore turn/token counts from the last run so a reloaded terminal task
|
||||||
|
// shows its real turns instead of "0/max".
|
||||||
|
Turns = latestRun?.TurnCount ?? 0;
|
||||||
|
Tokens = (latestRun?.TokensIn ?? 0) + (latestRun?.TokensOut ?? 0);
|
||||||
Monitor.ApplyOutcome(entity.Result, latestRun?.ErrorMarkdown);
|
Monitor.ApplyOutcome(entity.Result, latestRun?.ErrorMarkdown);
|
||||||
|
|
||||||
Monitor.SetTaskId(row.Id);
|
Monitor.SetTaskId(row.Id);
|
||||||
|
|||||||
Reference in New Issue
Block a user