feat(planning): let CreateChildTask set maxTurns on child tasks
Planning sessions could already steer a subtask's model but not its turn budget, so a visibly large subtask would still die at the global default turn limit. maxTurns is optional (default null = inherit list/global default, matching model); 0/negative values are rejected as invalid input, consistent with the existing model-alias validation.
This commit is contained in:
@@ -276,8 +276,12 @@ public sealed class TaskRepository
|
||||
string? commitType,
|
||||
string? createdBy = null,
|
||||
string? model = null,
|
||||
int? maxTurns = null,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
if (maxTurns.HasValue && maxTurns.Value <= 0)
|
||||
throw new ArgumentException($"maxTurns must be positive, got {maxTurns.Value}.");
|
||||
|
||||
// AsNoTracking: SetPlanningStartedAsync mutates via ExecuteUpdate which
|
||||
// bypasses the change tracker; a tracked Find would return stale data.
|
||||
var parent = await _context.Tasks.AsNoTracking()
|
||||
@@ -303,6 +307,7 @@ public sealed class TaskRepository
|
||||
SortOrder = (maxSort ?? -1) + 1,
|
||||
CreatedBy = createdBy,
|
||||
Model = ModelRegistry.NormalizeAlias(model),
|
||||
MaxTurns = maxTurns,
|
||||
};
|
||||
_context.Tasks.Add(child);
|
||||
await _context.SaveChangesAsync(ct);
|
||||
|
||||
Reference in New Issue
Block a user