feat: complete task board workflow gates
This commit is contained in:
@@ -45,6 +45,94 @@ public class AgentServiceTests
|
||||
Assert.Null(agent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetAllowedAgentIdsAsync_IncludesProductOwnerAndProgrammerFast()
|
||||
{
|
||||
var configPath = CreateAgentConfigFile();
|
||||
var config = CreateConfiguration(configPath);
|
||||
var runtime = new FakeRuntime();
|
||||
var service = new AgentService(config, runtime);
|
||||
|
||||
var ids = await service.GetAllowedAgentIdsAsync(CancellationToken.None);
|
||||
|
||||
Assert.Contains("product-owner", ids);
|
||||
Assert.Contains("programmer-fast", ids);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetAgentAsync_ProgrammerFast_UsesPrimaryModelAndDeveloperRole()
|
||||
{
|
||||
var configPath = CreateAgentConfigFile();
|
||||
var config = CreateConfiguration(configPath);
|
||||
var runtime = new FakeRuntime();
|
||||
var service = new AgentService(config, runtime);
|
||||
|
||||
var agent = await service.GetAgentAsync("programmer-fast", CancellationToken.None);
|
||||
|
||||
Assert.NotNull(agent);
|
||||
Assert.Equal("Developer", agent.Role);
|
||||
Assert.Equal("openai/gpt-5.3-codex-spark", agent.Model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetAgentAsync_LegacyStringModel_IsSupported()
|
||||
{
|
||||
var configPath = CreateAgentConfigFile(
|
||||
"""
|
||||
{
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"workspace": "/workspace/default",
|
||||
"model": "deepseek/deepseek-v4-flash"
|
||||
},
|
||||
"list": [
|
||||
{
|
||||
"id": "iris",
|
||||
"name": "iris",
|
||||
"model": "openai/gpt-5.5"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
""");
|
||||
var config = CreateConfiguration(configPath);
|
||||
var service = new AgentService(config, new FakeRuntime());
|
||||
|
||||
var agent = await service.GetAgentAsync("iris", CancellationToken.None);
|
||||
|
||||
Assert.NotNull(agent);
|
||||
Assert.Equal("openai/gpt-5.5", agent!.Model);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetAgentAsync_ObjectModel_InheritsStringDefaultModel()
|
||||
{
|
||||
var configPath = CreateAgentConfigFile(
|
||||
"""
|
||||
{
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"workspace": "/workspace/default",
|
||||
"model": "openai/gpt-5.5-mini"
|
||||
},
|
||||
"list": [
|
||||
{
|
||||
"id": "reviewer",
|
||||
"name": "reviewer"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
""");
|
||||
var config = CreateConfiguration(configPath);
|
||||
var service = new AgentService(config, new FakeRuntime());
|
||||
|
||||
var agent = await service.GetAgentAsync("reviewer", CancellationToken.None);
|
||||
|
||||
Assert.NotNull(agent);
|
||||
Assert.Equal("openai/gpt-5.5-mini", agent!.Model);
|
||||
}
|
||||
|
||||
private static IConfiguration CreateConfiguration(string configPath)
|
||||
=> new ConfigurationBuilder()
|
||||
.AddInMemoryCollection(new Dictionary<string, string?>
|
||||
@@ -53,10 +141,10 @@ public class AgentServiceTests
|
||||
})
|
||||
.Build();
|
||||
|
||||
private static string CreateAgentConfigFile()
|
||||
private static string CreateAgentConfigFile(string? json = null)
|
||||
{
|
||||
var path = Path.Combine(Path.GetTempPath(), $"agent-config-{Guid.NewGuid():N}.json");
|
||||
File.WriteAllText(path,
|
||||
File.WriteAllText(path, json ??
|
||||
"""
|
||||
{
|
||||
"agents": {
|
||||
@@ -69,19 +157,33 @@ public class AgentServiceTests
|
||||
"list": [
|
||||
{
|
||||
"id": "iris",
|
||||
"name": "iris"
|
||||
"name": "iris",
|
||||
"model": { "primary": "openai/gpt-5.5" }
|
||||
},
|
||||
{
|
||||
"id": "product-owner",
|
||||
"name": "product-owner",
|
||||
"model": { "primary": "openai/gpt-5.5" }
|
||||
},
|
||||
{
|
||||
"id": "programmer",
|
||||
"name": "programmer"
|
||||
"name": "programmer",
|
||||
"model": { "primary": "openai/gpt-5.4" }
|
||||
},
|
||||
{
|
||||
"id": "programmer-fast",
|
||||
"name": "programmer-fast",
|
||||
"model": { "primary": "openai/gpt-5.3-codex-spark" }
|
||||
},
|
||||
{
|
||||
"id": "reviewer",
|
||||
"name": "reviewer"
|
||||
"name": "reviewer",
|
||||
"model": { "primary": "openai/gpt-5.5" }
|
||||
},
|
||||
{
|
||||
"id": "architekt",
|
||||
"name": "architekt"
|
||||
"name": "architekt",
|
||||
"model": { "primary": "openai/gpt-5.5" }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user