Skip to content

Refactor/core cqrs parallel subsystems#6

Closed
loning wants to merge 63 commits intodevfrom
refactor/core-cqrs-parallel-subsystems
Closed

Refactor/core cqrs parallel subsystems#6
loning wants to merge 63 commits intodevfrom
refactor/core-cqrs-parallel-subsystems

Conversation

@loning
Copy link
Copy Markdown
Contributor

@loning loning commented Feb 19, 2026

This pull request introduces significant architectural improvements, enforces stricter CI/CD validation, and updates documentation to reflect a modularized host structure. The main changes include the removal of legacy host projects, the addition of new subsystem hosts (Platform, Workflow, Maker), enhanced architecture guard checks in CI, and updates to project references and documentation for clarity and maintainability.

Architectural and Project Structure Changes:

  • Removed legacy host projects (Aevatar.Host.Api and Aevatar.Host.Gateway) from the solution and replaced them with subsystem hosts: Aevatar.Platform.Host.Api, Aevatar.Workflow.Host.Api, and Aevatar.Maker.Host.Api. Updated the solution file (aevatar.slnx) to reflect these changes.
  • Added new CQRS and platform-related projects to the solution, including Aevatar.CQRS.Core, Aevatar.CQRS.Runtime.Hosting, and related implementations, as well as Maker and Platform subsystems.
  • Updated test project references to match the new host structure (e.g., replaced Aevatar.Host.Api.Tests with Aevatar.Workflow.Host.Api.Tests).

CI/CD and Architecture Guard Improvements:

  • Enhanced .github/workflows/ci.yml to:
    • Forbid the presence and solution inclusion of legacy host projects.
    • Enforce that new host entry points use UseAevatarCqrsRuntime and AddAevatarCqrsRuntime.
    • Forbid direct usage of AddCqrsCore in hosts/infrastructure.
    • Restrict direct references to CQRS runtime implementations to the appropriate hosting projects only. [1] [2]

Documentation Updates:

  • Updated README.md and AGENTS.md to:
    • Reflect the new subsystem host structure in all usage and architecture diagrams.
    • Standardize and document mermaid diagram settings for consistency across documentation. [1] [2] [3] [4] [5] [6] [7]
    • Remove references to legacy hosts and tests, replacing them with new subsystem hosts and related test projects.

Dependency and Package Management:

  • Added WolverineFx as a new dependency in Directory.Packages.props to support CQRS runtime implementations. [1] [2]

Demo and Abstractions Refactoring:

  • Refactored the CaseProjection demo and abstractions to align with new projection context and dispatcher patterns, removing outdated interfaces and simplifying dependency injection. [1] [2] [3] [4] [5] [6] [7]

These changes collectively modernize the project structure, enforce best practices, and improve maintainability and clarity for both developers and contributors.

- Introduced a comprehensive refactor plan for the Core CQRS architecture, focusing on establishing a unified abstraction layer for the Workflow and Maker subsystems.
- Documented current state analysis, architectural goals, and phased implementation strategies to enhance modularity and facilitate cross-system integration.
- Included detailed interface specifications and project organization restructuring to support the transition towards a more cohesive CQRS framework.
- Introduced the `Aevatar.CQRS.Core` and `Aevatar.CQRS.Core.Abstractions` projects to establish a unified CQRS framework, including essential interfaces and default implementations for command execution and correlation.
- Integrated the Maker subsystem into the solution, restructuring its components and updating references to improve modularity and maintainability.
- Updated various project files and documentation to reflect the new architecture, including changes to dependency injection and service registration.
- Enhanced the `InMemoryStream` class to support concurrent subscriber dispatching, improving performance in event handling scenarios.
- Revised README files to provide clearer guidance on the new subsystem structure and its components.
…text management

- Introduced a new `CommandContext` structure to replace the previous `CommandCorrelation` model, enhancing clarity in command execution and metadata handling.
- Removed obsolete command correlation policies and streamlined the command execution process by integrating the new context management.
- Updated various components, including command envelope factories and execution services, to utilize the new command context, improving modularity and maintainability.
- Revised dependency injection configurations to reflect the architectural changes and ensure proper service registration.
- Enhanced documentation to provide clear guidance on the new command context structure and its implications for the CQRS framework.
…command context management

- Eliminated the RunId concept from the CQRS framework, simplifying the architecture and reducing complexity in command execution.
- Introduced a new CommandId to replace RunId, improving clarity in command tracking and metadata handling.
- Updated various components, including command context policies and projection lifecycle services, to reflect the removal of RunId and the introduction of CommandId.
- Revised dependency injection configurations and documentation to align with the new command context structure and its implications for the CQRS framework.
- Enhanced the InMemoryStream class to support improved event handling and subscriber dispatching.
- Introduced the Aevatar.Platform and Aevatar.Maker subsystems, establishing a modular architecture for command and query handling.
- Implemented CQRS patterns in the new subsystems, including command dispatching and state management.
- Updated solution and project files to include new components, enhancing overall structure and maintainability.
- Revised README documentation to reflect the new architecture and provide guidance on subsystem usage and integration.
- Improved dependency injection configurations to support the new subsystems and their respective services.
…em implementations

- Introduced `Aevatar.CQRS.Runtime.Abstractions` to define core command and execution contracts, improving modularity and separation of concerns.
- Added `Aevatar.CQRS.Runtime.FileSystem` for local file system storage of command states, inbox, outbox, and dead letters, facilitating persistence without external dependencies.
- Updated solution and project files to include new runtime components, enhancing overall structure and maintainability.
- Created comprehensive documentation for the new abstractions and file system implementations, providing guidance on usage and integration.
- Revised dependency injection configurations to support the new runtime components and their respective services.
- Introduced `Aevatar.Workflow.Host.Api` as the new entry point for workflow-related chat protocols, replacing the previous `Aevatar.Host.Api`.
- Updated project references and configurations to support the new workflow architecture, enhancing modularity and maintainability.
- Revised documentation to reflect the transition from `Aevatar.Host.Api` to `Aevatar.Workflow.Host.Api`, clarifying the roles and responsibilities of the new subsystem.
- Implemented dependency injection for the new runtime hosting components, ensuring seamless integration with existing services.
- Removed obsolete `Aevatar.Host.Api` components, streamlining the codebase and reducing complexity.
- Deleted the `Aevatar.Host.Gateway` project and its associated files, including `Program.cs`, `GlobalUsings.cs`, and `README.md`, to streamline the architecture.
- Updated the solution file to reflect the removal of the `Aevatar.Host.Gateway` project, enhancing modularity and reducing complexity in the codebase.
- Replaced legacy host project references in the solution file with a new long-term architecture maintenance document, enhancing clarity on architectural goals.
- Added checks in the CI workflow to enforce architectural guidelines, preventing the inclusion of legacy host projects and ensuring proper usage of runtime components in host programs.
- Introduced a new documentation file outlining long-term maintenance strategies and subsystem responsibilities, promoting sustainable architecture evolution.
…ion and eliminate redundancy in architectural planning. This deletion supports ongoing efforts to consolidate project documentation and enhance clarity in the refactoring strategy.
- Introduced a new documentation file outlining the complete architecture of the Aevatar project, covering system goals, structure, and responsibilities.
- Updated the solution file to include the new documentation, improving accessibility to architectural guidelines and promoting better understanding of subsystem interactions.
- Introduced a comprehensive README.md file detailing the architecture of the `src/workflow` subsystem, including layered dependencies, execution flow, and internal class relationships.
- Enhanced understanding of the workflow execution process through visual diagrams and descriptions, promoting clarity in subsystem interactions and responsibilities.
- Extended the `IEventPublisher` interface to include an optional `correlationId` parameter in `PublishAsync` and `SendToAsync` methods, ensuring that correlation IDs are passed through the event handling pipeline.
- Updated implementations in `GAgentBase`, `LocalActorPublisher`, and `EventHandlerContext` to support the new correlation ID functionality, enhancing traceability of events across the system.
- Added tests to verify that correlation IDs are correctly propagated during event publishing and sending, ensuring consistency and reliability in event handling.
- Introduced a new documentation file outlining the correlation ID change plan, detailing the rationale, current issues, and implementation steps for the new feature.
…eability

- Replaced `correlationId` with `EventEnvelope` in the `IEventPublisher` interface methods, ensuring that event metadata is consistently propagated through the system.
- Introduced `IEnvelopePropagationPolicy` and `ICorrelationLinkPolicy` to manage correlation and causation links between inbound and outbound envelopes, improving event traceability.
- Updated implementations in `GAgentBase`, `LocalActorPublisher`, and `EventHandlerContext` to utilize the new envelope-based approach, enhancing the clarity of event handling.
- Added a new `ProjectionDispatcher` to streamline the projection process, replacing the previous subscription registry approach, and ensuring a unified dispatch mechanism.
- Enhanced documentation to reflect changes in event handling and projection architecture, promoting better understanding and maintainability of the system.
…d registration handling

- Updated `BuiltInAgentCatalog` to utilize a dictionary for subsystem registrations, enhancing flexibility and maintainability.
- Refactored `List` method to return capabilities from the new registration structure.
- Modified `SubsystemEndpointOptions` to support a list of subsystem registrations, replacing legacy base URL fields with optional properties.
- Introduced `SubsystemEndpointRegistration` class to encapsulate subsystem details and resolve registrations dynamically.
- Added new methods for endpoint resolution and template application, improving the overall architecture of agent command routing.
- Introduced new projects for Saga abstractions, core, and runtime, establishing a foundation for long-running transaction management.
- Updated solution files to include new Saga projects and removed the obsolete LONG_TERM_ARCHITECTURE_MAINTENANCE.md document.
- Enhanced CI workflow to enforce architectural guidelines, including checks for Saga project dependencies and restrictions on read-model usage in Saga states.
- Added comprehensive documentation for Saga introduction, detailing architecture, implementation phases, and compliance with best practices.
- Updated PROJECT_ARCHITECTURE.md to reflect the integration of Saga capabilities and clarify subsystem responsibilities.
- Deleted the `Aevatar.Platform.Sagas` project and its associated files, including saga-related commands, queries, and states, to streamline the architecture and eliminate redundancy.
- Updated solution files to reflect the removal of the Saga project, enhancing modularity and reducing complexity in the codebase.
- Adjusted documentation to remove references to Saga capabilities, ensuring clarity in the project's current architecture and responsibilities.
- Introduced comprehensive documentation for the Aevatar CQRS and Saga architectures, detailing implementation principles, project responsibilities, and execution paths.
- Included diagrams to illustrate the overall architecture and command execution models, enhancing understanding of the system's structure and interactions.
- Removed the obsolete SAGA_INTRODUCTION_ANALYSIS.md file to streamline documentation and focus on the current architecture.
@eanzhao
Copy link
Copy Markdown
Contributor

eanzhao commented Feb 19, 2026

PR6 Review Report (Re-run on Correct Branch)

Review Scope

  • PR: #6 Refactor/core cqrs parallel subsystems
  • Compare: refactor/core-cqrs-parallel-subsystems -> dev
  • Diff Size: 337 files, +9211 / -2478
  • Review Date: 2026-02-19

Findings (ordered by severity)

1) HIGH - Path Traversal in Platform command status store

  • Files:
    • src/Aevatar.Platform.Host.Api/Endpoints/PlatformCommandEndpoints.cs
    • src/Aevatar.Platform.Application/Queries/PlatformCommandQueryApplicationService.cs
    • src/Aevatar.Platform.Infrastructure/Store/FileSystemPlatformCommandStateStore.cs
  • Problem:
    • GET /api/commands/{commandId}commandId 直接进入 Path.Combine(_statesPath, $"{commandId}.json"),没有做路径段净化。
  • Risk:
    • 攻击者可构造 ../ 形式的 commandId 尝试读取工作目录外部文件(取决于运行账户权限)。
  • Fix direction:
    • commandId 做严格 allowlist(例如仅允许 [a-zA-Z0-9_-])。
    • 或将外部 ID 映射为内部安全文件名(hash/escape),避免直接拼接路径。

2) HIGH - workflow_call flow regressed by single-active execution gate

  • Files:
    • src/workflow/Aevatar.Workflow.Core/Modules/WorkflowCallModule.cs
    • src/workflow/Aevatar.Workflow.Core/Modules/WorkflowLoopModule.cs
  • Problem:
    • WorkflowCallModule 在父流程执行中发布 StartWorkflowEvent
    • WorkflowLoopModule 现改为 _executionActive 单布尔门控:流程执行中再次收到 StartWorkflowEvent 会直接返回 workflow is already running
  • Risk:
    • workflow_call/sub_workflow 语义被破坏,父流程内触发子流程会立即失败,属于功能回归。
  • Fix direction:
    • 恢复可区分执行实例的运行上下文(例如 run/session key);
    • 或为子流程调用设计独立执行通道,而非复用同一 active gate。

3) HIGH - /api/commands early-fault path returns unhandled exception

  • File:
    • src/workflow/Aevatar.Workflow.Host.Api/Endpoints/ChatEndpoints.cs
  • Problem:
    • HandleCommand 通过 Task.WhenAny(startSignal.Task, executionTask) 等待启动信号。
    • executionTaskonStartedAsync 之前故障(例如投影初始化异常),会进入 await executionTask 直接抛出,缺少受控错误映射。
  • Risk:
    • 返回不稳定 500,且错误语义不一致(与当前接口定义不匹配)。
  • Fix direction:
    • await executionTask 分支增加 try/catch,统一映射为结构化错误响应并记录日志。

4) MEDIUM - HTTP endpoints miss prompt validation parity with WS parser

  • Files:
    • src/workflow/Aevatar.Workflow.Host.Api/Endpoints/ChatEndpoints.cs
    • src/workflow/Aevatar.Workflow.Host.Api/Endpoints/ChatWebSocketCommandParser.cs
  • Problem:
    • WS 入口明确拒绝空 prompt,但 HTTP /api/chat/api/commands 直接下发,不做等价校验。
  • Risk:
    • 多入口行为不一致,容易产生不可预期失败路径和客户端兼容问题。
  • Fix direction:
    • 在 HTTP 入口补齐 string.IsNullOrWhiteSpace(prompt) 校验并返回 400 结构化错误。

5) MEDIUM - FileSystem CQRS stores still build paths from raw IDs

  • Files:
    • src/Aevatar.CQRS.Runtime.FileSystem/Stores/FileSystemCommandStateStore.cs
    • src/Aevatar.CQRS.Runtime.FileSystem/Stores/FileSystemInboxStore.cs
    • src/Aevatar.CQRS.Runtime.FileSystem/Stores/FileSystemOutboxStore.cs
    • src/Aevatar.CQRS.Runtime.FileSystem/Stores/FileSystemDeadLetterStore.cs
  • Problem:
    • 多处 BuildPath() 直接将 commandId/messageId/deadLetterId 拼接为文件名。
  • Risk:
    • 目前多数 ID 来自系统生成,现实风险低于平台查询接口;但这是明显的防御缺口,后续接入外部来源时会升级为可利用问题。
  • Fix direction:
    • 统一引入路径段净化工具(与 SagaPathResolver.SanitizeSegment 同级策略),并在所有 Store 复用。

6) LOW - Broken XML doc comment in projection options

  • File:
    • src/workflow/Aevatar.Workflow.Projection/Configuration/WorkflowExecutionProjectionOptions.cs
  • Problem:
    • 存在未闭合、无内容的 /// <summary>
  • Risk:
    • 代码生成/文档警告噪音,影响质量门禁整洁度。
  • Fix direction:
    • 删除该注释或补全注释块。

Test/Validation Performed

  • dotnet test test/Aevatar.Workflow.Host.Api.Tests/Aevatar.Workflow.Host.Api.Tests.csproj --nologo ✅ (55 passed)
  • dotnet test test/Aevatar.CQRS.Sagas.Core.Tests/Aevatar.CQRS.Sagas.Core.Tests.csproj --nologo ✅ (2 passed)

Residual Risks

  • 当前测试覆盖未直接保护以下关键路径:
    • /api/commands 的 early-fault 异常分支;
    • workflow_call 在父流程执行中的行为;
    • 路径净化(path traversal)安全边界测试。

PR #6 Review Report

Branch: feature/execution-actor -> master
Scope: 469 files changed, +13,207 / -2,961 lines
Date: 2026-02-19


1. 总览

本 PR 是一次大规模的架构重构与功能演进,核心变更包括:

  • 项目结构重组:将 workflow 相关项目迁入 src/workflow/ 目录,拆分 AI 层为 Abstractions / Core / Providers,删除旧 Aevatar.Api 替换为 Aevatar.Host.Api
  • 引入 WorkflowExecutionGAgent:实现 per-run 执行 Actor,隔离工作流执行生命周期
  • 统一 CQRS Projection Pipeline:三层泛型投影框架(Abstractions → Core → Workflow.Projection),AGUI 与 ReadModel 共用同一管道
  • 新增 Application 层Workflow.Application 封装 ChatRun 编排逻辑,查询服务与报告
  • 新增 14 个 Workflow Module:包括 ToolCallModuleWorkflowLoopModuleWhileModule
  • 测试与文档:新增 ~144+ 测试用例,新增多篇架构文档

整体架构设计合理,分层清晰,依赖方向正确。以下为详细评审。


2. 架构与分层

2.1 分层合规性:通过

Host.Api (组合层)
  ├─> Workflow.Application (应用编排)
  ├─> Workflow.Infrastructure (基础设施)
  ├─> Workflow.Projection (CQRS 投影)
  └─> Workflow.Presentation.AGUIAdapter (展示适配)

Workflow.Application
  ├─> Workflow.Core (领域)
  └─> Application.Abstractions (端口)

Workflow.Core
  ├─> AI.Abstractions ✅ (非 AI.Core)
  ├─> Foundation.Abstractions
  └─> Foundation.Core
  • 依赖反转正确,无循环依赖
  • Workflow.Core 未依赖 AI.Core,符合 CI 守卫规则
  • Host 层仅做组合,不承载业务逻辑

2.2 命名规范

  • 项目名 = 命名空间一致
  • 缩写全大写(LLM、CQRS、AGUI、MCP)符合规范
  • 小问题aevatar.slnx 中路径分隔符混用(41-43 行用 /,44-46 行用 \),建议统一

2.3 统一投影管道:通过

ActorStreamSubscriptionHub 维护每个 Actor 的唯一 stream 订阅,ProjectionCoordinator 按序分发到多个 Projector(AGUI + ReadModel),实现了"单入口、一对多分发"原则。


3. 严重问题(建议合并前修复)

3.1 [Critical] SSE 换行符 bug

ChatSseResponseWriter.cs 第 45 行:

        var bytes = Encoding.UTF8.GetBytes($"data: {payload}\\n\\n");

C# 中 \\n 输出字面量 \n(反斜杠+n),而非真正的换行符。SSE 协议要求 data: ...\n\n(真实换行)。当前实现会导致所有 SSE 客户端无法正确解析事件流。

修复:改为 $"data: {payload}\n\n"

3.2 [High] WhileModule 两处硬编码 bug

Bug A:续行路径 max_iterations 硬编码为 10

            var maxIterations = 10; // 简化:从初始请求中获取

首次请求时正确解析了 max_iterations 参数(第 37 行),但 StepCompletedEvent 处理路径直接写死 10。工作流配置 max_iterations: 50 在续行时无效。

Bug B:续行路径 StepType 硬编码为 "llm_call"

                    StepType = "llm_call",

首次迭代从参数读取 step 类型(第 43 行 subStepType),但后续迭代硬编码 "llm_call"。一个 while 循环内嵌 tool_callconnector_call 步骤,第一次迭代后会静默切换为 llm_call

修复:将 maxIterationssubStepType_iterations 一同存入 per-step 状态。

3.3 [High] ToolTruncationHook 截断无效

ToolCallLoop.cs 第 73-78 行:

                var result = await _tools.ExecuteToolCallAsync(call, ct);
                messages.Add(result);

                toolCtx.ToolResult = result.Content;
                if (_hooks != null) await _hooks.RunToolExecuteEndAsync(toolCtx, ct);

messages.Add(result) 在 Hook 运行之前执行。ToolTruncationHook 修改 toolCtx.ToolResult 后,已加入 messages 列表的原始 result 不会被更新。截断对 LLM 实际看到的内容无效。

修复:将 Hook 运行移到 messages.Add 之前,或在 Hook 执行后用 toolCtx.ToolResult 更新 result.Content

3.4 [High] WebSocket 消息无大小限制

ChatWebSocketProtocol.ReceiveTextAsync 使用 8KB buffer 累积到 MemoryStream,无上限检查:

    public static async Task<string?> ReceiveTextAsync(WebSocket socket, CancellationToken ct)
    {
        var buffer = new byte[8192];
        using var ms = new MemoryStream();
        // ... 无大小检查的循环累积 ...
    }

恶意客户端可发送永不设置 EndOfMessage 的超大消息,导致 OOM。

修复:增加 maxMessageSize 参数(如 64KB),超限时中断连接。


4. 中等问题(建议近期修复)

4.1 [Medium] ConditionalModule 分支路由未实现

ConditionalModule 计算了 branchKey("true"/"false"),但从未用于路由:

        var branchKey = input.Contains(condition, StringComparison.OrdinalIgnoreCase) ? "true" : "false";
        // branchKey 被丢弃,直接发 StepCompletedEvent
        await ctx.PublishAsync(new StepCompletedEvent { ... }, EventDirection.Self, ct);

StepDefinition.Branches 字典在 YAML 解析中有定义但从未被消费。条件分支功能形同虚设。

建议:实现真正的分支路由,或删除 ConditionalModuleStepDefinition.Branches 避免误导。

4.2 [Medium] ToolManager 异常信息泄露

        try { return ChatMessage.Tool(call.Id, await tool.ExecuteAsync(call.ArgumentsJson, ct)); }
        catch (Exception ex) { return ChatMessage.Tool(call.Id, $"{{\"error\":\"{ex.Message}\"}}"); }

两个问题:

  1. ex.Message 可能包含敏感信息(文件路径、连接字符串、堆栈细节),直接暴露给 LLM 上下文
  2. ex.Message 直接插入 JSON 字符串未转义,如果消息含引号或反斜杠会产生格式错误的 JSON

修复:返回通用错误信息,单独记录完整异常;用 JsonSerializer.Serialize 转义。

4.3 [Medium] 有状态 Module 未清理孤立条目

LLMCallModule._pendingParallelFanOutModule._expected/_collectedForEachModule._expected/_collectedWhileModule._iterations 均使用 Dictionary 存储 per-step 状态。如果子步骤超时或 Agent 崩溃,这些条目永远不会被清理。

建议:实现 CleanupRun(string runId) 方法或基于 TTL 的定期清扫。

4.4 [Medium] WorkflowExecutionGAgent._workflowAgentId 未持久化

private string _workflowAgentId = string.Empty;

此字段为内存状态,不在 protobuf WorkflowState 中。Actor 被反激活后重新激活时,_workflowAgentId 为空,ValidateBeforeRun 会拒绝所有请求。如果是设计为 per-run 短暂 Actor,需要文档说明。

4.5 [Medium] TopologyResolver 枚举全部 Actor

ActorRuntimeWorkflowExecutionTopologyResolver 调用 runtime.GetAllAsync() 遍历所有 Actor 来构建父子树。在有大量并发 Actor 的系统中,每次 run finalize 都执行此操作会成为瓶颈。

建议:考虑 GetDescendantsAsync(rootActorId) API 或在 run 期间缓存拓扑。

4.6 [Medium] Projection 投影链失败语义

ProjectionSubscriptionRegistry.DispatchAsync 中任一 Reducer/Projector 抛异常会将整个 run 标记为 Failed,无 "skip and continue" 策略。这是 fail-fast 设计选择,但应明确文档化。

4.7 [Medium] ProjectionService._contexts 无 TTL 清理

WorkflowExecutionProjectionService._contexts 是 Singleton 的 ConcurrentDictionary。如果 CompleteAsync 因故未被调用(进程崩溃、未处理异常跳过 Application 层 finally),context 条目永远不会被清理。

4.8 [Medium] CliConnectorBuilder 命令验证不足

        if (entry.Cli.Command.Contains("://", StringComparison.OrdinalIgnoreCase))
        {
            // ... reject URL ...
        }

仅阻止 URL 格式,不阻止路径遍历、任意二进制执行或 shell 元字符。如果 connector 配置来自不可信输入,存在注入风险。

4.9 [Medium] HttpConnector 创建新 HttpClient

_client = client ?? new HttpClient();

未注入时每实例创建 HttpClient,长时间运行可能导致 socket 耗尽。应使用 IHttpClientFactory


5. 低优先级问题

# 问题 说明
5.1 WorkflowCallModule 无递归深度限制 嵌套 workflow_call 可无限递归,RunId 拼接无限增长
5.2 WorkflowVariables 完整实现但未使用 支持点路径访问、插值、合并,但无 Module 引用
5.3 StepDefinition.Branches/Children 已解析但未消费 结构存在但功能缺失
5.4 WorkflowOutputFrame 15 个 nullable 属性的扁平 DTO 位于 Application.Abstractions,可下沉到 Presentation 层
5.5 四个平行的 CompletionStatus 枚举 维护成本高,新增状态需改 4 处枚举 + 3 处映射
5.6 AIGAgentExecutionHookContext.LLMRequest/LLMResponse 类型为 object? 丢失类型安全
5.7 RoleAgentConfigAIAgentConfig 字段完全重复 手工映射维护负担
5.8 EnsureRuntime() 跳过 RegisterToolsFromSourcesAsync 如果在激活前调用 ChatAsync,工具可能缺失
5.9 ProjectionSubscriptionRegistry / ProjectionCoordinator 未 sealed 子类化可能破坏线程安全不变式
5.10 ListRuns 查询端点无分页游标 仅支持 take,无 skip/after
5.11 中英文日志消息混用 "工作流未编译或未配置" vs "workflow yaml is empty"
5.12 TransformModule 吞掉异常并以 Success = true 传递错误信息 错误字符串被作为正常数据传给下一步
5.13 ToolCallModule._toolIndexLock SemaphoreSlim 未 Dispose 轻微资源泄露
5.14 ActorStreamSubscriptionHub 顺序分发 handler 慢 handler 阻塞同 actor 的后续 handler
5.15 ChatInput.Prompt 无长度校验 超大 prompt 直接传给 LLM

6. 测试覆盖

6.1 覆盖概况

测试项目 文件数 用例数(约) 评价
Foundation.Abstractions.Tests 4 ~12 充分
Foundation.Core.Tests 13 ~40+ 优秀(含 7 个 BDD)
Host.Api.Tests 13 ~55+ 良好
Workflow.Application.Tests 2 ~12 良好
Integration.Tests 8 ~25+ 优秀
合计 42 ~144+

6.2 核心关注:Module 行为测试缺失

14 个 Workflow Module 中,仅 ConnectorCallModule 有完整的行为集成测试(5 个用例)。其余 Module 仅通过 WorkflowIntegrationTests.Scenario7_AllCoreModules 验证了可被 factory 创建,无 HandleAsync 行为测试:

Module 行为测试 风险
ToolCallModule 工具解析、执行、失败路径未验证
WhileModule 迭代计数、max_iterations、DONE 终止未验证
ConditionalModule 分支路由(已确认非功能性)未验证
VoteConsensusModule 投票收集、共识判断未验证
TransformModule 转换逻辑、异常处理未验证
ForEachModule 列表展开、子步骤收集未验证
AssignModule 变量赋值未验证
WorkflowCallModule 嵌套工作流、递归场景未验证
RetrieveFactsModule 事实检索逻辑未验证
CheckpointModule 检查点行为未验证

建议:至少为 ToolCallModuleWhileModuleWorkflowLoopModule 补充行为单元测试,这三个是执行主路径上的关键模块。

6.3 测试质量:优秀

已有测试质量很高:

  • 使用真实 in-memory 实现而非 mock,验证真实行为
  • 错误路径覆盖充分(projection 失败、超时、disabled、owner binding 违规、connector 缺失)
  • FluentAssertions 断言清晰
  • WorkflowExecutionOwnerBindingTests 是最完善的集成测试,验证了 bind-once 语义、RunId 强制、元数据不匹配拒绝等

6.4 其他测试缺口

  • WebSocket 端点无测试(仅 HTTP 有)
  • WorkflowChatRunApplicationService.ExecuteAsync 缺少 happy path 测试
  • WorkflowExecutionGAgent 销毁竞态无回归测试(DESTROY_RACE_MEMO.md 中已提出但未实现)
  • CancellationToken 传播未在 module pipeline 中测试

7. CI 与文档

7.1 CI 守卫

三项架构守卫有效:

  1. 禁止 GetAwaiter().GetResult() 同步阻塞
  2. 禁止 TypeUrl.Contains 字符串路由
  3. 禁止 Workflow.Core 依赖 AI.Core

问题:CI push 触发器配置为 main/dev/refactor/**,但本 PR 目标分支为 master。合并到 master 的 push 不会触发 CI。pull_request 触发器可覆盖,但 push-based 守卫存在盲区。

建议:将 master 加入 push.branches 列表,或统一默认分支名。

7.2 文档质量

文档 评价
WORKFLOW_RUN_LIFECYCLE.md 优秀。清晰区分 WorkflowGAgent(长生命周期)与 WorkflowExecutionGAgent(per-run),序列图与代码一致
IDENTIFIER_RELATIONSHIPS.md 良好。EventEnvelope.Id / RunId / MessageId / ActorId 职责清晰
WORKFLOW_EXECUTION_DESTROY_RACE_MEMO.md 优秀。诚实的工程备忘,明确问题范围、现有缓解、三种方案比较
README.md 良好。面向目标读者("略懂技术"),快速开始 3 步、架构图、步骤类型参考表

8. 亮点

值得肯定的设计:

  1. CQRS Projection Pipeline 的泛型三层设计:Abstractions → Core → Workflow.Projection,真正可复用(demos 中的 CaseProjection 验证了这一点)
  2. ActiveRunState 并发原语Interlocked.CompareExchange 单次状态转换、TaskCompletionSource + RunContinuationsAsynchronously 避免重入、per-run CancellationTokenSource
  3. ConnectorCallModule 的健壮性:retry、timeout、on_error/on_missing 策略、域名/方法/路径白名单
  4. WorkflowExecutionOwnerBindingTests:bind-once 语义、幂等重绑定、未绑定快速失败、RunId 强制、元数据不匹配拒绝——集成测试标杆
  5. Endpoint 拆分:6 个聚焦文件各司其职,Host 层零业务逻辑
  6. Hook Pipeline 最佳实践:优先级排序、best-effort 执行、默认方法减少实现负担
  7. DESTROY_RACE_MEMO.md:诚实记录已知低概率问题,而非掩盖

9. 修复优先级总结

合并前必须修复

# 问题 严重度
3.1 SSE \\n\\n 字面量 bug Critical
3.2 WhileModule 两处硬编码 High
3.3 ToolTruncationHook 截断无效 High
3.4 WebSocket 消息无大小限制 High

合并后尽快修复

# 问题 严重度
4.1 ConditionalModule 分支路由未实现 Medium
4.2 ToolManager 异常信息泄露 + JSON 未转义 Medium
4.3 有状态 Module 孤立条目未清理 Medium
4.9 HttpConnector new HttpClient() Medium

跟踪 backlog

# 问题 严重度
6.2 Module 行为测试补充 Medium
7.1 CI push 触发器加入 master Medium
4.4-4.8 持久化、拓扑性能、projection 语义等 Medium
5.x 低优先级改善项 Low

10. 结论

本 PR 的架构设计水平较高,分层严谨,CQRS 投影管道的泛型抽象是值得学习的工程范例。已有测试质量优秀,文档完整诚实。

主要风险集中在 4 个必须修复的 bug(SSE 换行、WhileModule 硬编码、Hook 截断无效、WebSocket OOM)和 Module 行为测试的系统性缺失。修复这些问题后,PR 可以合并。

@eanzhao
Copy link
Copy Markdown
Contributor

eanzhao commented Feb 19, 2026

针对 PR #6 Refactor/core cqrs parallel subsystems(分支 refactor/core-cqrs-parallel-subsystems -> dev)的 Review 发现进行了二次验证,确认了 5 个有效问题并完成修复,降级了 1 个为设计说明。

变更统计:9 个文件,+127 / -14 行


验证与定性结果

# 问题 严重度 结论
1 文件系统 Store 路径遍历漏洞 HIGH 确认并修复
2 workflow_call 子流程被单执行门控拒绝 降级为设计说明(dev 上已有缺陷)
3 /api/commands 早期故障未捕获异常 HIGH 确认并修复
4 HTTP 端点缺少 prompt 空值校验 MEDIUM 确认并修复
5 CQRS FileSystem stores 路径拼接 MEDIUM 确认并修复(防御纵深)
6 XML 文档注释未闭合 LOW 确认并修复

修复详情

修复 1:路径遍历防护(HIGH)

问题描述

FileSystemPlatformCommandStateStore.BuildPath 直接将来自 HTTP 路由参数 {commandId} 的值拼接到文件路径中:

private string BuildPath(string commandId) => Path.Combine(_statesPath, $"{commandId}.json");

攻击者可构造 GET /api/commands/../../etc/passwd 形式的请求,通过 ../ 读取工作目录外的任意文件。同样的问题存在于 4 个 CQRS 内部 Store 中。

修复方案

使用 Path.GetFullPath 解析后检查结果路径是否仍在容器目录内。两种策略:

  • Platform Store(外部输入):返回 null,上层映射为 404,不暴露内部信息
  • CQRS Stores(内部 ID):抛出 ArgumentException,作为防御纵深
private string? SafeBuildPath(string id)
{
    var fullPath = Path.GetFullPath(Path.Combine(_statesPath, $"{id}.json"));
    var normalizedBase = Path.GetFullPath(_statesPath + Path.DirectorySeparatorChar);
    return fullPath.StartsWith(normalizedBase, StringComparison.OrdinalIgnoreCase) ? fullPath : null;
}

影响文件

文件 策略
src/Aevatar.Platform.Infrastructure/Store/FileSystemPlatformCommandStateStore.cs 返回 null
src/Aevatar.CQRS.Runtime.FileSystem/Stores/FileSystemCommandStateStore.cs 抛出异常
src/Aevatar.CQRS.Runtime.FileSystem/Stores/FileSystemInboxStore.cs 抛出异常
src/Aevatar.CQRS.Runtime.FileSystem/Stores/FileSystemOutboxStore.cs 抛出异常
src/Aevatar.CQRS.Runtime.FileSystem/Stores/FileSystemDeadLetterStore.cs 抛出异常

新增测试(7 个用例)

文件:test/Aevatar.Integration.Tests/FileSystemPlatformCommandStateStoreTests.cs

用例 验证内容
GetAsync_WithPathTraversal_ShouldReturnNull (x4) ../../etc/passwd../secret..\\windows\\...sub/../../../escape 均返回 null
UpsertAsync_ThenGetAsync_ShouldRoundTrip 正常写入+读取往返正确
GetAsync_WithValidGuid_WhenNotStored_ShouldReturnNull 不存在的合法 ID 返回 null
ListAsync_ShouldReturnStoredItems 列表查询包含已写入条目

辅助变更:

  • src/Aevatar.Platform.Infrastructure/Properties/InternalsVisibleTo.cs:暴露 internal 类型给测试项目
  • test/Aevatar.Integration.Tests/Aevatar.Integration.Tests.csproj:添加 Aevatar.Platform.Infrastructure 项目引用

修复 2:HandleCommand 早期故障异常捕获(HIGH)

问题描述

ChatEndpoints.HandleCommand 使用 Task.WhenAny(startSignal.Task, executionTask) 等待启动信号。当 executionTask 在触发 onStartedAsync 回调之前就抛出异常(例如投影初始化失败),代码会进入 fallback 分支直接 await executionTask,异常未捕获,导致 ASP.NET Core 返回无结构的 500 响应。

修复方案

在 fallback 分支的 await executionTask 外层增加 try/catch

CommandExecutionResult<...> result;
try
{
    result = await executionTask;
}
catch (Exception ex)
{
    logger.LogError(ex, "Workflow command execution failed before start signal");
    return Results.Json(
        new { code = "EXECUTION_FAILED", message = "Command execution failed." },
        statusCode: StatusCodes.Status500InternalServerError);
}

影响文件

  • src/workflow/Aevatar.Workflow.Host.Api/Endpoints/ChatEndpoints.cs

新增测试(1 个用例)

文件:test/Aevatar.Workflow.Host.Api.Tests/ChatEndpointsInternalTests.cs

用例 验证内容
HandleCommand_WhenExecutionThrows_ShouldReturn500WithStructuredBody 服务抛出异常时返回 500 + JSON {code: "EXECUTION_FAILED"}

修复 3:HTTP 端点 prompt 校验对齐(MEDIUM)

问题描述

WebSocket 入口 ChatWebSocketCommandParser.TryParse 对空 prompt 有明确校验并返回 INVALID_PROMPT 错误码。但 HTTP 端点 HandleChatHandleCommand 未做等价检查,空 prompt 会直接传入业务层,导致多入口行为不一致。

修复方案

在两个 HTTP handler 入口处增加校验:

if (string.IsNullOrWhiteSpace(input.Prompt))
{
    // HandleChat: 直接设置 400 状态码
    // HandleCommand: 返回 Results.BadRequest(new { code = "INVALID_PROMPT", ... })
}

影响文件

  • src/workflow/Aevatar.Workflow.Host.Api/Endpoints/ChatEndpoints.cs

新增测试(2 个用例)

文件:test/Aevatar.Workflow.Host.Api.Tests/ChatEndpointsInternalTests.cs

用例 验证内容
HandleChat_WithEmptyPrompt_ShouldReturn400 空 prompt SSE 端点返回 400
HandleCommand_WithEmptyPrompt_ShouldReturn400WithCode 空 prompt Command 端点返回 400 + INVALID_PROMPT

修复 4:XML 文档注释修复(LOW)

问题描述

WorkflowExecutionProjectionOptions.cs 末尾存在一个未闭合的 /// <summary> 标签,无内容,会产生编译器文档警告。

修复方案

直接删除该孤立注释行。

影响文件

  • src/workflow/Aevatar.Workflow.Projection/Configuration/WorkflowExecutionProjectionOptions.cs

降级说明:workflow_call 子流程执行

原始发现

PR 将 WorkflowLoopModule._activeRunIdsHashSet<string>)替换为 _executionActivebool),同时从 proto 中移除了 RunId 字段。这导致 WorkflowCallModule 发布的子流程 StartWorkflowEvent 会被立即拒绝。

验证结果

通过 git diff dev...HEAD 比对发现,workflow_calldev 分支上已存在功能缺陷:

  1. 子流程的 WorkflowCompletedEvent 没有对应的 StepCompletedEvent 桥接回父流程
  2. 父流程会在 workflow_call 步骤永远挂起,等待一个永远不会到来的完成事件

本 PR 将失败模式从"静默挂起"改为"立即拒绝并返回错误",属于行为变更而非新增回归。彻底修复需要架构级改动(为子流程创建独立执行 Actor,或实现完成事件桥接),不在本次修复范围内。


排除的发现(dev 分支上已存在,非本 PR 引入)

问题 排除原因
SSE \\n\\n 字面量 重构后的 ChatSseResponseWriter.cs 已使用正确的 \n\n
WhileModule maxIterations=10 / StepType="llm_call" 硬编码 dev 上已存在;本 PR 仅移除了 RunId 字段
ToolTruncationHook 在 hook 执行前已加入 messages dev 上已存在;本 PR 仅修改了 tool call 构造方式
WebSocket 无最大消息长度限制 dev 上已存在(文件仅做了重命名迁移)

测试验证

dotnet test test/Aevatar.Workflow.Host.Api.Tests/   → 58 passed (55 existing + 3 new)
dotnet test test/Aevatar.Integration.Tests/ --filter FileSystemPlatformCommandStateStore → 7 passed (all new)
dotnet build aevatar.slnx                            → 0 errors, 110 warnings (all pre-existing NU1507)

新增测试总计:10 个用例,覆盖所有修复的 bug 及其边界条件。

- Replaced the existing `Aevatar.Platform.*` projects with `Aevatar.Mainnet.*` projects, consolidating the architecture around Mainnet as the default capability host.
- Updated solution files to reflect the new project structure, enhancing modularity and clarity.
- Removed obsolete platform components to streamline the codebase and focus on Mainnet and Maker capabilities.
- Enhanced documentation to outline the new architecture and capabilities, ensuring alignment with the refactored structure.
…cture

- Deleted all Saga-related projects, including abstractions, core, and runtime, to streamline the architecture and eliminate redundancy.
- Updated solution files to reflect the removal of Saga components, enhancing modularity and reducing complexity in the codebase.
- Removed associated documentation files, including SAGA_ARCHITECTURE.md, to ensure clarity in the project's current architecture and responsibilities.
- Replaced previous capability registration methods with `AddAevatarDefaultHost(...)` and `UseAevatarDefaultHost()` for streamlined access to Mainnet and Maker capabilities.
- Updated documentation to reflect new integration patterns and removed obsolete references to `Aevatar.Platform.*` components.
- Introduced new extension methods for adding capabilities, enhancing modularity and clarity in the architecture.
- Adjusted project files to ensure proper references and dependencies are maintained across the solution.
- Added a note specifying that work documents do not need to be included in the solution (`aevatar.slnx`), enhancing clarity in project documentation practices.
- Deleted the `Aevatar.Mainnet.Application` project and its associated files, streamlining the architecture and focusing on the core capabilities.
- Updated solution and project files to reflect the removal of obsolete references, enhancing clarity and modularity in the codebase.
- Adjusted documentation to remove references to the deleted components, ensuring alignment with the current architecture.
…rm Actor Stream refactor plans

- Deleted `EVENT_ENVELOPE_CQRS_REFACTOR_PLAN.md` and `PLATFORM_ACTOR_STREAM_REFACTOR_PLAN.md` to streamline documentation and eliminate outdated architectural plans.
- Ensured that the remaining documentation aligns with the current architecture and capabilities of the Aevatar project.
- Created a new `.gitkeep` file in the `agents-working-space` directory to ensure the directory is tracked in version control, maintaining the structure for future content additions.
- Added the `docs/agents-working-space/*` entry to the `.gitignore` file to prevent tracking of files in the agents-working-space directory, ensuring a cleaner version control environment.
- Introduced a new `Aevatar.Hosting` project to centralize hosting capabilities and streamline integration of various components.
- Updated solution and project files to include references to the new hosting project.
- Enhanced CI workflow to enforce documentation standards and prevent the addition of working audit documents to the solution.
- Refactored existing code to utilize the new hosting extensions for capability registration, improving modularity and clarity in the architecture.
- Introduced a new `Aevatar.AI.Projection` project to centralize AI event handling and provide a base for AI-layer read models.
- Updated event appliers to streamline the processing of AI events, ensuring that business layer read models can inherit capabilities without duplicating event handling logic.
- Enhanced dependency injection configurations to support new AI projection components and simplify the registration of default appliers and reducers.
- Improved documentation to clarify the new architecture and usage of AI projection components, including subscription mechanisms and event handling semantics.
- Removed obsolete event appliers from the workflow projection, consolidating AI event handling within the new architecture.
- Deleted the `Aevatar.CQRS.Runtime.FileSystem` project, including all associated files and dependencies, to streamline the architecture and focus on more modular runtime implementations.
- Updated architectural documentation to reflect the removal of the FileSystem runtime and its components.
- Cleaned up project references in the solution to eliminate dependencies on the removed FileSystem implementation.
…mentations

- Deleted the `Aevatar.CQRS.Runtime.Abstractions` and `Aevatar.CQRS.Runtime.Hosting` projects, along with their associated files, to streamline the CQRS architecture and eliminate unnecessary complexity.
- Updated project references and documentation to reflect the removal of these components, ensuring clarity in the remaining architecture.
- Adjusted the hosting integration to utilize direct command execution through the application layer, enhancing performance and reducing overhead.
…apter integration

- Updated `README.md` to reflect the addition of the demo report accumulator and JSON/HTML output capabilities.
- Modified project references in `Aevatar.Maker.Infrastructure.csproj` to include new workflow application abstractions and projection components.
- Enhanced dependency injection in `ServiceCollectionExtensions.cs` to support workflow execution projection and AGUI adapter services.
- Refactored `WorkflowMakerRunExecutionPort.cs` to integrate workflow projection handling, improving event processing and actor management during workflow execution.
- Updated CI workflow to enforce restrictions on Maker projects referencing Workflow.Host.Api directly, ensuring compliance with architectural guidelines.
- Revised documentation to clarify the relationship and constraints between Maker and Workflow projects, emphasizing direct inheritance and prohibiting reverse dependencies.
- Enhanced README and architectural documents to reflect the updated dependency rules and inheritance constraints for Maker capabilities.
- Updated AGENTS.md to introduce new constraints on mutable collections in intermediate layers, emphasizing the use of Actor-based state management.
- Modified CI workflow to include architecture guards that prevent the addition of mutable state fields in intermediate layers and enforce proper lifecycle management for projections.
- Refactored projection subscription interfaces to support keyed handlers and improve the clarity of subscription management.
- Enhanced WorkflowMakerRunExecutionPort and related services to utilize projection leases, ensuring better control over workflow execution and event handling.
- Updated documentation and README files to reflect changes in projection handling and architectural guidelines.
- Updated AGENTS.md to clarify constraints on in-memory state management in intermediate layers, emphasizing the use of actorized orchestration and subscription leases.
- Introduced new interfaces for stream subscription context and lease management, improving clarity and control over actor stream subscriptions.
- Refactored projection subscription registry to utilize the new subscription context, ensuring proper lifecycle management and preventing duplicate registrations.
- Enhanced WorkflowExecutionProjectionContext to support stream subscription leases, improving the management of projection lifecycles.
- Updated CI architecture guards to enforce restrictions on mutable state fields in the middle layer, ensuring compliance with architectural guidelines.
- Introduced new test projects for Aevatar.CQRS.Core and Aevatar.CQRS.Projection.Core, enhancing test coverage for core functionalities.
- Implemented various unit tests for command context policies, command executors, and projection behaviors, ensuring robust validation of CQRS components.
- Updated AGENTS.md to include requirements for testing non-abstract reducer classes, reinforcing the importance of test coverage in the architecture.
- Enhanced CI architecture guards to enforce testing requirements for newly added reducer classes, ensuring compliance with architectural standards.
- Removed the dependency on Aevatar.Workflow.Core from Aevatar.Workflow.Application, streamlining project references.
- Introduced IWorkflowRunActorPort to replace IActorRuntime in WorkflowRunActorResolver, enhancing the actor resolution process.
- Updated ServiceCollectionExtensions to register IWorkflowRunActorPort, ensuring proper dependency injection.
- Modified unit tests to accommodate the new actor port interface, improving test coverage and reliability.
- Added a new script `projection_route_mapping_guard.sh` to validate event type to reducer routing, ensuring compliance with architectural standards.
- Updated CI workflow to include the new projection route mapping guard, enhancing the architecture validation process.
- Revised AGENTS.md and other documentation to reflect the new requirements for routing and reducer class testing, reinforcing the importance of static checks in the architecture.
…rrency Management

- Updated the `WorkflowExecutionProjectionService` to utilize an actorized projection coordinator for managing projection ownership, ensuring that only one projection can be active per root actor.
- Introduced new gRPC message definitions for projection coordination, enhancing the communication between actors.
- Refactored the projection lifecycle management to eliminate reliance on process-local synchronization mechanisms, improving scalability and compliance with architectural standards.
- Enhanced unit tests to validate the new concurrency model, ensuring robust handling of projection leases and ownership.
- Updated documentation to reflect changes in the projection architecture and the introduction of the new coordinator actor.
- Revised audit scope to encompass the entire `aevatar.slnx` project, including `src`, `test`, and `docs/guards`.
- Adjusted scoring criteria to align with the standardized 100-point model outlined in `docs/audit-scorecard/README.md`.
- Emphasized the focus on confirming the integration of Projection logic into the general CQRS layer and conducted a comprehensive re-evaluation of the architecture.
- Updated overall score to 96/100 (A+) and refined subsystem scores to reflect improvements in CQRS and Workflow capabilities.
- Enhanced documentation to clarify scoring dimensions and key evidence supporting the evaluation results.
- Introduced `Aevatar.Workflow.Abstractions` to encapsulate workflow execution event contracts, promoting a clear separation of concerns.
- Updated `Maker` components to depend on the new abstractions instead of direct references to `Workflow.Core`, reducing coupling and improving modularity.
- Refactored `WorkflowMakerRunExecutionPort` to utilize `IWorkflowExecutionCapability`, streamlining workflow execution processes.
- Enhanced dependency injection in `Maker` infrastructure to support the new workflow abstractions, ensuring proper integration and functionality.
- Updated documentation to reflect changes in project structure and clarify the relationship between `Maker` and `Workflow` capabilities.
- Renamed and refactored `IWorkflowExecutionCapability` to `IRunnableWorkflowActorCapability`, enhancing clarity and consistency in workflow execution contracts.
- Updated `WorkflowMakerRunExecutionPort` to utilize the new `IRunnableWorkflowActorCapability`, streamlining the execution process and reducing direct dependencies on workflow implementations.
- Introduced new request and result models, `RunnableWorkflowActorRequest` and `RunnableWorkflowActorResult`, to support the updated execution capability.
- Enhanced dependency injection in `Maker` infrastructure to register the new capability, ensuring proper integration and functionality.
- Updated documentation to reflect changes in the workflow execution architecture and clarify the relationship between Maker and workflow capabilities.
- Removed the standalone Maker capability, integrating it as a plugin within the Workflow framework to enhance modularity and reduce coupling.
- Updated project references and dependencies to reflect the new structure, ensuring all Maker functionalities are accessed through the Workflow extensions.
- Refactored related services and interfaces to utilize the new `Aevatar.Workflow.Extensions.Maker`, streamlining the execution process and enhancing clarity in capability interactions.
- Revised documentation to clarify the new architecture and the relationship between Maker and Workflow capabilities, ensuring consistency across the project.
- Enhanced CI validation to enforce new architectural constraints and ensure compliance with the updated project structure.
- Unified the module architecture by introducing `IWorkflowModulePack`, allowing both core and extension modules to register through a consistent model.
- Removed the standalone `MakerModuleFactory`, integrating Maker functionalities into the `MakerModulePack` to enhance modularity and reduce coupling.
- Updated service registration methods to utilize the new pack model, ensuring all modules are registered uniformly.
- Enhanced documentation to clarify the new architecture and the relationship between Maker and Workflow capabilities.
- Improved CI validation to enforce architectural constraints and ensure compliance with the updated project structure.
- Introduced new solution files for `Aevatar.CQRS`, `Aevatar.Hosting`, and `Aevatar.Workflow`, enabling modular project organization and independent builds.
- Updated `aevatar.slnx` to include new project references for `Aevatar.Bootstrap.Extensions.AI` and workflow extensions, enhancing the integration of AI features.
- Refactored existing project dependencies to streamline the architecture and improve maintainability.
- Enhanced documentation to reflect the new project structure and clarify the relationships between modules.
- Improved CI validation to ensure compliance with the updated modular architecture.
- Introduced a new scorecard document for the Aevatar CQRS subsolution, detailing audit scope, architecture analysis, and scoring results.
- Added `IProjectionDispatchFailureReporter` interface to handle projection dispatch failures, improving error reporting mechanisms.
- Implemented `WorkflowProjectionDispatchFailureReporter` to publish errors to the workflow run session event stream, enhancing observability.
- Updated `ProjectionSubscriptionRegistry` to support failure reporting and cancellation token propagation during dispatch.
- Enhanced unit tests to validate new failure reporting functionality and ensure robust error handling in projection processes.
…on Error Handling

- Added a new scorecard document for the Aevatar Workflow subsolution, detailing audit scope, architecture analysis, and scoring results.
- Updated `WorkflowExecutionProjectionService` to improve error handling by publishing sink failure events for backpressure and write errors.
- Enhanced unit tests to validate the new error handling functionality, ensuring robust behavior during projection failures.
- Revised documentation to reflect the new scorecard and error handling improvements, clarifying the architecture and scoring criteria.
- Introduced a new test project for Aevatar AI, including unit tests for tool management and configuration.
- Implemented functionality in `AIGAgentBase` to track and refresh source-loaded tools, ensuring stale entries are removed during reconfiguration.
- Enhanced `ToolManager` with an `Unregister` method to facilitate tool removal by name.
- Updated service collection extensions for MEAI and Tornado providers to throw exceptions on multiple factory registrations, improving error handling.
- Revised documentation in README files to reflect changes in dependencies and architecture.
- Introduced a new scorecard document for the Aevatar Foundation subsolution, detailing the audit scope, architecture analysis, and scoring results.
- Included comprehensive sections on the subsolution composition, architectural analysis, and objective validation results.
- Documented the scoring criteria and provided a breakdown of scores across various dimensions, achieving a total score of 99/100 (A+).
- Enhanced the documentation with a visual representation of the subsolution structure and improvement suggestions for future development.
- Introduced new test projects for Aevatar.Hosting and Aevatar.Foundation.Runtime.Hosting, enhancing test coverage and modularity.
- Updated solution files to include references for the new test projects, ensuring they are part of the build process.
- Added comprehensive unit tests for service collection extensions and capability registration, validating functionality and error handling.
- Created documentation for the new test projects, outlining their purpose and integration within the overall Aevatar architecture.
- Introduced new integration tests for the Workflow Core Modules, covering various scenarios including tool parameter validation, tool discovery, and error handling.
- Implemented tests for the ForEachModule to ensure proper handling of empty inputs and sub-request dispatching.
- Added coverage for the WorkflowRunOutputStreamer, validating event streaming behavior and custom stop predicates.
- Enhanced overall test coverage to ensure robust functionality and error handling across workflow components.
- Introduced new unit tests for AI abstractions, focusing on the coverage of protocol message handling and validation.
- Added tests for the ToolCallLoop and ToolManager, ensuring proper execution flow and error handling for tool calls.
- Enhanced test coverage for the InMemoryStream, validating message dispatching and subscriber behavior.
- Updated project references to include new test files, improving overall test coverage and modularity across the Aevatar AI framework.
- Introduced new unit tests for AI hooks and role factory, ensuring comprehensive coverage of built-in hooks and their execution paths.
- Added tests for MCP tool providers, validating tool name sanitization and error handling during execution.
- Enhanced existing tests for AI abstractions, focusing on protocol message handling and validation.
- Updated project references to include new test files, improving overall test coverage across the Aevatar framework.
- Added coverage quality guard script to enforce line and branch coverage thresholds in CI.
- Introduced test stability guard script to detect and prevent polling waits in tests, ensuring deterministic behavior.
- Updated CI workflow to include coverage quality and test stability checks, improving overall test reliability.
- Added xunit.runner.json configuration for test execution settings.
- Created a new scorecard document for the Aevatar testing framework, detailing audit scope and results.
- Refactored tests to utilize TaskCompletionSource for improved synchronization and stability.
- Split the Workflow application command side into distinct services: `WorkflowChatRunApplicationService`, `WorkflowRunContextFactory`, `WorkflowRunExecutionEngine`, `WorkflowRunCompletionPolicy`, and `WorkflowRunResourceFinalizer` for better separation of concerns.
- Introduced new projection services: `WorkflowExecutionProjectionService`, `WorkflowProjectionActivationService`, `WorkflowProjectionReleaseService`, `WorkflowProjectionLeaseManager`, `WorkflowProjectionSinkSubscriptionManager`, `WorkflowProjectionLiveSinkForwarder`, `WorkflowProjectionSinkFailurePolicy`, and `WorkflowProjectionReadModelUpdater` to enhance modularity.
- Added CI guards to enforce limits on the size and dependencies of orchestration classes, preventing excessive complexity.
- Updated documentation to reflect the new architecture and component responsibilities, ensuring clarity in the workflow orchestration process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants