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:
mika kuns
2026-08-05 11:33:16 +02:00
parent 1ee21b560d
commit 65db1cdefa
7 changed files with 103 additions and 13 deletions
@@ -111,8 +111,8 @@ public sealed class PlanningEndToEndTests : IDisposable
// Wire the ambient context so _svc reads the correct parent
_httpContext.Items["PlanningContext"] = new PlanningMcpContext { ParentTaskId = parent.Id };
await _svc.CreateChildTask("sub 1", null, null, null, CancellationToken.None);
await _svc.CreateChildTask("sub 2", null, null, null, CancellationToken.None);
await _svc.CreateChildTask("sub 1", null, null, null, cancellationToken: CancellationToken.None);
await _svc.CreateChildTask("sub 2", null, null, null, cancellationToken: CancellationToken.None);
var count = await _svc.Finalize(true, CancellationToken.None);
Assert.Equal(2, count);
@@ -155,9 +155,9 @@ public sealed class PlanningEndToEndTests : IDisposable
await _manager.StartAsync(parent.Id, CancellationToken.None);
_httpContext.Items["PlanningContext"] = new PlanningMcpContext { ParentTaskId = parent.Id };
await _svc.CreateChildTask("c1", null, null, null, CancellationToken.None);
await _svc.CreateChildTask("c2", null, null, null, CancellationToken.None);
await _svc.CreateChildTask("c3", null, null, null, CancellationToken.None);
await _svc.CreateChildTask("c1", null, null, null, cancellationToken: CancellationToken.None);
await _svc.CreateChildTask("c2", null, null, null, cancellationToken: CancellationToken.None);
await _svc.CreateChildTask("c3", null, null, null, cancellationToken: CancellationToken.None);
var kidsBefore = await _tasks.GetChildrenAsync(parent.Id);
var firstChildId = kidsBefore[0].Id;