Files
aryx/sidecar/tests/Aryx.AgentHost.Tests/HandoffWorkflowGuidanceTests.cs
T
David KayaandCopilot 805e369b67 refactor: remove legacy patterns system, unify on workflows
Remove the entire patterns domain model, IPC channels, sidecar services,
renderer components, and tests. Sessions now bind exclusively to workflows
via workflowId. Builtin workflows replace builtin patterns.

Backend:
- Make AgentNodeConfig standalone (no longer extends PatternAgentDefinition)
- Add WorkflowOrchestrationMode and WorkflowExecutionDefinition
- Create builtin workflows (single-agent, sequential, concurrent, handoff, group-chat)
- Rewrite session model config helpers for workflow-only
- Remove pattern IPC channels, handlers, and preload bindings
- Merge createSession/createWorkflowSession into single method
- Remove sidecar PatternGraphResolver, PatternValidator, pattern DTOs
- Add workspace migration for legacy sessions (patternId -> workflowId)

Frontend:
- Delete PatternEditor, pattern-graph components, patternGraph lib
- Delete NewSessionModal (session creation uses workflows directly)
- Remove PatternsSection from SettingsPanel
- Update App.tsx, ChatPane, ActivityPanel, Sidebar, RunTimeline,
  AgentConfigFields, InlinePills, sessionActivity to use workflow types
- Delete pattern.ts domain module

78 files changed across backend and frontend.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-06 22:37:00 +02:00

75 lines
3.0 KiB
C#

using Aryx.AgentHost.Contracts;
using Aryx.AgentHost.Services;
namespace Aryx.AgentHost.Tests;
public sealed class HandoffWorkflowGuidanceTests
{
[Fact]
public void CreateWorkflowInstructions_RequiresRealHandoffs()
{
string instructions = HandoffWorkflowGuidance.CreateWorkflowInstructions();
Assert.Contains("explicit handoffs", instructions, StringComparison.OrdinalIgnoreCase);
Assert.Contains("routing or triage agent", instructions, StringComparison.OrdinalIgnoreCase);
Assert.Contains("best specialist", instructions, StringComparison.OrdinalIgnoreCase);
Assert.Contains("Do not inspect files", instructions, StringComparison.OrdinalIgnoreCase);
Assert.Contains("Do not claim that you delegated", instructions, StringComparison.OrdinalIgnoreCase);
Assert.Contains("Do not narrate a handoff", instructions, StringComparison.OrdinalIgnoreCase);
Assert.Contains("own the substantive answer", instructions, StringComparison.OrdinalIgnoreCase);
Assert.Contains("Specialists should complete the substantive work", instructions, StringComparison.OrdinalIgnoreCase);
}
[Fact]
public void CreateForwardReason_UsesTargetSpecialtyAndOwnership()
{
WorkflowNodeDto specialist = new()
{
Id = "agent-handoff-ux",
Kind = "agent",
Label = "UX Specialist",
Config = new WorkflowNodeConfigDto
{
Kind = "agent",
Id = "agent-handoff-ux",
Name = "UX Specialist",
Description = "Handles user experience questions.",
Instructions = "Focus on UX.",
Model = "claude-opus-4.5",
},
};
string reason = HandoffWorkflowGuidance.CreateForwardReason(specialist);
Assert.Contains("Handles user experience questions", reason, StringComparison.OrdinalIgnoreCase);
Assert.Contains("UX Specialist", reason, StringComparison.OrdinalIgnoreCase);
Assert.Contains("substantive response", reason, StringComparison.OrdinalIgnoreCase);
}
[Fact]
public void CreateReturnReason_RestrictsReturnToReroutingCases()
{
WorkflowNodeDto triage = new()
{
Id = "agent-handoff-triage",
Kind = "agent",
Label = "Triage",
Config = new WorkflowNodeConfigDto
{
Kind = "agent",
Id = "agent-handoff-triage",
Name = "Triage",
Description = "Routes the request to the right specialist.",
Instructions = "Triages requests.",
Model = "gpt-5.4",
},
};
string reason = HandoffWorkflowGuidance.CreateReturnReason(triage);
Assert.Contains("Triage", reason, StringComparison.OrdinalIgnoreCase);
Assert.Contains("re-routing", reason, StringComparison.OrdinalIgnoreCase);
Assert.Contains("outside your specialty", reason, StringComparison.OrdinalIgnoreCase);
}
}