Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@
Snapshot(tickets, planTickets, planTasks, sessions),
moves.Select(m => new OrchestratorMove(m.Id, KindOf(m.Action), IssueOf(m.Action), m.Action.Why)).ToList(),
stuck, freeSlots, recent);
var decision = await sp.GetRequiredService<IAutopilotOrchestrator>().DecideAsync(brief, ct).ConfigureAwait(false);
// Metrics first: the decision's LLM call is an agent run in Insights like every other agent's.
OrchestratorDecision decision;
var decidedAt = DateTimeOffset.UtcNow;
using (var calls = AgentOs.Domain.Llm.LlmCallScope.Begin())
{
decision = await sp.GetRequiredService<IAutopilotOrchestrator>().DecideAsync(brief, ct).ConfigureAwait(false);
await tasks.SaveAgentRunAsync(tenant, member, "Orchestrator", $"Orchestrator · {board.Name}", decidedAt, calls.Calls).ConfigureAwait(false);
}
if (!decision.Ran)
{
if (_agentDown.TryAdd(board.Id, true))
Expand Down Expand Up @@ -142,7 +149,7 @@
foreach (var t in tickets.Where(t => t.Number is not null).OrderBy(t => t.Number))
{
var p = plan.GetValueOrDefault(t.Number!.Value);
sb.Append("#").Append(t.Number).Append(' ').Append(p?.Open == false ? "[closed]" : "[open]")

Check warning on line 152 in src/AgentOs.Web/Services/Orchestration/ProjectOrchestrator.Agent.cs

View workflow job for this annotation

GitHub Actions / Build & Test

Use 'StringBuilder.Append(char)' instead of 'StringBuilder.Append(string)' when the input is a constant unit string (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1834)
.Append(" [").Append(string.Join(", ", t.Labels)).Append(']');
if (p is { DependsOn.Count: > 0 }) { sb.Append(" depends on ").Append(string.Join(", ", p.DependsOn.Select(d => "#" + d))); }
if (p is { HasLiveTask: true }) { sb.Append(" (has a task)"); }
Expand All @@ -151,7 +158,7 @@
sb.Append("\nTasks in progress:\n");
foreach (var task in planTasks)
{
sb.Append("#").Append(task.IssueNumber).Append(' ').Append(task.Status).Append(", fix rounds used ").Append(task.FixRounds).Append('\n');

Check warning on line 161 in src/AgentOs.Web/Services/Orchestration/ProjectOrchestrator.Agent.cs

View workflow job for this annotation

GitHub Actions / Build & Test

Use 'StringBuilder.Append(char)' instead of 'StringBuilder.Append(string)' when the input is a constant unit string (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1834)
foreach (var c in task.OpenChanges)
{
sb.Append(" PR #").Append(c.PrNumber).Append(": checks ").Append(c.Checks).Append(", review ").Append(c.Review)
Expand All @@ -163,7 +170,7 @@
}
foreach (var s in sessions.Where(s => s.Status is "Failed" or "Blocked"))
{
sb.Append("#").Append(s.IssueNumber).Append(' ').Append(s.Status).Append(": ").Append(Short(s.Error ?? "", 300)).Append('\n');

Check warning on line 173 in src/AgentOs.Web/Services/Orchestration/ProjectOrchestrator.Agent.cs

View workflow job for this annotation

GitHub Actions / Build & Test

Use 'StringBuilder.Append(char)' instead of 'StringBuilder.Append(string)' when the input is a constant unit string (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1834)
}
return sb.ToString();
}
Expand Down
Loading