feat(worker): let Claude set the cheapest model per generated task via MCP
AddTask, planning CreateChildTask, and SuggestImprovement now accept an optional alias-validated model (haiku/sonnet/opus; blank = inherit) so the model is chosen at creation time instead of a follow-up set_task_config call. The planning, system, and improvement prompts instruct Claude to pick the cheapest capable model (haiku < sonnet < opus). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -729,6 +729,42 @@ public sealed class ExternalMcpServiceTests : IDisposable
|
||||
Assert.Equal(TaskStatus.Done, reloaded!.Status);
|
||||
}
|
||||
|
||||
// ── AddTask model override ────────────────────────────────────────────────
|
||||
|
||||
[Fact]
|
||||
public async Task AddTask_NoModel_LeavesModelNull()
|
||||
{
|
||||
var listId = await SeedListAsync();
|
||||
var sut = NewService();
|
||||
|
||||
var dto = await sut.AddTask(listId, "t", cancellationToken: CancellationToken.None);
|
||||
|
||||
var loaded = await _tasks.GetByIdAsync(dto.Id);
|
||||
Assert.Null(loaded!.Model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AddTask_PersistsNormalizedModel()
|
||||
{
|
||||
var listId = await SeedListAsync();
|
||||
var sut = NewService();
|
||||
|
||||
var dto = await sut.AddTask(listId, "t", model: "HAIKU", cancellationToken: CancellationToken.None);
|
||||
|
||||
var loaded = await _tasks.GetByIdAsync(dto.Id);
|
||||
Assert.Equal("haiku", loaded!.Model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AddTask_RejectsUnknownModel()
|
||||
{
|
||||
var listId = await SeedListAsync();
|
||||
var sut = NewService();
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentException>(
|
||||
() => sut.AddTask(listId, "t", model: "gpt4", cancellationToken: CancellationToken.None));
|
||||
}
|
||||
|
||||
// ── ContinueTask validation ───────────────────────────────────────────────
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user