Merge branch 'claudedo/0a185f8e823d42fc9a5b97c5eb91c616'

This commit is contained in:
Mika Kuns
2026-09-02 15:30:04 +02:00
4 changed files with 97 additions and 1 deletions
+14
View File
@@ -37,6 +37,20 @@ public sealed class HandoffRoundTracker
return (state.Count, state.Sealed);
}
// Read-only budget lookup for a handler task that hasn't (yet) called HandoffListHandler --
// Round/Remaining/Final all report their untouched defaults instead of throwing, since "no
// handoff yet" is a normal state, not an error.
public sealed record Status(int Round, int Remaining, bool Final);
public Status GetStatus(string taskId)
{
if (!_states.TryGetValue(taskId, out var state))
return new Status(0, MaxHandoffs, false);
lock (state)
return new Status(state.Count, Math.Max(0, MaxHandoffs - state.Count), state.Sealed);
}
public Result Register(string taskId, string nextPhase)
{
var state = _states.GetOrAdd(taskId, _ => new TaskState());