Skip to content

Feat/script gagent architecture change#23

Merged
eanzhao merged 39 commits intodevfrom
feat/script-gagent-architecture-change
Mar 5, 2026
Merged

Feat/script gagent architecture change#23
eanzhao merged 39 commits intodevfrom
feat/script-gagent-architecture-change

Conversation

@loning
Copy link
Copy Markdown
Contributor

@loning loning commented Mar 3, 2026

This pull request introduces a comprehensive architectural refactor and documentation update for the Aevatar.Scripting subsystem. The changes formalize a new event-driven, actor-based scripting evolution model, improve Orleans cluster consistency, and unify the query/response protocol. The update also includes extensive documentation and audit materials, new project structure entries, and enhanced test coverage.

Key changes:

1. Architecture and Documentation Updates

  • Added a detailed architecture document (docs/SCRIPTING_ARCHITECTURE.md) outlining the new event-driven, actor-oriented model for scripting evolution, including layering, actor responsibilities, protocol, and testing strategy.
  • Added an architecture change log and implementation guide, documenting the rationale, decisions, and technical implementation of the new model, with before/after comparisons and validation records. [1] [2]
  • Added a comprehensive architecture audit scorecard, showing the new design scores highly across modularity, CQRS, projection, and testability, and documenting closure of previous audit findings.

2. Solution and Project Structure

  • Added all Aevatar.Scripting.* projects (Abstractions, Core, Application, Infrastructure, Hosting, Projection) to the main solution (aevatar.slnx) and relevant solution filters, ensuring they are included in builds and IDE views. [1] [2] [3] [4]

3. Test Coverage

  • Registered new test projects for the scripting core, ensuring the new architecture is fully covered by both unit and integration tests, as described in the documentation.

4. Event-Driven Query/Response and Orleans Consistency

  • The new model unifies all scripting definition, catalog, and evolution queries as protocol buffer events, processed by actor handlers and returned via event streams, eliminating previous synchronous and cross-layer state access patterns. This improves consistency and reliability in distributed (Orleans) environments. [1] [2] [3]

5. Architectural Guardrails and Audit

  • Architecture guard scripts and documentation have been updated to include the new scripting layers and to ensure compliance with layering, dependency inversion, and state management constraints.

These changes collectively establish a robust, event-driven foundation for scripting evolution, with clear layering, improved testability, and strong documentation and auditability.

loning added 26 commits March 1, 2026 17:42
…mentation

- Updated the solution file to include new scripting projects: Aevatar.Scripting.Abstractions, Aevatar.Scripting.Core, Aevatar.Scripting.Hosting, and Aevatar.Scripting.Projection.
- Introduced detailed architecture and requirements documentation for the C# Script GAgent, outlining design goals, constraints, and implementation plans.
- Added an audit scorecard for the Script GAgent architecture, summarizing implementation status and compliance with architectural guidelines.
- Established foundational components for scripting capabilities, including protobuf contracts, command adapters, and sandbox policies to ensure secure script execution.

These changes aim to lay the groundwork for the C# Script GAgent functionality, enhancing modularity and compliance with existing architectural standards.
…cation ports

- Incremented version to v0.3 in architecture documentation.
- Added new requirements for controlled invocation of GAgents through `IGAgentInvocationPort` and `IGAgentFactoryPort`, ensuring lifecycle management by `IActorRuntime`.
- Enhanced documentation to clarify AI and GAgent reuse architecture, emphasizing composition over inheritance.
- Updated audit scorecard to reflect the current implementation status and outstanding tasks, including lifecycle boundary testing and port implementations.

These changes aim to refine the architectural guidelines and ensure robust lifecycle management for GAgent interactions.
…o for insurance claims

- Incremented version to v0.4 in the detailed architecture documentation.
- Enhanced requirements to include a business-meaningful multi-agent regression scenario for insurance claim processing, focusing on anti-fraud measures.
- Introduced a comprehensive TDD test case design document outlining the integration of multiple agents and AI capabilities.
- Updated the audit scorecard to reflect the addition of complex business scenario tests and outstanding tasks related to lifecycle boundary testing.

These changes aim to strengthen the architectural guidelines and ensure robust testing for multi-agent interactions in real-world business scenarios.
- Incremented version to v0.5 in the detailed architecture documentation.
- Split the GAgent functionality into two distinct agents: `ScriptDefinitionGAgent` for script definitions and `ScriptRuntimeGAgent` for execution, ensuring clear separation of responsibilities.
- Enhanced requirements to mandate that scripts are self-contained, with source text and metadata persisted for replay without external dependencies.
- Updated the audit scorecard to reflect the current implementation status, including outstanding tasks related to lifecycle boundary testing and dual-GAgent contract verification.
- Revised multi-agent TDD scenario documentation to align with the new architecture, emphasizing the need for scripts to be defined and executed through the respective GAgents.

These changes aim to strengthen the architectural framework and ensure robust testing and execution of multi-agent interactions in business scenarios.
- Introduced `ScriptDefinitionGAgent` and `ScriptRuntimeGAgent` to separate script definition and execution responsibilities.
- Updated protobuf contracts to reflect new state management, including `ScriptDefinitionState` and `ScriptRuntimeState`.
- Enhanced event handling for script definition and execution, ensuring persistence of source text and metadata for replay.
- Revised integration tests to validate the new architecture, including end-to-end scenarios for script execution and state transitions.
- Updated audit scorecard to reflect improvements and outstanding tasks related to lifecycle boundary testing and contract verification.

These changes aim to strengthen the architectural framework and ensure robust testing and execution of multi-agent interactions in business scenarios.
…ory port implementation

- Introduced `ScriptContractManifest` to encapsulate input/output schemas and state management for scripts.
- Updated `IScriptAgentDefinition` to include contract manifest, enhancing script metadata handling.
- Enhanced `ScriptExecutionContext` to carry additional runtime metadata, including run and correlation IDs.
- Implemented `IGAgentFactoryPort` for dynamic GAgent creation and lifecycle management through `RuntimeGAgentFactoryPort`.
- Revised integration tests to validate new contract manifest extraction and factory port functionality.

These changes aim to improve the flexibility and robustness of the C# Script GAgent architecture, facilitating better script execution and management in multi-agent scenarios.
…d state management

- Updated the architecture to support a dual-GAgent model, separating script definition and execution responsibilities.
- Introduced `IScriptRuntimeCapabilities` for enhanced runtime capabilities, allowing scripts to interact with AI and manage agent lifecycles.
- Enhanced `ScriptExecutionContext` to include current state and capabilities, improving script execution context management.
- Revised event handling to ensure state payloads are correctly managed and persisted during script execution.
- Updated integration and unit tests to validate new capabilities and ensure robust handling of decision statuses and manual review requirements.

These changes aim to improve the flexibility and robustness of the C# Script GAgent architecture, facilitating better script execution and management in multi-agent scenarios.
- Updated the architecture to transition from V1 to V2, introducing a dual-GAgent model with `ScriptDefinitionGAgent` and `ScriptRuntimeGAgent`.
- Replaced `IScriptAgentDefinition` with `IScriptPackageDefinition` and `IScriptPackageRuntime` to enhance script handling and execution.
- Improved `ScriptExecutionContext` to include current read model JSON and capabilities, facilitating better runtime context management.
- Revised event handling to ensure correct management of state and read model payloads during script execution.
- Introduced new contract manifests and execution engine interfaces to streamline script compilation and execution processes.
- Updated integration and unit tests to validate the new architecture and ensure robust handling of script execution scenarios.

These changes aim to enhance the flexibility, maintainability, and robustness of the C# Script GAgent architecture, aligning it with best practices for multi-agent interactions.
…ducer for improved state management

- Removed DecisionStatus and ManualReviewRequired properties from ScriptExecutionReadModel to simplify the model.
- Updated ScriptRunDomainEventCommittedReducer to streamline state and read model payload handling, ensuring correct assignment of StatePayloadJson and ReadModelPayloadJson.
- Added new unit tests for ScriptExecutionReadModelProjector to validate behavior with domain-specific payloads and ensure correct projection without inference.

These changes enhance the clarity and maintainability of the script execution architecture, aligning with best practices for state management.
…d schema handling

- Updated state evolution to utilize a strongly-typed `map<string, Any>` for `state_payloads` and `read_model_payloads`, improving type safety and clarity.
- Introduced a new `ScriptReadModelSchema` contract to allow scripts to define dynamic read model structures, including fields, indexes, and relations.
- Enhanced `ScriptExecutionContext` to include current state and read model as dictionaries, facilitating better runtime context management.
- Revised event handling to ensure correct management of read model schemas and state payloads during script execution.
- Added new events for schema declaration and validation to support dynamic read model capabilities.

These changes aim to improve the flexibility, maintainability, and robustness of the C# Script GAgent architecture, aligning it with best practices for dynamic schema management and state handling.
…ion updates

- Updated `ScriptRuntimeState` to utilize strongly-typed payloads for improved clarity and type safety.
- Added new integration tests for complex business scenarios, including `ClaimComplexBusinessScenarioTests` and `ClaimReadModelProjectorTests`, to validate end-to-end functionality.
- Revised existing tests to ensure comprehensive coverage of decision-making processes and AI interactions.
- Enhanced documentation to reflect the latest changes in state management and testing strategies, ensuring alignment with architectural goals.

These updates aim to strengthen the robustness and maintainability of the multi-agent script architecture, facilitating better testing and validation of complex business logic.
…te management

- Introduced `Aevatar.Scripting.Application` and `Aevatar.Scripting.Infrastructure` projects to separate application logic and infrastructure concerns, improving code organization.
- Added new protobuf definitions for script-related messages, enhancing type safety and clarity in state management.
- Updated `ScriptRuntimeExecutionOrchestrator` to streamline script execution and state handling, ensuring better runtime context management.
- Enhanced dependency injection setup to include new application and infrastructure components, facilitating better modularity.
- Revised documentation to reflect architectural changes and improvements in state management and script execution processes.

These updates aim to strengthen the maintainability and flexibility of the Aevatar.Scripting architecture, aligning it with best practices for modular design and state management.
…tate management

- Removed `DefaultScriptCapabilityFactory` to streamline capability management and enhance dependency injection.
- Introduced `NoopAICapability` to decouple AI capabilities from the runtime, allowing for more flexible AI integration.
- Updated `ScriptRuntimeExecutionOrchestrator` to directly utilize new ports for event routing, invocation, and factory management, improving clarity and reducing reliance on service locators.
- Enhanced `ScriptRuntimeCapabilities` to directly manage dependencies, eliminating the need for service provider lookups.
- Revised integration tests to ensure comprehensive coverage of the new architecture and validate the behavior of the updated components.

These changes aim to strengthen the maintainability and flexibility of the Aevatar.Scripting architecture, aligning it with best practices for modular design and state management.
…and remove outdated files

- Added a new detailed architecture document for Aevatar.Scripting, outlining the system's goals, constraints, and layered structure.
- Included sections on core domain objects, scripting capabilities, and the interaction between various components within the architecture.
- Removed outdated documentation files that are now superseded by the new architecture document, ensuring clarity and relevance in the project's documentation.

These changes aim to provide a clear and structured reference for developers and maintainers, enhancing understanding of the Aevatar.Scripting architecture and its components.
… remove outdated implementation plans

- Introduced a comprehensive document outlining the new autonomous evolution architecture for Aevatar.Scripting, detailing goals, key decisions, and change objectives.
- Defined the scope of the architecture, including capabilities for self-upgrading scripts and governance mechanisms for controlled evolution.
- Removed outdated implementation plans and related documents that are no longer relevant, ensuring clarity and focus on the new architecture.
- This update aims to provide a clear framework for future development and implementation of autonomous scripting capabilities within the Aevatar ecosystem.
…ocumentation

- Introduced a new section outlining the constraints and requirements for the `Script-Only Iteration Mode`, emphasizing automation and governance in script evolution.
- Specified that new script definitions must be triggered through a defined interface, prohibiting manual interventions in the release process.
- Added restrictions on business evolution state transitions and emphasized the necessity for complete event chains and audit records during upgrades.
- Clarified operational boundaries for manual interventions, ensuring adherence to the script evolution protocol.

These updates aim to enhance the clarity and enforceability of the autonomous evolution framework within the Aevatar.Scripting architecture.
…lution capabilities

- Updated documentation to reflect the transition from an execution-only framework to a dual-channel architecture supporting both external updates and self-evolution.
- Introduced new components for managing script evolution proposals, validations, and promotions, ensuring a unified governance process.
- Enhanced the `ScriptRuntimeCapabilities` interface to include distinct capabilities for interaction, agent lifecycle management, and evolution processes.
- Added new protobuf definitions for script evolution states and events, improving type safety and clarity in state management.
- Removed outdated files and consolidated documentation to focus on the new architecture, ensuring clarity and relevance for future development.

These changes aim to strengthen the maintainability and flexibility of the Aevatar.Scripting architecture, aligning it with best practices for autonomous evolution and governance.
…anagement

- Introduced `IScriptEvolutionFlowPort` and `IScriptingActorAddressResolver` to streamline the governance process for script evolution, consolidating policy, validation, and promotion into a unified flow.
- Updated `ScriptEvolutionManagerGAgent` to utilize the new flow port, reducing direct dependencies on individual components and improving maintainability.
- Enhanced `ScriptEvolutionApplicationService` and related components to leverage the address resolver for actor ID management, ensuring consistency and reducing hardcoded values.
- Revised documentation to reflect architectural changes and the introduction of new ports, clarifying the evolution process and actor address resolution.

These updates aim to strengthen the modularity and clarity of the Aevatar.Scripting architecture, aligning it with best practices for autonomous evolution and governance.
…catalog queries

- Introduced new protobuf messages for querying script definitions, catalog entries, and evolution decisions, enhancing the communication framework for script management.
- Implemented request adapters for handling queries related to script catalog entries, definitions, and evolution decisions, improving modularity and separation of concerns.
- Updated `ScriptCatalogGAgent`, `ScriptDefinitionGAgent`, and `ScriptEvolutionManagerGAgent` to handle new query events, ensuring robust response mechanisms for script-related requests.
- Removed outdated interfaces related to script snapshots, streamlining the architecture and focusing on the new event-driven approach.

These changes aim to enhance the flexibility and maintainability of the Aevatar.Scripting architecture, aligning it with best practices for autonomous script evolution and governance.
… event-driven features

- Updated the documentation to reflect the transition to version `v5`, clarifying the scope and constraints of the `Aevatar.Scripting` architecture.
- Enhanced the dual-source iteration model by detailing the governance process for both external updates and self-evolution, ensuring a unified approach.
- Introduced new event messages and request adapters for script evolution proposals, including decision request and reply identifiers, improving the event-driven communication framework.
- Implemented a timeout abstraction for query responses, enhancing the robustness of the architecture by avoiding hardcoded values.
- Revised the `ScriptEvolutionManagerGAgent` to handle decision responses directly, streamlining the evolution process and ensuring consistency across the system.

These changes aim to strengthen the maintainability and clarity of the Aevatar.Scripting architecture, aligning it with best practices for autonomous evolution and governance.
…h new event-driven features and refactoring

- Introduced a new architecture scorecard documenting the recent refactor, highlighting key conclusions and core restructuring items.
- Unified GAgent ports into a single `IGAgentRuntimePort`, reducing complexity and improving dependency management.
- Enhanced runtime capabilities by consolidating query/reply components and streamlining event-driven interactions.
- Removed outdated interfaces and components, focusing on a more modular and maintainable architecture.
- Updated various application services and adapters to align with the new event-driven model, ensuring consistency across the system.

These changes aim to improve the maintainability, clarity, and robustness of the Aevatar.Scripting architecture, aligning it with best practices for autonomous evolution and governance.
… and enhance modularity

- Introduced `IScriptLifecyclePort` to consolidate various script lifecycle operations, replacing multiple outdated ports and reducing complexity.
- Updated `ScriptEvolutionApplicationService` and `ScriptRuntimeCapabilityComposer` to utilize the new lifecycle port, streamlining dependencies and improving clarity.
- Removed obsolete ports and components, including `IScriptEvolutionPort`, `IScriptDefinitionLifecyclePort`, and `IScriptCatalogPort`, to focus on a more cohesive architecture.
- Enhanced documentation with a new architecture scorecard, detailing key changes and improvements in the system's structure and performance.

These changes aim to improve maintainability, clarity, and robustness of the Aevatar.Scripting architecture, aligning it with best practices for autonomous evolution and governance.
…ycle management

- Updated documentation to reflect the new version `v6` and clarified the scope of the Aevatar.Scripting architecture.
- Consolidated lifecycle management by introducing `IScriptLifecyclePort`, replacing outdated ports and improving modularity.
- Enhanced event-driven features by implementing decision request and reply identifiers in the `ProposeScriptEvolutionRequestedEvent`.
- Removed obsolete components, including `QueryScriptEvolutionDecisionRequestAdapter`, to streamline the architecture.
- Introduced a new architecture scorecard to document improvements and validate compliance with architectural standards.

These changes aim to improve maintainability, clarity, and robustness of the Aevatar.Scripting architecture, aligning it with best practices for autonomous evolution and governance.
…ution management

- Introduced `ScriptEvolutionSessionGAgent` to manage script evolution sessions, improving the handling of proposal states and decision responses.
- Updated `RuntimeScriptLifecyclePort` to adopt a session-based model, ensuring proposals are processed through dedicated session actors, enhancing modularity and clarity.
- Modified event messages to include `callback_actor_id` and `callback_request_id`, streamlining communication between components.
- Enhanced documentation to reflect changes in the evolution decision process and session management, ensuring alignment with architectural standards.

These updates aim to improve the maintainability and robustness of the Aevatar.Scripting architecture, aligning it with best practices for autonomous evolution and governance.
…with workflow processes

- Updated the `ScriptEvolutionSessionGAgent` to decouple direct stream pushes, now utilizing the `ProjectionSessionEventHub` for event handling.
- Introduced new interfaces and services for managing script evolution projections, including `IScriptEvolutionProjectionLifecyclePort` and `ScriptEvolutionProjectionLifecycleService`.
- Enhanced the `RuntimeScriptLifecyclePort` to integrate with the new projection lifecycle, ensuring a unified approach to session management.
- Updated documentation to reflect architectural changes and the new event-driven model for script evolution, improving clarity and maintainability.

These changes aim to streamline the evolution process, enhance modularity, and ensure alignment with best practices for autonomous governance in the Aevatar.Scripting architecture.
…nd projection lifecycle

- Introduced new abstractions for event sinks and projection lifecycle management, including `IEventSink<TEvent>`, `EventSinkProjectionLifecyclePort`, and `EventSinkProjectionLeaseOrchestrator`.
- Updated existing projection services to utilize the new event sink model, improving modularity and maintainability.
- Enhanced error handling in event sink operations with dedicated exceptions for backpressure and completion scenarios.
- Consolidated lifecycle operations for event sinks, ensuring a unified approach to attach, detach, and release projections.
- Updated documentation to reflect architectural changes and new interfaces, improving clarity for future development.

These changes aim to streamline event-driven interactions within the Aevatar.CQRS architecture, aligning with best practices for modular design and maintainability.
@eanzhao
Copy link
Copy Markdown
Contributor

eanzhao commented Mar 4, 2026

PR Review(非安全性范围)

TL;DR

这次是给 Aevatar 新增一套 Scripting 并行能力,并把 Workflow/Scripting 的实时回推链路统一到 CQRS Projection 模板上。

1) 这个分支具体做了什么

新增能力

  • 新增完整 Aevatar.Scripting.* 子系统:
    • Aevatar.Scripting.Abstractions
    • Aevatar.Scripting.Core
    • Aevatar.Scripting.Application
    • Aevatar.Scripting.Infrastructure
    • Aevatar.Scripting.Hosting
    • Aevatar.Scripting.Projection
  • 新增脚本演化入口:POST /api/scripts/evolutions/proposals
  • 新增脚本运行/演化 Actor 体系(Definition / Runtime / EvolutionManager / Catalog / Session)
  • 新增大量单测/集成测试覆盖脚本路径

架构重构

  • 下沉并统一实时事件 sink 与生命周期编排到 CQRS 层:
    • src/Aevatar.CQRS.Core.Abstractions/Streaming/EventSink.cs
    • src/Aevatar.CQRS.Core.Abstractions/Streaming/EventSinkProjectionLeaseOrchestrator.cs
    • src/Aevatar.CQRS.Projection.Core/Orchestration/ProjectionRuntimeLeaseBase.cs
  • Workflow 侧接入同一套模板,减少重复实现

2) 对 Aevatar 带来的“真正变化”

真正新增的价值

  • 获得了脚本化的运行与演化能力(可通过脚本驱动 upsert/spawn/run/propose/promote/rollback)。
  • Workflow 与 Scripting 的回推链路抽象统一,后续维护成本有机会下降。
  • 端到端测试资产明显增加,尤其是脚本演化场景。

3) 非安全性问题(按优先级)

P0 / High

  • 运行热路径重复编译,性能风险高
    • ScriptRuntimeExecutionOrchestrator 会先编译;
    • RoslynScriptExecutionEngineHandle/Apply/Reduce 又重复动态编译。
    • 影响:每次 run 的 CPU/内存开销偏大,事件多时放大明显。

P1 / Medium

  • ScriptRuntimeGAgent 的 pending run 缺少超时回收/统一失败收敛
    • _pendingRuns 主要依赖响应到达后移除;
    • 丢响应/错配时可能积压,仅日志告警,终态不够清晰。
  • 演化发布链路非原子(UpsertDefinition -> PromoteCatalog
    • 中间失败可能留下“定义已写入但 catalog 未切换”的悬挂状态。
  • Workflow hosting 默认自动装配 Script capability
    • AddWorkflowCapabilityWithAIDefaults() 内部直接 AddScriptCapability()
    • workflow-only host 行为面被扩大,兼容性预期可能受影响。

P2 / Low-Medium

  • CI 守卫目标类名与当前实现不一致
    • tools/ci/script_inheritance_guard.sh 仍检查 ScriptHostGAgent,与现有核心脚本 actor 不匹配。
  • 替代性证据不足
    • 目前测试证明“脚本路径可工作”,但缺少 YAML↔Script 的等价回归/迁移证明。

4) 这个变化是否有用(结论)

结论

  • 有用(作为新增并行能力):脚本化运行 + 演化链路确实扩展了系统能力边界。

建议落地姿势

  • 短期按“实验/灰度能力”推进,而非默认主链替换。

5) 建议的后续动作(非安全性)

  • 消除脚本运行路径重复编译(编译产物复用)
  • pendingRuns 增加超时回收与失败终态收敛
  • 给演化发布链路补偿/中间态治理(避免悬挂定义)
  • 将 workflow hosting 对 script capability 改为显式可选
  • 修正 script_inheritance_guard.sh 与现有 actor 命名一致
  • 增加 YAML 与脚本等价/迁移回归测试,并同步文档结论

loning added 3 commits March 4, 2026 15:10
…ment and modularity

- Updated the `RuntimeScriptLifecyclePort` to integrate new lifecycle services, including `RuntimeScriptEvolutionLifecycleService`, `RuntimeScriptDefinitionLifecycleService`, `RuntimeScriptExecutionLifecycleService`, and `RuntimeScriptCatalogLifecycleService`, promoting a more cohesive architecture.
- Introduced `DefaultEventSinkProjectionFailurePolicy` to streamline failure handling in event sink operations, replacing previous implementations.
- Removed obsolete components and interfaces related to script evolution projections, enhancing clarity and maintainability.
- Updated dependency injection configurations to reflect the new service structure, ensuring proper registration of lifecycle services and event sink management.

These changes aim to improve the maintainability and robustness of the Aevatar.Scripting architecture, aligning it with best practices for modular design and event-driven interactions.
…nt sink abstractions and lifecycle management improvements

- Updated the `Aevatar.Scripting` architecture to utilize specialized event sink interfaces, including `IEventSinkProjectionSubscriptionManager`, `IEventSinkProjectionLiveForwarder`, and `IEventSinkProjectionFailurePolicy`, streamlining event handling and improving modularity.
- Introduced `EventStreamQueryReplyAwaiter` for generic request/reply handling in actor query events, enhancing the robustness of query operations.
- Refactored lifecycle services to remove redundant code and unify event sink management, ensuring a cohesive approach to projection lifecycles.
- Updated dependency injection configurations to reflect the new event sink model, ensuring proper registration and integration across services.

These changes aim to improve maintainability, clarity, and robustness of the Aevatar architectures, aligning them with best practices for modular design and event-driven interactions.
…larity

- Updated the `Aevatar.Scripting` architecture to unify query routing and timeout management by introducing `ScriptingQueryChannels` and `ScriptingPortTimeoutExtensions`, reducing hardcoded values and enhancing maintainability.
- Consolidated role actor ID resolution logic into `WorkflowRoleActorIdResolver`, streamlining the process across multiple modules.
- Refactored various components, including `RuntimeScriptCatalogLifecycleService` and `ScriptEvolutionManagerGAgent`, to utilize the new abstractions, improving code clarity and reducing redundancy.
- Introduced `WorkflowRunTaskAwaiter` to standardize task completion handling, enhancing robustness in workflow execution.

These changes aim to enhance the maintainability and clarity of the Aevatar.Scripting architecture, aligning it with best practices for modular design and event-driven interactions.
loning and others added 10 commits March 4, 2026 16:29
…tus management and enhance modularity

- Introduced `ScriptEvolutionStatuses` to centralize status definitions, improving consistency across the architecture.
- Updated various components, including `ScriptPromotionDecision` and `ScriptEvolutionManagerGAgent`, to utilize the new status constants, reducing hardcoded values and enhancing maintainability.
- Refactored request adapters to leverage `ScriptingActorRequestEnvelopeFactory`, streamlining event envelope creation and improving code clarity.
- Enhanced dependency injection configurations to include `RuntimeScriptQueryClient`, ensuring proper registration and integration across services.

These changes aim to improve the maintainability, clarity, and robustness of the Aevatar.Scripting architecture, aligning it with best practices for modular design and event-driven interactions.
Consolidate script lifecycle, evolution, and runtime pipeline updates with stronger event-driven query handling, host capability integration, and expanded regression coverage across scripting and workflow tests.

Made-with: Cursor
…event sink management and lifecycle operations

Made-with: Cursor

# Conflicts:
#	src/Aevatar.Scripting.Core/ScriptEvolutionManagerGAgent.cs
#	src/Aevatar.Scripting.Infrastructure/Ports/RuntimeScriptLifecyclePort.cs
…AI/aevatar into feat/script-gagent-architecture-change
…ans 3-node cluster integration

- Introduced `Orleans3ClusterIntegrationFactAttribute` to conditionally skip tests based on the `AEVATAR_TEST_ORLEANS_3NODE` environment variable.
- Updated `ScriptAutonomousEvolutionComprehensiveE2ETests` and `ScriptAutonomousEvolutionOrleans3ClusterConsistencyTests` to use the new attribute, ensuring proper test execution based on the Orleans cluster configuration.
…stence of definitions

- Modified tests to check for the existence of `sendToDefinitionId` and `invokeDefinitionId` before accessing their properties, enhancing test reliability.
- Removed assertions related to `sendToDefinition` state, focusing on `invokeDefinition` validation to streamline test logic.
- Updated `ScriptRuntimeExecutionOrchestrator` to improve error handling and resource disposal for compiled definitions.
- Enhanced `ScriptCatalogGAgent` to maintain active metadata during script revision updates.
- Modified `AddWorkflowCapabilityWithAIDefaults` to enable script capability by default, improving usability.
- Added tests for script runtime execution and catalog behavior to ensure robustness and correctness.

These changes aim to enhance the reliability and clarity of the Aevatar.Scripting architecture, aligning it with best practices for modular design and event-driven interactions.
…AI/aevatar into feat/script-gagent-architecture-change
- Updated `ClaimScriptDocumentDrivenFlexibilityTests` to correct state validation for event IDs.
- Expanded `ScriptCatalogGAgentTests` with multiple scenarios for handling missing or invalid script definitions, ensuring robust error responses.
- Added comprehensive tests in `ScriptDefinitionGAgentReplayContractTests` for snapshot queries, including cases for missing revisions and empty sources.
- Introduced new tests in `ScriptEvolutionManagerGAgentTests` to validate proposal handling and decision responses, improving coverage for edge cases.
- Enhanced `ScriptRuntimeGAgentEventDrivenQueryTests` with additional checks for error conditions during script execution, ensuring proper failure handling.

These changes aim to strengthen the testing framework, ensuring better coverage and reliability of the Aevatar.Scripting architecture.
@eanzhao eanzhao merged commit 47836f2 into dev Mar 5, 2026
8 checks passed
eanzhao added a commit that referenced this pull request May 8, 2026
Address review batch on PR #562 (10 inline comments). All in files I have
recent ownership of and require no architectural shifts:

- #16 (blocker, security): ssh_exec is now opt-in via NyxIdToolOptions.
  EnableSshExecTool. Hosts that haven't wired the approval middleware no
  longer see the tool by default. Mainnet host opts in (Lark bot needs it).
- #21 (major, bug): code_execute keeps the modern /execute + {language,
  script} contract, but on a NyxID-proxy upstream 404 it retries the legacy
  /run + {language, code} contract so deployments still pinned to old
  chrono-sandbox-service builds keep working.
- #22 (major, bug): SkillRegistry.IsFresh now exempts SkillSource != Remote
  from TTL — local skills are baked in at registration and don't need
  expiring; prior behavior dropped them from use_skill after the first 5min.
- #18 (major, bug): TurnRunner.TryResolveSenderBindingAsync narrows the
  catch to transient infra errors (Http/Timeout/IO/JSON) and surfaces
  non-transient (logic, NRE, serialization) at Error level so ops can
  distinguish "sender unbound" from "binding store broken".
- #19 (major, bug): ConversationReplyGenerator narrows the
  sender-route-fallback catch to transient errors via
  IsRetryableSenderRouteFailure. Programmer errors no longer cost an LLM
  round on retry.
- #29 + #30 (minor): inbox runtime gives metadata enrichment its own 15s
  budget separate from the LLM run, surfacing
  errorCode=llm_reply_metadata_timeout when scope/UserConfig lookup is
  slow. ResolveFallbackTimeout treats ResponseTimeoutSeconds<=0 as "no
  timeout" rather than silently snapping back to 120s.
- #12 (minor): ConversationGAgent's stream-chunk and final-stream-chunk
  edits run under a 10s CTS now; the failure path already uses one. A hung
  relay can no longer pin the actor turn forever.
- #27 (minor, security): ConstantTimeEquals docstring tightened — removed
  the "for future callers" line and added a SCOPE comment that this helper
  is rebuild-admin-only and shouldn't be promoted to internal/public
  without replacing its length-leak with a length-padding scheme.
- #23 (major, bug): CLI ornn skills slug default → ornn-api (matches the
  registered slug; bare "ornn" is the SPA frontend that returns HTML).

Build clean (NyxId / Skills / NyxidChat / Mainnet hosts), 30 AI tests +
15 inbox runtime tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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